mrxvt-0.5.4/0000777000175000001440000000000011045531320007673 500000000000000mrxvt-0.5.4/FAQ0000644000175000001440000012215710756127603010166 00000000000000-------------------------------------------------------------------------- Frequently Asked Questions (FAQ) -------------------------------------------------------------------------- Q: I have a question... Q: What exactly is the name of this project, materm or mrxvt? Q: Why not use GNU screen? It has provided the multi-screen features! Q: Why not use gnome-terminal/konsole? They have provided the functionality of mrxvt! Q: How to build mrxvt, since I cannot find the configure script as usual!? Q: Shift+Left/Right do not always work. Ctrl+Shift+6 does not do anything. Some other keyboard shortcut do not work either. Q: I just upgraded to mrxvt-0.5.x, and feature XXX doesn't work anymore. Q: When I run mrxvt from command line, it outputs lots of verbose text. How to disable it? Q: I do not have root privilege on my system. Can I install mrxvt, and what are the restrictions if I install it as normal user? Q: When I run mrxvt with multiple tabs, why does the output of the `w' command shows many users are using the system? Q: I dislike the default mrxvt font, so I have installed some new fonts, like the Verdana font. But when I run mrxvt with option `-fn verdana', mrxvt complains that it cannot find the verdana font! What is wrong? Q: When I want to use Chinese (or Korea/Japanese) encoding and font, executing command `mrxvt -km gb -mfont fontname' is not working! For example, it complains that -km is a bad option. Q: I have ~/.Xdefaults and ~/.mrxvtrc, which one is the first to be read? Q: How do I input Chinese (or Korea/Japanese) in mrxvt? Q: I execute mrxvt with CJK encoding and X11 fonts. But sometimes CJK characters are not display completely, or there are some extra pixels left after the CJK characters. Q: Does mrxvt support UTF-8 locale/encoding method? Q: I use UTF-8 as default encoding method, but mrxvt does not support it. So can I start mrxvt with other encoding method, e.g., zh_CN.GB2312 without changing the default encoding method? Q: I run mrxvt with `-o 25' option, but the window is not translucent! Q: When I run mrxvt in transparent mode or background image mode, can I make the background a little darker? Q: Why the tinting does not work after I set the tint color in command line or ~/.mrxvtrc? Q: I am tired with the current tinting color, can I change the color without restart mrxvt? Q: How to start mrxvt with multiple tabs initially? Q: How do I let each tab execute different applications when mrxvt starts? Q: How to change the title of a tab after mrxvt starts? Q: My Control-Left / Right and Home / End keys do not work properly in some applications. Q: How do I set the tab title to the current command? Q: How to dynamically change the title of the mrxvt window so that it is the same as the current active tab when I switch to a new tab? Q: Why cannot I close a tab? The close button is grey! Q: Is there any keyboard combination to manipulate the tabs? Q: Mrxvt default hotkey ctrl+shift+minus conflicts with Emacs. How can I disable this mrxvt default hotkey? Q: How to enable freetype font, or, say the XFT support? Q: After I use freetype font, the text rendering speed seems to slow down a lot! How to improve the speed? Q: After I use freetype font, the line space seems too large. Is there any way to narrow down the line space? Q: Can I change the color of tab background and text? Q: I notice that sometimes there is a dash-dot frame around the title of inactive tabs. What has happened? Is it a bug? Q: I notice that the inactive tab is highlighted by the dash-dot frame, but after I switch to it, I see nothing happened. What is wrong with it? Q: I like to use command line options to create a new tab in the current mrxvt terminal and execute some commands. For example, if I run command `mrxvt --new-tab -e pine' in a mrxvt terminal, the current terminal will open a new tab and run pine in it. Can you implement it for me? Q: I like to use context menu when I right click in the terminal window. For example, to copy/paste text. Can you support it? Q: Will you rewrite mrxvt using C++? The object oriented feature of C++ can make mrxvt much modular. Q: How do I know which mrxvt version I'm using? Q: Mouse cut/paste suddenly no longer works. Q: What's with this bold/blink stuff? I can never get blinking text! Q: I don't like the screen colors. How do I change them? Q: What's with the strange Backspace/Delete key behaviour? Q: Why doesn't the Backspace key work on my Linux machine? Q: I don't like the key-bindings. How do I change them? Q: I'm using keyboard model XXX that has extra Prior/Next/Insert keys. How do I make use of them? For example, the Sun Keyboard type 4 has the following mappings that mrxvt doesn't recognize. Q: How do I distinguish if I'm running mrxvt or a regular xterm? I need this to decide about setting colors etc. Q: How do I set the correct, full IP address for the DISPLAY variable? Q: Can I search the scroll back buffer? Q: Where is the CVS repository of mrxvt? Q: I find a bug, or I would like to see a new feature in mrxvt, how to report it? -------------------------------------------------------------------------- Frequently Asked Questions with answers :) -------------------------------------------------------------------------- ----- Q: I have a question... A: Have you read the README, README.configure, INSTALL, FAQ, TIPS, man page...? Before asking a question, please read through these documents for potential answers. Here is a good tutorial to ask questions: http://www.catb.org/~esr/faqs/smart-questions.html ----- Q: What exactly is the name of this project, materm or mrxvt? A: The current official name of this project is mrxvt (I honestly hope Rui Carmo will not reclaim the ownership of mrxvt because he is the first person who tried to hack a multi-tab rxvt on Cygwin and got this name for his project. Here is the link of his work: http://the.taoofmac.com/space/Projects/mrxvt). As stated in README, in the beginning, the project name was materm - derived from the project multi-aterm. And this was the name when I registered the project at sourceforge. Unfortunately it is not easy to rename materm to mrxvt at sourceforge. This is why we keep materm as the name at sourceforge. ----- Q: Why not use GNU screen? It has provided the multi-screen features! A: Because I do not like GNU screen. ;-) People have their own flavors. Plus, mrxvt provides some features that GNU screen lacks, e.g., use mouse click to switch from different tabs... :p ----- Q: Why not use gnome-terminal/konsole? They have provided the functionality of mrxvt! A: Because they are heavy, slow, and depend on too many libraries. For example, gnome-terminal 2.6.1 in the Slackware -current tree depends on 58 libraries, konsole of KDE 3.3 in the gentoo depends on 41 libraries, mrxvt with all features only depends on 19 libraries, and this number can be further reduced to 5 (of course you need to strip out some features, like background image ;-))!! Since all I need is a fast and lightweight X terminal emulator supporting multi-tabs, I decide to create mrxvt by myself. ----- Q: How to build mrxvt, since I cannot find the configure script as usual!? A: Have you read the INSTALL file? ----- Q: Shift+Left/Right do not always work. Ctrl+Shift+6 does not do anything. Some other keyboard shortcut do not work either. A: Do not report these issues as bugs. They most certainly are NOT. As of mrxvt-0.5.0, a lot have changed, this includes a few default keyboard shortcut sequences. Shift+Left/Right by default is only bound when you are in the primary screen. This is because good editors (i.e. Vim) use this keyboard combination to move between words. This of course can be changed by adding the following lines to your ~/.mrxvtrc Mrxvt.macro.Shift+Left: GotoTab -1 Mrxvt.macro.Shift+Right: GotoTab +1 but we recommend you use Ctrl+PgUP/PgDn or Ctrl+Shift+h/l to switch tabs instead. About Ctrl+Shift+6: Vim uses this sequence to switch to the "alternate" file. However when you press it in mrxvt, it seems to do nothing. This is because pressing Ctrl+Shift+6 by default moves the current tab to position 6. Most terminal applications we know of so far can NOT tell the difference between Ctrl+Shift+number and Ctrl+number. Thus pressing Ctrl+6 in Vim will switch to the alternate buffer, so mrxvt can safely swallow the Ctrl+Shift+6 keystroke. ---- Q: I just upgraded to mrxvt-0.5.x, and feature XXX doesn't work anymore. A: Don't panic! Something is possibly different in the latest release. The following are the changes you need to be most wary of when upgrading to mrxvt-4.x to 0.5.x: 1. Background tinting works differently when compiled with XRender support (enabled by default in 0.5.0). Now if you want your background tinted to a specific color, you need to set the tintColor resource to that color, and NOT the mask (as you had to in 0.4.x). Specifically, if you want a dark tint, then set tintColor to #000000 (in 0.4.x you would set it to #ffffff). Also keep in mind that very bright colors (e.g. #ffffff) are not very transparent and not good for tinting. 2. The default terminal name is now "rxvt" and not "xterm". On systems with badly configured termcap / terminfo entries for "rxvt", this will cause NUMEROUS ncurses based programs to behave very badly (including bash!). If you have any problems, ask your Linux vendor to fix this! Or wimp out and set the termName resource to "xterm" in your ~/.mrxvtrc 3. The old "hotkey" feature has been disabled. The new "macro" feature in 0.5.0 extends the functionality of the old "hotkey" feature. 4. The menu syntax for actions from 0.5.x is incompatible with the syntax from earlier versions. See the man page for details. 5. The keysym resource is disabled by default (use macros instead). 6. A few default key-bindings were changed (mainly to adhere to the convention that terminal programs should use Ctrl-Shift modifiers for all it's shortcuts, and let the window manager / child process use other modifier combinations). For example the Shift+Left / Shift+Right macros to switch tabs are enabled ONLY in the primary screen (i.e. they will not work when you are running Vim). Vim uses Shift+Left/Right to move between words, so we do not override this behaviour in Vim. Read the man page and /etc/mrxvt/mrxvtrc for a complete list and description of the macros defined in 0.5.x. 7. A few escape sequences (controlling creation / movement of tabs) have been disabled for security reasons. The functions can of course be accessed using keyboard macros or the popup-menus. 8. Escape sequences generated by function keys / modified cursor keys have now been changed to produce exactly the same escape sequences as Xterm does. (If you don't like this, then undefine the macro XTERM_KEYS in src/feature.h). As a result of this, to get Ctrl+Left / Right working in your shell, change ~/.inputrc the way you would for Xterm (not rxvt). This is described later on in this FAQ. 9. The option --tabShell, --cmdInitTabs have been removed. The options --initTermNum and --vt%d.xx have been marked as obsolete. Mrxvt-0.5.0 has a new "profile" feature intended to replace the above options. Here settings are associated to a "profile" instead of a tab. Tabs can be created on demand with any desired profile. (The earlier design led to some unresolvable bugs when the user moved tabs). Migrating to profiles is easy: 1. Replace the old vt%d.xx resources with profile%d.xx. remember that the profile%d resources refer to the PROFILE number, and not the TAB number. 2. To open a new tab with profile number N use the macro "NewTab -N". E.g. Mrxvt.macro.Ctrl+Shift+F1: NewTab -1 Mrxvt.macro.Ctrl+Shift+F2: NewTab -2 Mrxvt.macro.Ctrl+Shift+F3: NewTab -3 Mrxvt.macro.Ctrl+Shift+F4: NewTab -4 3. Finally replace your initTermNumber option with initProfileList. The argument to initProfileList is a comma separated list of profiles you want opened in new tabs on startup. A more complete list of changes is in the ChangeLog, and in the Subversion logs. ----- Q: When I run mrxvt from command line, it outputs lots of verbose text. How to disable it? A: You probably have configured mrxvt with debug support. You need to reconfigure mrxvt to disable debug support and rebuild it, like the following: $ ./configure --enable-whatever-options --disable-debug $ make ----- Q: I do not have root privilege on my system. Can I install mrxvt, and what are the restrictions if I install it as normal user? A: Surely you can install mrxvt without root privilege. You can configure mrxvt with --prefix=/home/youraccount and install it. Or you can simply copy the mrxvt program to anywhere you wish. Mrxvt only requires setuid root in order to write to utmp/wtmp/lastlog. If you do not have root privilege, you will only lose this feature. ----- Q: When I run mrxvt with multiple tabs, why does the output of the `w' command shows many users are using the system? A: This is because each mrxvt tab logs itself in an entry of the utmp file. If you do not want this feature, remove the setuid permission from mrxvt binary and do not build mrxvt with utempter support. ----- Q: I dislike the default mrxvt font, so I have installed some new fonts, like the Verdana font. But when I run mrxvt with option `-fn verdana', mrxvt complains that it cannot find the verdana font! What is wrong? A: There are two types of fonts in X Window System, the ancient X11 bitmap fonts and the new freetype fonts. Mrxvt is capable to use either type of fonts. The X11 bitmap fonts have a special format of names. You can execute command `xlsfonts | more' to get a complete list of all X11 bitmap fonts installed in your system, and pick one you like. Or you can execute program `xfontsel' to pick one, which shows you the look of the font nicely. As you can see, the font name is in a special format like the following example. That is why mrxvt complains if you only provide the name of the font: -adobe-courier-bold-o-normal--14-140-75-75-m-90-iso8859-1 The freetype fonts are much simpler to handle. You only need to give the font family name to `-xftfn' option, there is not a magic format like X11 font. You can specify other characteristics of the freetype font using other related options. ----- Q: When I want to use Chinese (or Korea/Japanese) encoding and font, executing command `mrxvt -km gb -mfont fontname' is not working! For example, it complains that -km is a bad option. A: Most probably, you have not enabled gb/big5/kanji/korea options when you configure the mrxvt. These options are turned off by default. Reconfigure mrxvt to enable these options and rebuild it like the following: $ ./configure --enable-cjk --enable-whatever-other-options $ make $ su $ make install ----- Q: I have ~/.Xdefaults and ~/.mrxvtrc, which one is the first to be read? A: ~/.mrxvtrc will be the one to be read, and ~/.Xdefaults is ignored. Mrxvt tries to read three resources files in sequence: ~/.mrxvtrc, ~/.Xdefaults and ~/.Xresources. If either one is successfully opened, the rest are ignored. Very soon the ~/.Xdefaults and ~/.Xresources files will not be used by mrxvt, and we recomend you call your config file ~/.mrxvtrc. ----- Q: How do I input Chinese (or Korea/Japanese) in mrxvt? A: First of all, you need to to enable the language options for Chinese/Korea/Japanese as the above question when you configure mrxvt. You also needs to enable the XIM option (--enable-xim). Then make sure you have correctly setup and started the XIM server, like SCIM, Chinput, fcitx, etc. Next, set the correct locale for mrxvt. You only need to set the environment variable LC_CTYPE. But after you set it, make sure that the environment variable LC_ALL is not set. Finally, set the correct X resources in ~/.mrxvtrc file as the followling. Remember the value of inputMethod is case sensitive. mrxvt*multichar_encoding: GB mrxvt*inputMethod: SCIM ----- Q: I execute mrxvt with CJK encoding and X11 fonts. But sometimes CJK characters are not display completely, or there are some extra pixels left after the CJK characters. A: This is a known issue for displaying CJK characters using X11 fonts. Mrxvt requires that the width of each CJK character (mfont) be twice as the width of each english character (font). If this condition is not met, mrxvt may display CJK characters with some problems. For example, if you choose 6x12 as the font, and the SimSun font as the mfont, but the width of the SimSun font is 13, you will get in trouble. In particular, let us assume that you want to display a string "XXabc", where "XX" represents a single Chinese character. With SimSun font, the width of "XX" is 13, but mrxvt thinks it is 12 (= 2 * 6)!!! Thus, when "abc" is displayed, two pixels of "XX" will be overwritten by "a"! There are two solutions to this issue. One is to carefully choose the font and mfont such that the width of mfont is twice of the font. The other is to use freetype font, where we have a special handling to avoid this problem. ----- Q: Does mrxvt support UTF-8 locale/encoding method? A: Not now. This is a planned work and hopefully will be supported in the next development branch (0.5.x). ----- Q: I use UTF-8 as default encoding method, but mrxvt does not support it. So can I start mrxvt with other encoding method, e.g., zh_CN.GB2312 without changing the default encoding method? A: No problem! You can start mrxvt like the following if you use bash/ksh/sh: LC_CTYPE=zh_CN.GB2312 mrxvt & If you use csh, try the following env LC_CTYPE=zh_CN.GB2312 mrxvt & ----- Q: I run mrxvt with `-o 25' option, but the window is not translucent! A: First make sure your X server support translucent, such as Xorg 6.8.1. Next, make sure the translucent extension is enabled in the X server. You can use command `xdpyinfo' to check whether the Composite extension is in the extension list. Then make sure you have run the program `xcompmgr' to enable translucent. ----- Q: When I run mrxvt in transparent mode or background image mode, can I make the background a little darker? A: Yes, you can. Just tint the background to black using the --shading and --tintColor options: Mrxvt.transparent: True Mrxvt.transparentScrollbar: True Mrxvt.transparentTabbar: True Mrxvt.tintColor: #000000 Mrxvt.shading: 85 You can use Ctrl+Shift+J / K to change the shading amount when mrxvt is running. ----- Q: Why the tinting does not work after I set the tint color in command line or ~/.mrxvtrc? A: First, tinting only works for user supplied background image or transparent background. Secondly, you have to set the shade option as well. ----- Q: I am tired with the current tinting color, can I change the color without restart mrxvt? A: Yes, you can. Control-RightClick on the terminal window. Select the "Transparency / Tint Background / " menu options. Alternately you can run use an escape sequence as follows: $ echo "\e]66;red\a" You can have macros / menu entries to do the same. See also the program settitle.c and mrxvtset.pl supplied with the source, and mrxvt_seq.txt.bz2 for a complete list of escape sequences supplied by mrxvt. ----- Q: How to start mrxvt with multiple tabs initially? A You can set the number of tabs you want in ~/.mrxvtrc as the following example: mrxvt.initProfileList: 0,0,0 Alternatively, you can set it using command line option -ip. ----- Q: How do I let each tab execute different applications when mrxvt starts? A: You can set command for each tab in ~/.mrxvtrc as the following example: Mrxvt.profile1.background: #000040 Mrxvt.profile1.command: !mc Mrxvt.profile1.tabTitle: "Midnight Commander" Mrxvt.profile2.command: telnet www.mitbbs.com Mrxvt.initProfileList: 0,1,2 This will open three tabs on startup containing the shell, mc and telnet. See /etc/mrxvt/mrxvtrc.sample for a more complete example. If you only want to change the tab command in other tabs (and not the background / saveLines etc), then you can use the NewTab macro as follows: Mrxvt.macro.Ctrl+Shift+F1: NewTab "man mrxvt" man mrxvt Mrxvt.macro.Ctrl+Shift+b: NewTab bash Mrxvt.macro.Ctrl+Shift+v: NewTab "Vim" !vim ----- Q: How to change the title of a tab after mrxvt starts? A: You can select some text in the mrxvt terminal and press the hot key combinations: Ctrl+Shift+s, Shift+Delete or middle click with the mouse. The tab title will be changed to the selected text. Currently, the selected text must be in the same mrxvt terminal. You can also change the tab title through escape sequence. $ echo -ne "\e]62;New tab title\a" Alternately use compile settitle.c, or use the perl script mrxvtset.pl. ----- Q: My Control-Left / Right and Home / End keys do not work properly in some applications. A: To get your modified cursor keys working properly in Vim, just upgrade to Vim 7. The new behaviour in mrxvt is designed to work "out of the box" with Vim 7. To get your modified cursor keys working in bash / readline based applications put the following in your ~/.inputrc: # Cursor movement for mrxvt-0.5.x / xterm "\e[1;5C": forward-word "\e[1;5D": backward-word "\e[7~": beginning-of-line "\e[8~": end-of-line As of 0.5.0 the escape sequences mrxvt produces for modified cursor keys is the same as those produced by Xterm. If you do not like this behaviour, undefine the XTERM_KEYS macro in src/feature.h. Alternately you can use the macro feature of mrxvt to make the cursor keys produce the string that is expected by your application (explained later on in this FAQ) ----- Q: How do I set the tab title to the current command? A: Bash users add the following to your ~/.bashrc: # Change the window title of X terminals if [[ $TERM =~ "xterm|rxvt" ]]; then # set -o functrace if [[ -n $MRXVT_TABTITLE ]]; then trap 'echo -ne "\e]61;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG else trap 'echo -ne "\e]0;${BASH_COMMAND//\"/} (${PWD/$HOME/~})\a"' DEBUG fi fi Alternately (for tcsh), if you want your current command displayed in your tab title, add the following lines to your ~/.tcshrc # Change the window title of X terminals set backslash_quote if( $?DISPLAY && $?TERM ) then if( $?MRXVT_TABTITLE ) then # Set the tab title for mrxvt alias jobcmd 'echo -n \\\\033]61\;\!#:q \($cwd\) \\\\007 > /dev/stderr' alias cwdcmd 'echo -n \\\\033]61\;\!#:q \($cwd\) \\\\007 > /dev/stderr' else # Set the window title for xterm alias jobcmd 'echo -n \\\\033]0\;\!#:q \($cwd\) \\\\007 > /dev/stderr' alias cwdcmd 'echo -n \\\\033]0\;\!#:q \($cwd\) \\\\007 > /dev/stderr' endif endif unset backslash_quote ----- Q: How to dynamically change the title of the mrxvt window so that it is the same as the current active tab when I switch to a new tab? A: You can set X resources `syncTabTitle' to true or run mrxvt with -stt option. ----- Q: Why cannot I close a tab? The close button is grey! A: Most probably, you have enabled the protectSecondary resource and you are running an application, like vi and mc that is using the secondary screen in the current tab. Mrxvt considers this tab being protected and disallows you to close it. To close the tab, please exit the application first. To disable this option, you can modify the ~/.mrxvtrc file or run mrxvt with +ps option. ----- Q: Is there any keyboard combination to manipulate the tabs? A: Yes. Please read the man page. Mrxvt currently support the default gnome-terminal and konsole combinations. If you prefer your own combinations, you can define them in the configuration file as well. Please refer to the man page for details. ----- Q: Mrxvt default hotkey ctrl+shift+minus conflicts with Emacs. How can I disable this mrxvt default hotkey? A: Put the following two lines into your mrxvt configuration file, usually ~/.mrxvtrc: Mrxvt.macro.Ctrl+Shift+underscore: Dummy Mrxvt.macro.Ctrl+Shift+plus: Dummy ----- Q: How to enable freetype font, or, say the XFT support? A: You can either use the -xft command line option or the `xft' X resource option in the ~/.mrxvtrc file. Check the sample configuration file doc/xdefaults-sample.txt and man page for more details. ----- Q: After I use freetype font, the text rendering speed seems to slow down a lot! How to improve the speed? A: Yes, this is a known problem with XFT support. One way to fix it is to disable antialias (and autohinting or hinting). But it may make the font look ugly. If you do not like it, disable XFT support and use X11 font instead. ----- Q: After I use freetype font, the line space seems too large. Is there any way to narrow down the line space? A: This is probably because you have enabled the multichar support when you configure mrxvt. In this case, mrxvt loads two fonts, one the normal font, and one the multichar font. But due to some problems with XFT library, the font loading function does not follow our instructions to load the two fonts at specified size. Thus, the size of two fonts are often different. To get a better rendering result, mrxvt picks the large size, which is usually the multichar font. But normal text are usually displayed using normal font at a smaller size. So it appears that the line space is too large. To solve this problem, you can specify the multichar font be the same as the normal font since mrxvt 0.3.9, or specify the -xftnfm option to not to load multichar font, or build mrxvt without multichar support. ----- Q: Can I change the color of tab background and text? A: Yes you can. You can use command line option to set foreground and background color of active or inactive tabs like this: $ mrxvt -tabfg blue -tabbg grey -itabfg black -itabbg dark Or you can set them in ~/.mrxvtrc like this: ! text color of active tab Mrxvt.tabForeground: blue ! background color of active tab Mrxvt.tabBackground: grey ! text color of inactive tab Mrxvt.itabForeground: black ! background color of inactive tab Mrxvt.itabBackground: dark Or you can use an escape sequence to change it dynamically (see the man page). ----- Q: I notice that sometimes there is a dash-dot frame around the title of inactive tabs. What has happened? Is it a bug? A: This is a new feature introduced from 0.3.9. This indicates that something has happened in the inactive tab, and you probably should check it. You can try using the -htb option to ensure that inactive tabs are highlighted only when a bell is sounded by that tab. ----- Q: I notice that the inactive tab is highlighted by the dash-dot frame, but after I switch to it, I see nothing happened. What is wrong with it? A: This is because you might be running some programs in the inactive tab, like pine. These programs have some features to refresh the screen periodically, though the content of the screen has not changed. Mrxvt detects the refresh and thinks the screen has changed. It is difficult to tell whether the content of the screen is truly changed in this case. You can try using the -htb option to ensure that inactive tabs are highlighted only when a bell is sounded by that tab. ----- Q: I like to use command line options to create a new tab in the current mrxvt terminal and execute some commands. For example, if I run command `mrxvt --new-tab -e pine' in a mrxvt terminal, the current terminal will open a new tab and run pine in it. Can you implement it for me? A: Unfortunately, no. This is a dangerous feature that can cause serious security problems. For details about the security problem, consult to the following link: http://www.digitaldefense.net/labs/papers/Termulation.txt As of mrxvt-0.5.0, you can have macros (or menu items) that open a new tab and execute your favourite program in it (but you have to press a key or select from a menu in your mrxvt window). Multiple window support is planned in the near future, and maybe then something will be done about this issue after multiple window support is implemented. ----- Q: I like to use context menu when I right click in the terminal window. For example, to copy/paste text. Can you support it? A: YES! As of mrxvt-0.5.0 popup menus are supported. By default control right click on the terminal for a (customizable) menu. Control left click (or right click on the tabbar) for a list of all tabs. You must compile mrxvt with --enable-menubar. ----- Q: Will you rewrite mrxvt using C++? The object oriented feature of C++ can make mrxvt much modular. A: No! Because I do not like C++. C does not mean to be less modular or non-object oriented. It depends on how you do it. If you really like a C++ implementation of rxvt, check out the rxvt-unicode project. ----- Q: How do I know which mrxvt version I'm using? A: The version number is displayed with the usage (-h). For rxvt version 2.14 and later, the escape sequence `ESC[8n' sets the window title to the version number. ----- Q: Mouse cut/paste suddenly no longer works. A: Make sure that mouse reporting is actually turned off since killing some editors prematurely may leave the mouse in mouse report mode. I've heard that tcsh may use mouse reporting unless it otherwise specified. A quick check is to see if cut/paste works when the Alt or Shift keys are depressed. See doc/refer.txt ----- Q: What's with this bold/blink stuff? I can never get blinking text! A: It is not possible, and likely will never be, for mrxvt to have actual blinking text. Instead (if mrxvt was compiled without NO_BOLDCOLOR), bold/blink attributes are used to set high-intensity foreground or background colors ... like what you'd see on a PC video adapter. There are programs, notably John Davis' SLang-based ones ftp://space.mit.edu/pub/davis, that use bold/blink attributes to permit 16 colors. color0-7 are the low-intensity colors. color8-15 are the corresponding high-intensity colors. A side issue of this bold/blink stuff is the question of how the normal default foreground/background colors are to be treated. If the default foreground/background match one of the low-intensity colors (color0-7), the bold/blink attribute will invoke the appropriate high-intensity color (color8-15). In the case that the default foreground doesn't match one of the low-intensity colors, the bold attribute will use an `overstrike' to simulate a bold font. But note this leaves pixel-droppings and so, rather than wasting an inordinate amounts of energy to fix it, its use is simply deprecated. In the case that the default background doesn't match one of the low-intensity colors, the blink attribute is simply ignored (rather than representing it as bold as xterm does). ----- Q: I don't like the screen colors. How do I change them? A: You can change the screen colors at run-time using ~/.mrxvtrc resources (or as long-options) ... see the man-page. Here are values that are supposed to resemble a VGA screen, including the murky brown that passes for low-intensity yellow: Mrxvt.color0: #000000 Mrxvt.color1: #A80000 Mrxvt.color2: #00A800 Mrxvt.color3: #A8A800 Mrxvt.color4: #0000A8 Mrxvt.color5: #A800A8 Mrxvt.color6: #00A8A8 Mrxvt.color7: #A8A8A8 Mrxvt.color8: #000054 Mrxvt.color9: #FF0054 Mrxvt.color10: #00FF54 Mrxvt.color11: #FFFF54 Mrxvt.color12: #0000FF Mrxvt.color13: #FF00FF Mrxvt.color14: #00FFFF Mrxvt.color15: #FFFFFF ----- Q: What's with the strange Backspace/Delete key behaviour? A: Assuming that the physical Backspace key corresponds to the BackSpace keysym (not likely for Linux ... see the following question) there are two standard values that can be used for Backspace: ^H and ^?. Mrxvt tries to inherit the current stty settings and uses the value of `erase' to guess the value for backspace. If mrxvt wasn't started from a terminal (say, from a menu or by remote shell), then the system value of `erase', which corresponds to CERASE in , will be used (which may not be the same as your stty setting). For starting a new mrxvt: use Backspace = ^H $ stty erase ^H $ mrxvt or $ mrxvt --backspacekey ^H -e bash use Backspace = ^? $ stty erase ^? $ mrxvt $ mrxvt --backspacekey ^? -e bash NB: generate either value with BackSpace and Ctrl/Shift-BackSpace. Toggle with "ESC[36h" / "ESC[36l" as documented in "doc/refer.txt" For an existing mrxvt: use Backspace = ^H $ stty erase ^H $ echo -n "^[[36h" use Backspace = ^? $ stty erase ^? $ echo -n "^[[36l" This helps satisfy some of the Backspace discrepancies that occur, but if you use Backspace = ^?, make sure that the termcap/terminfo value properly reflects that. The Delete key (which one would expect to emit ^?) is a another casualty of the ill-defined Backspace problem. To avoid confusion between the Backspace and Delete keys, the Delete key has been assigned an escape sequence to match the vt100 for Execute (ESC[3~) and is in the supplied termcap/terminfo. Some other Backspace problems: some editors use termcap/terminfo, some editors (vim I'm told) expect Backspace = ^H, GNU Emacs (and Emacs-like editors) use ^H for help. Perhaps someday this will all be resolved in a consistent manner ... and maybe xterm will have Home/End values too! ----- Q: Why doesn't the Backspace key work on my Linux machine? A: The XFree86 server has a notorious problem of mapping the Backspace key as Delete in order to match the Linux console. The correct way to fix this: 0 - Complain to your Linux distributer and the XFree86 team, maybe they'll fix it. 1 - Use xmodmap to correct the Backspace mapping ! ~/.Xmodmap ! a correctly-mapped BackSpace keycode 22 = BackSpace *** Make sure the keycode above matches the physical Backspace key on your machine!! (use xev) *** This will also fix the BackSpace problem with Motif applications, such as ``why doesn't Backspace work for Netscape?'' Finally, you can also remap the mrxvt key-binding at run-time (next question). ----- Q: I don't like the key-bindings. How do I change them? A: You can use the "macro" feature of mrxvt (available from version 0.5.0 onwards). See the man page for details. For instance, if you want the application keypad keys to work like the regular cursor / home / end keys, then you can use something like: Mrxvt.macro.KP_Left: Str \eOD Mrxvt.macro.KP_Right: Str \eOC Mrxvt.macro.KP_Up: Str \eOA Mrxvt.macro.KP_Down: Str \eOB Mrxvt.macro.KP_Prior: Str \e[5~ Mrxvt.macro.KP_Next: Str \e[6~ Mrxvt.macro.KP_Home: Str \e[7~ Mrxvt.macro.KP_End: Str \e[8~ Mrxvt.macro.KP_Insert: Str \e[2~ Mrxvt.macro.KP_Delete: Str \e[3~ You can also use the macro feature to correct the notorious backspace problem, but it is better you fix that by complaining to your Linux vendor :). ----- Q: I'm using keyboard model XXX that has extra Prior/Next/Insert keys. How do I make use of them? For example, the Sun Keyboard type 4 has the following mappings that mrxvt doesn't recognize. KP_Insert == Insert F22 == Print F27 == Home F29 == Prior F33 == End F35 == Next A: Rather than have mrxvt try to accomodate all the various possible keyboard mappings, it is better to use `xmodmap' to remap the keys as required for your particular machine, or the use "macro" feature of mrxvt in your ~/.mrxvtrc. ----- Q: How do I distinguish if I'm running mrxvt or a regular xterm? I need this to decide about setting colors etc. A: mrxvt always exports the variable "COLORTERM", so you can check and see if that is set. It also exports the variable "MRXVT_TABTITLE". Note that several programs, JED, slrn, Midnight Commander automatically check this variable to decide whether or not to use color. ----- Q: How do I set the correct, full IP address for the DISPLAY variable? A: If you've compiled mrxvt with DISPLAY_IS_IP then it is possible to use the following shell script snippets to correctly set the display. If your version of mrxvt wasn't also compiled with ESCZ_ANSWER (as assumed in these snippets) then the COLORTERM variable can be used to distinguish mrxvt from a regular xterm. Courtesy of Chuck Blake with the following shell script snippets: # Bourne/Korn/POSIX family of shells: # assume an xterm if we don't know [ ${TERM:-foo} = foo ] && TERM=xterm if [ ${TERM:-foo} = xterm ]; then # see if enhanced mrxvt or not stty -icanon -echo min 0 time 15 echo -n '^[Z' read term_id stty icanon echo if [ ""${term_id} = '^[[?1;2C' -a ${DISPLAY:-foo} = foo ]; then # query the mrxvt we are in for the DISPLAY string echo -n '^[[7n' # set it in our local shell read DISPLAY fi fi csh/tcsh family of shells: # if term is unset, we are probably in an xterm if ( !(${?TERM}) ) then TERM = xterm endif if ( ${TERM} =~ xterm ) then # see if enhanced mrxvt or not stty -icanon -echo min 0 time 15 echo -n '^[Z' set term_id=$< stty icanon echo if ( ""${term_id} == "^[[?1;2C" && ${?DISPLAY} == 0 ) then # query the mrxvt we're in for the DISPLAY string echo -n '^[[7n' # set it in our local shell setenv DISPLAY "$<" endif endif ----- Q: Can I search the scroll back buffer? A: Yes! (Well sort of). The following two macros (bound to Ctrl+Shift+? and Ctrl+/ respectively) will save your scroll back buffer to a file and open it in less and vim respectively. When opened in less, you can see the same colors as you do on your screen. When opened in Vim, you can edit / cut & paste, but can't see the same colors [unless you write your own syntax file, and use the "conceal" patch by Vince Negri]. Mrxvt.macro.Primary+Ctrl+Shift+question: PrintScreen -ps perl -e '$_=join("",); s/\n+$/\n/g; print' > /tmp/scrollback Mrxvt.macro.Primary+Add+Ctrl+Shift+question: NewTab "(Search)" /bin/sh -c "less -ifLR +G /tmp/scrollback; rm /tmp/scrollback" Mrxvt.macro.Primary+Ctrl+slash: PrintScreen -s perl -e '$_=join("",); s/\n+$/\n/g; print' > /tmp/scrollback Mrxvt.macro.Primary+Add+Ctrl+slash: NewTab "(Search)" /bin/sh -c 'view +"syn off|set nospell notitle |normal G" /tmp/scrollback; rm /tmp/scrollback' NOTE: If you use Vim-6.4, you probably want to remove the "nospell" Vim option. Opening in Vim is especially useful if Vim is compiled with X support. In this case, Vim will synchronize your visual selection to the X clipboard buffer, and you can paste it into other tabs using Ctrl+Shift+v. The perl command just strips the trailing new lines from your buffer. If you want them, replace it with "cat". Remember that once you view the scroll back buffer in less / vim, new output in the original tab will not be visible in less / vim. Also the scroll back buffer is in the file /tmp/scrollback. If you are working on some highly secret government project, and don't want any one else to be able to see your scroll back buffer, umask it correctly, or replace /tmp/scrollback to some private location in your home directory. ----- Q: Where is the CVS repository of mrxvt? A: From mrxvt-0.5.1, we have abandoned CVS, and now exclusively use Subversion. To check out from the subversion repository use svn checkout https://svn.sourceforge.net/svnroot/materm/mrxvt05b ----- Q: I find a bug, or I would like to see a new feature in mrxvt, how to report it? A: You can go to http://sourceforge.net/projects/materm and report the bug using tracker system. Alternately, you can email the mrxvt developer mailing list at materm-devel@lists.sourceforge.net. Please use the SourceForge bug tracker system for feature requests, or MAJOR bugs. Report minor bugs on the materm-devel mailing list. If in doubt, post to the devel mailing list, and you might be asked to file a feature request / bug report in addition. Please describe the bug as clearly as possible, so that we can replicate it. We can not (and WILL not) fix bugs we can not reproduce! Be sure to test if your bug is still present in the current version (from Subversion) of mrxvt. If the bug is still present in the subversion repository, then please report the system you are running mrxvt on, AND steps to reproduce the bug. Again, we can and will NOT fix bugs we can not reproduce. Tell us how to reproduce the bug, or your report will get (silently) ignored! -- vim: set ts=8 tw=80: EOF mrxvt-0.5.4/doc/0000777000175000001440000000000011045531317010446 500000000000000mrxvt-0.5.4/doc/README.greek.bz20000644000175000001440000000514410756127603013045 00000000000000BZh91AY&SYm@0q` v֝խq&B$ᦈi IM'Qj dh OB ! Lh4M2bh2di2@iC&OJ )L=&4hd@h2bh2di2@iC&DAȚb6$4F p9}5I%NG7iIY[t:7U'eTcb8~( )OV8I {.'?GήiXl@'1qy$X L 1m8Bd@$w,GRoRTnjx-h";Zܻ2 : *sXK S7[W/̹핲 VHU63ه%{JDvqHN su?gӚ4"^U#ji^)9#,^S䕍^-gA)Ϭ9kc">Hc3>ϮyO1pfig`TґW2#}K8靧ń@Tfe[-ܜ\IΈ<[hm{-͢QZ5N:=fdi7m(nThšg| O=Ѧ4BoTPبe*x=|(pE/F/SKD}'ME(FRDV\)#;΋\uEZDf Ssׄ2`k} sx>~}%;*Tsw~Dkyq*J-ivy/ E %:}&S 3tt<k|W 跕Z|gA5 ;1j PB}vogm-ssM꠬Lw~hvnliMhIm) `j=BA;V3ie%v@*c1ƃyBcJRdh2r0ڼ/,qc.&6BĠqj#e]1-;УP>.jw^ UĿeadXl>їMܥ@ A_Yz)U r6<<԰۷tk7a]&rM4$E/ܙE&H dR,rHl\yآK3ȈF!Rj&"d4"zT'&'X5F8_#Qk ;'ͼtDeތ+)d6N"%mEQT,йn2,Z2H .p6 k̬>~Fo=(9M 6mR$(AH ;N\Yyq$>Cc 3XHp\[XQIU!L[6M.i0GPx @ggTs:!GiJL`pK6nKY ub2% :0֑GΊΡm_hkepXdr08!66&2&|lJZL1 ajxLZE.N)]_j^`}} om$hc]J(fV==o oOuk˓F)5!4-ty.Ec,`0dŎ|->I^xA2=-=95T9igʝdg>B/{cGk04#XS`E KE93!]B\wY}Va*k]W#wYEغ u51[4 :_6Ϊ4QDˆ7TtT贊Kw 8Ej(TD6ՒVJU(]ώwzְ*:D‰PA载-}$El9zShY, ] N V-%dQ+RR wOM*'Q$h&1:+"NQM p4=> K j4;hmES֡gfgJIwTeRXu8b98!0 T!H1JN"|D3 ؼc׮`uZ(ezGƇ}U\ kp \d +$ bǹʍBx˒҈P#]S$Y1WPRTͱ mrxvt-0.5.4/doc/README.xvt.bz20000644000175000001440000000542610756127603012574 00000000000000BZh91AY&SY59a0l` ?KĀF4US kc3BA14T252)zLAQHhAAz42iFFF@bhɠ D)OQH=Ldhpɦdd&2dbHD 2 MSid=OPFe`, ^t{jaPŐdN #"Ծ[.K?·t<=%}9R+QꂖTV$K]W{ik[oH<@`؂ i4vߏߞl51yhz:-bF" \ѡ䮅Ŝ㢷h꽃8_UJFʥpW >W# ϫ#>w6HY[:ȸ7*y+7SvE$)K&:ЬM[%hO ͣo"wQy-zNfEMٿ^ϒK ͗*>:|AJX..$w5QBkӵ+jU\ػvz+$ʼr>~t'-wx/p5%dvTߘaaR]zQ?(UWY>zkwn݂{\^+la#VWޓК^mD,xl# Y:&zOF;2J5M+:M6LK}6.jNv-C_GNmJ>УWx×wSyJy<8),\B|E?#3G /)I*| Zcmt]=RKը2 AO^m*I2!+r=a]. :T O@|S |SQd<ϱ6M.q+IVͫ%Y+\?/`J27Ra[rD9 R$u(Î;f,3hm:x:i.._[C5E -NsNbBƪW%у5mg OQ@9#Yq=1skoSNhnC}$Ӕ0hwr1?"EܞRڮHM Br!ҡZI]|qst@20BI.T1vrd|qpv$K{jse*fʭ쌅`NvWRΣ{n-)L]sQGSr/ǤhQ&Qn|ŝiIBvNsPn_T ׀fnQz \ $AP u #ݑ؂ua(0q(uiݳigЀ6HD[(p$y0¡(aȖLu8_JͿa hc ȒLPPOQ@Y1 @Xy/h؏ۢ$@=H;-h18W f )vG6])`4m 66!ц,ҏnUÝ@4 bNH%$  醤0;u#F&M%[7cR ^;3K -CcN9X,+;Ld0m'@PT鍡i Ɠ6, /$)V#7Va'W4^ lf9g^ kvcz^3 X&R5GdCή@ kO5ϰA ؜PzE/MႌnKHuk]}o,b7f>>eAT U.(z- t(^/{]x(o.$umK`Qim6/T]Ŏ f=4%l`"\hKe7T5J>e$uDCW-t`H[oeؒ6Q\l>&Ktx3G| 7<3 Zꍎ cc m":9r-t^-MB$hR!YmGbVд:F 8α$6hɍ<2DrTv+ILsRUB3x-y=bP-JnY#[|1z'Nue'4Id! pxCj.Nj6{t@Ѐy'E3`sll.]_ Io]=`A[Ar!V͟ftd BY5wSBQખQ2-ܥc < 0Hm{Ѷxv֋&Aȭ9GVXoEE%VGMLzxcl7V]bj%afyPZ$JJø$z<67;ho"aG<viQl]4C˂>:zNO&?sp1$Zo@VkmY1Mڛ<8z@sS8 %Hu6ʍĸ1h2`!$,}žRz+xߊ[ hO%D d1/N߳ ]k@urFH}3h-4rZ$yȮbA!)` nǫS?p,>z`*c8wIlQEUB)NNM%=g-)iKJZAAA"{vۧVZ풔%2Y3vx+8&:ե\6UBPbn3N^{r`ɦKpUƭ3s0J߯_pl_x.Q^;ÈݺqYa_N#T^^ᤋ`CKhTȱoo6@dheʩs O~{ьkG sE#uSzn9C ZCwڭc-$ F KuO0ݥ })"`TE"U`K˜S>29_VQf*s=Ɛ!N~pu0s"EUmņ]9,m0dUE4薉%0FD$jtDr`ƸJ2ӮJtÕ-&HY@ٴd߱F m{cVqxyB3J=[4Uo)kmƭe^vgaBPVabCկ3e3I~|C@e;TtgtC [1no{^xk2o4u7~RoC QVS |iݲAU8 ̆:5@ =N*8ffDP4֣GD@^W.mojNu1CejcDf׉Ppo=vIlSi%VU^z},=Z kf be4N<)5 :ӎǦT( ?[0vwjE3>/j$M:VWMc xktė3S)ͮC,.1|hۨwi |S:ra{=<;S{:@P9T^qDŽtִR9E@ɤNvU5xt>I O ~8V{jgZl)P|hYۡvP/۠K19.Dٿ>V.n[pZF`շRP}_/{ŷ-U~_ L94"$:THUu6e|'C&vЭdg]  FPԴSM N71`vvi u{^ȅs/nyY-;}m$—ؖbY6Bh'XQ3 _,6ͰaMUanU&I~ܡm4w  H3`)Z906IG"]BF2I 1ӿ)<WZJUnƬ0fsKPX.W3Zp*,gIk{? @_F֦@w'E7"G\8L2  |Ԧh:1^`2<~UO4CП%(E P (GFli}@>а?聰f~_e6Wng@XM 賰?T!}DXn2Ck0d.h^a`ea,4<ȐM`-R|% 0Ά/|_; G^'NwOTYYWh~IߵUUUq/s`X:O4`X9MwXLCntpoH„"ZK%0+pz9~ӧO&Hŋ0 Yqјoҿax/ K)l>4X&7#͑w,"0X<<$nCb ѓ9Tgߕ+Gk6;ԡpHv._+$Y5"+jM( Cf&!ng+cJ-J;OxN a/mzz`фv8W4}߄IH Q0yY1 e45S.F%Y=@ᶀe{,,A:z֣i v{Xʹh瞧@L-R,,JRФPF>`m( X A =9   &%T[V8H{ tA@Mh,B$/|{& Rsr nQd3x{'~4mkֺB/b{wk:%ᚄ#yl$뮏:&$кí(UK 㘀%vs,†VE֞ͩicsk"ćZo{Cьj'%mLX<,Sb,3Mg&ĕ kCn:Pה:s:0 C.M-/f1H1y,A1P\ĭӪm%j06[&vD2DX 1]Pu oR~E҃5牯 m.EnD5 e< ]ÄEo"̩N/=$nB閩|livbneܳ u,s@lZ54+hae!eq2L̄`MfF $Ԅ`6y 1J 0pu>GFM hpVu! kEqHwj6qc{z/upDKi1y%=Ru3hrDƓ6ڊŠQV!`{HuLrӯctMft3lEqx UUS(0!HR6&Ƞxu=P.xa}9=K0̛EdSHk=2Y']AŘ\0 Z=g00Or VriʘsS j.&o6J 6^bߍIe-4[c)BSRfdԗ⎑p>q;MY%Oy:4CE3ReK!qXIfYKPg*+7C@ׯI\f\+؂u6p'{*|f܇7~ͦELKuTK K iH8Aߕ[2iϔٖâC!LMB2`t|w1D dpt"Srܥ2 1pbũd%X4fX܀pKR`6MCMۼ֠wD̗բqhhRT2eR 1&^dNKQZxljlɆ5:+\`&@p~SI*C`s X#H%:sT`A"J:}⌙Ar3LAYMfÒ̪:@tB ԛ4D1M 2!5\M &9}X"fI;Y8f51jZAt4;-`͆;7tC$8&SuuLyDKk 82P; >\ Q[XڏeڈGOC|9; Rv.8ȲdE8~}֚mpz] U2oUO)u+!حWcm+k=cX<:9p^M,V0g2FfeQN* jh YrbRKKCxkHOefI|PY$>#v ZAu Z^#O2( =X){HrY5J;hk=9\"0lmˡLDÀıqIpXP娰kإ+T(1Ø HqpL+a#!&1) 1 I>*+K0;rR CLʙ&( aIbZ-]5h! d YB,aIc OE0x}&)@T#.∪@T`١Z1ק\2CahA d^k x^;ۺHCMw8cDťIpl13@*X[EB/Ak.E$`Qe!ČtEmu-+Z Mo-z}E )н3 YrBZ?16C &%񥧨`BJ2+]tڎf. G$#Pi?ԻC@&iVX(YuQ͡MG%ЭހY2d1ujHymAx@H`]P,hZjAdPh]=(ҵ+4 8f7 mO]%rЄ'B.Z+b- sdDk݂? sπ8("bؾ3ş4ɑDV)„v mrxvt-0.5.4/doc/behind_mrxvt.txt.bz20000644000175000001440000000175010756127603014322 00000000000000BZh91AY&SYs߀@@gRo?P& Z P4 zS~djm 0  H&&MM<3H@Jh%Vhcɦ&B)Ivw UBMleiB{3cQd[\q0qN=+8^ (qaI _cZ9M2;A5 I8 g'-5 @Ib4!3 2 j+)6)dGC( S)R[l_i9# ;`䓠EghHRhPtZ ׭QdaD˺#vp @W l8e6< p-| }] k^NgΖWu)駠Q% E; њ]M Hi$x.I(cLkL6ՙ$3-ahk+T{̕gԃ%)0paAFJK󑍣~8 l*ds:M%g aHYԅ\WZ [h:"Y#s8W}Nphm'$Oj[K\%j.}tVUv) $ɶ pf;%ϴG5\E_D&eW=bV(%JZ' g^X<{PPA)nm9CLPZyN޻:''&̗v]D fRK|{:UĖۅ0ˌ-_9 !:T)iDb*;6AjuzVSoyhK>=ϒGu^K)?n&e/KMïZ ں^{KA0W{P|ZJdh1AZ ^g-e'PLtiٱq&؇cS_b sE>Ҙ<`=0s8G j}ZϠLpF˖h9}9bh G%^ 4Hفs;Wt}@jƄǃ$"x袇msoBҳhhPHQyz~ oМX&J.7)P*4:|ņi&8ǁc`Ǚ]bFARɉ\殔&MoBiY^(UP픘R%F[RD(3v$Iܒ4ٽ%_yP>kY4FEUuJlj:?dpϢ=lg0hQɇᵘQ2wϮ5)p3: x@abg1  քL%*!Q\m~fl˧NGITTC;ځ LaU`me ᮚU%Sh~6Hraޤ``ܱ -1i@rpR.:SV/Y(H;mbyFGOc/zF+ڔ$CzqbLQe~Ѽ^2۸>+^zG=^-kKdN^4htFw˜dh 6Nuo^vKV~{||}u`%s#24 h1= ;㚥i V>Hpo8$z+y2I{'WL,~+9)O]s D#}%FL$!HK{DJh jͫb֝wM"^ f\,H 7Z!B!(^T@ Va?>X>?kY66CP9rnFu~ 8M[6aZ` A;*Oscz@ xI8y! ]4wҎ-\ Qoc\fHlmMLKR %>=RkC3LtpwJ<3pw~-nF O wɥאhK8wn 7L$41)UXR#5-66G|g&WFmc/3t7g#@B4ofkͤ@374\gxÝ6 8wDȋ_j`i&|cbx!ok]VIŭ Ǡ!0)_~VH6EDaZ+{7Q1vdC)HV2pi80WyE>WST8()}UU _Ukae&aC Յ 01bAE# ߅s $1ob/4`nDp1=@]Rp n%0,`u90N]oT%Ys^H:U @!j2H 4I4þёH;mEёwY{d;,ڌ="AW Nſ;WϐȸЂ)e#ҢTb9[B.a Kl2Ddu9w+\5[NmւB˸zs -RH |nKu"eZFh-=%?3ͧiEa5EN~QEdPAq9,L nh#BxU hLdF*$\Ϋe \.ӟ7\F^0a3:4UVT¶cN{@8BKi+tE)DNRk +D[:rjY Vb߳O pñZ({r׷PM TebP]N8#/J--jPռHn b4`R)hT őJ#!)ț@X`,&1gAE3 1?t12eRzJ$8M5 =FU)r'%RzJeUVہ&hԐ̈6OieoYyIjb6gK8L (K$S֐j9Ley(fr2dۓr" nVfX٥*Ai\zOiߵސw[ŁL[tǁ`ω3y{o0kup坃x{c:l4( dA~å4 iʤL#)0(jE0$H$WFFx.fVW cvktT$7{>G"G]f>}^B9t;75hb'jh\pW: `wQAY\9aS2{6e>'KD cґ %Y@Rl쾐?1$BEO'4(K? _VQ lQE /3=%Wy $ؒ( Ur 2=d@k,D/V5W!)4.[]ְvC[jsU^;IKGqMC-_C.L۩UGjb Q^K Ǎ (ֺeZqcsCYٮ઎yECjt7)!aTTow9uFyeDƁhKI| ^Aute\˸6Xh-ȑIw( V (|ueFmUcre++(5]BvbQk'7z\t1(! ޴O .!TTCn>OgcPNna5~5>7p2O2ŊȀagj*e@D:,':W_0J_^Ȕ>sɦ44ȩ߀ˀNV%ۢشœX6"'ajTWtOsb;k5=j_BXq$@<`6D'JD52+SxD8,LCIMKF%v4@$~xQ.oe.uޛ fF2LoU<.?d{O,Lz)#)Tlaԁ8vYUp'Kv(%lXs;F( xy} ^hEۑ SI|Fj񑤊&dignPt Sx2rAE0Ku#j}"*&wl3Qn5}_ľ-ǚs6"RSIN8>~EL%֍kBJUX<2!q1W*.2^H F;g@qЏ9dr.ڣ`E1F6bZ@T5%XC Y|dλ\*ɭ |ẃˑ}zW-%HhTUm3r颱P0r4* bHSt} A<&M Ω?s՛kfb;KUqS3EmSv9D%@mk!.hK\/ ȓ{s=3'pVh$&<ǦN:}? s/r/`u2l'F[4J g I`b0^8 H|[mA3'ŀ}zgи~i&+($c7ʚUAҧ1֠W6/8gk7fRt}U{Șx3n O-k%l.a W>IǹQy^NkqC 0иȔ1i]F5!HUP2a'.L9B5==Cc'^R6abey2Б![ L碦Se{%"XP&Yn$nzLdQA Du;oOqn j/uKc`iF@; 낕:b%4 ]DC*D J)qr*sh%BL41g8%\ P" #*]c"J _ióćXj<3r?\e0CS4y*I* G?ն:/?8}GCYHY!6%4 }<Рr0e%{FV v3=}+1tި2 &LO T_@>/pbiCN eꏴRs9,^u1dP!̝xP{V\A" EG06/r@/סQ?lʉMj% irXH" e F 1L ˷SdĶ`=>Ϭ NP 9cDZb_t2! HK=vA+#+9e,B,81F8/\D27RdCyNbDbD~dEԬETңBXtxy$Ikw|Z3e̔٣D"˜(chm%&.v2U*Zcpd: TԃĠ[nubBl ‹RSMH{H6,-mu9 xCPU ;ot Pڧ&EUuM5EW6xXp݉g=(0!wCy$/qofB?`؃زC/|dе$A S)'C&xI|kzQMi#`6bʋޞBNRON3gC (dɫ@shQh%e;U3k|G.p t\mrxvt-0.5.4/doc/Makefile.am0000644000175000001440000000227210756127603012430 00000000000000# # All portions of code are copyright by their respective author/s. # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. docdir = $(datadir)/doc/$(PACKAGE_NAME) dist_man_MANS = mrxvt.1 dist_doc_DATA = README.greek.bz2 \ README.menu.bz2 \ README.xvt.bz2 \ behind_mrxvt.txt.bz2 \ hack-mrxvt.txt.bz2 \ mrxvt_seq.txt.bz2 \ rxvtRef.txt.bz2 \ xterm-ctlseqs.txt.bz2 mrxvt-0.5.4/doc/Makefile.in0000644000175000001440000003002411012076342012422 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # # All portions of code are copyright by their respective author/s. # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc DIST_COMMON = $(dist_doc_DATA) $(dist_man_MANS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)" NROFF = nroff MANS = $(dist_man_MANS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; dist_docDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_doc_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = $(datadir)/doc/$(PACKAGE_NAME) dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ dist_man_MANS = mrxvt.1 dist_doc_DATA = README.greek.bz2 \ README.menu.bz2 \ README.xvt.bz2 \ behind_mrxvt.txt.bz2 \ hack-mrxvt.txt.bz2 \ mrxvt_seq.txt.bz2 \ rxvtRef.txt.bz2 \ xterm-ctlseqs.txt.bz2 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ done install-dist_docDATA: $(dist_doc_DATA) @$(NORMAL_INSTALL) test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)" @list='$(dist_doc_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \ $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \ done uninstall-dist_docDATA: @$(NORMAL_UNINSTALL) @list='$(dist_doc_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \ rm -f "$(DESTDIR)$(docdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dist_docDATA install-man install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-man1 install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_docDATA uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_docDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man1 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA \ uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mrxvt-0.5.4/doc/mrxvt.10000644000175000001440000016121511035226241011626 00000000000000.\" {{{1 Macros . . .de Vb \" Begin verbatim text (stolen from man files generated by pod2man) . Bd -literal -offset 4n .. .de Ve \" End verbatim text . Ed . Pp .. .\" Boolean options .de BO .It Fl \\$1 Ns | Ns Cm +\\$1 .. .\" Resource list .de RL . It Cm \\$1 . Ar \\$2 .. . . .\" {{{1 manpage header . . .Dd January 10, 2006 .Os X "Version 11" .Dt mrxvt 1 . . .Sh NAME \"{{{1 . . .Nm mrxvt .Nd A tabbed VT102 terminal emulator for X Window System . . .Sh SYNOPSIS \"{{{1 . . .Nm .Op options .Op Fl e Ar cmd . . .Sh DESCRIPTION \"{{{1 . . .Bd -filled The .Nm program is a terminal emulator for X Window System. It provides .Tn DEC VT102 compatible terminals for programs that cannot use the window system directly. .Pp .Nm is based on .Xr rxvt 1 version 2.7.11 CVS, and features most of functionality of rxvt, with a few major enhancements (namely multiple tabs, and transparency). Like rxvt, .Nm aims to be light, fast, flexible and desktop independent, thus KDE or GNOME are not required. .Pp The primary features of .Nm include (but are not limited to) multiple tabs, dynamically changeable tab titles, customizable command for each tab, input broadcasting, true translucent window, fast pseudo transparency with tinting, user supplied background images (XPM, JPEG, PNG), off-focus fading, text shadow, multiple style (NeXT, Rxvt, Xterm, SGI, Plain) scrollbars, XIM, multi-language support (Chinese, Korean, Japanese), freetype font, logging and (in-)activity monitoring. .Pp . The default .Nm behaviour can be set using the resource configuration file .Pa ~/.mrxvtrc . For backward compatibility, if .Pa ~/.mrxvtrc is not found, .Nm tries to load configuration settings from the files .Pa ~/.Xdefaults or .Pa ~/.Xresources . Alternately, you can specify which config file to load using the .Fl cf command line option. .Ed . . .Sh OPTIONS \"{{{1 . . .Bd -filled This section describes the commandline options .Nm accepts. To disable an option, prefix it with an .Sq Em + instead of a .Sq Em - Most options can be set from your .Pa ~/.mrxvtrc file using the option name listed in brackets as .Op Cm option_name . The option name can also be used as a "long option" from the command line (i.e. by prefixing it with .Sq Em -- or .Sq Em ++ as appropriate. For example .Vb mrxvt -tr -shade 85 +trt .Ve is the same as .Vb mrxvt --transparent --shading 85 ++transparentTabbar .Ve which is the same as putting the lines .Vb Mrxvt.transparent: True Mrxvt.shading: 85 Mrxvt.transparentTabbar: False .Ve in your .Pa ~/.mrxvtrc . .Pp . All options are case sensitive. Some options are similar to those of other terminals, so if you find the explanation given here insufficient, we strongly recommend you look in the .Xr rxvt 1 and .Xr xterm 1 manpages. .Ed .\" {{{2 terminal name and display options .Ss Terminal name and display options .Bd -filled .Bl -tag -width 4n . .It Fl display Ns | Ns Fl d Ar displayname X display name, the X server to contact . .It Fl geometry Ns | Ns Fl g Ar geometry geometry at startup .Op Cm geometry . .It Fl ic Ar file Ns Op Ns ; Ns Ar geometry application icon file. .Op appIcon . .BO iconic start iconic .Op Cm iconic . .It Fl in Ar name Icon name for window .Op Cm iconName . .It Fl into Ar WinID If given an X window identifier, .Nm will reparent its top-level shell widget to that window. This is used to embed .Nm within other applications. . .It Fl name Ar name Client instance, icon, and title strings .Op Cm clientName . . .It Fl title Ar string title name of the window .Op Cm title . .It Fl tn Ar termname The type of terminal .Nm should emulate. The value of the TERM environment variable is set to this value for all child processes launched by .Nm . Note that rxvt and most rxvt clones including .Nm Ns , have slightly different terminal capabilities than those of xterm(1). Thus .Nm will not always work properly with the terminal set to .Ar xterm , and we recommend setting this value to .Ar rxvt instead. However some systems have incorrect (or even missing) terminfo(1) or termcap(1) entries for the terminal .Ar rxvt . If you experience problems with this, the ideal solution would be to correct your systems termcap and terminfo entries. If you are unable to do that, then you can try setting your terminal to .Ar xterm and hope everything works properly. .Op Cm termName . .El .Ed .\" {{{2 transparency .Ss Transparency related options .Bd -filled .Bl -tag -width 4n . .It Fl o Ar %d Translucent window (true transparent) background opacity degree. .Ar %d is an integer between 0 and 100. This option needs translucent support by the X server, e.g., Xorg 6.8, and overrides the pseudo-transparency. .Op Cm opacity . .It Fl od %d Translucent window opacity degree increase/decrease interval. .Ar %d is an integer between 0 and 100 .Op Cm opacityDegree . .BO tr Enable / disable background pseudo-transparency. To use this feature you must set your desktop wallpaper using an Esetroot compatible program ( i.e. a program that publishes the wallpaper using the .Tn _XROOTPMAP_ID atom). Some programs that will do this are .Xr Esetroot 1 , .Xr feh 1 , .Xr fvwm-root 1 with the .Sq Cm --retain-pixmap option, or KDE. Note: To use your precious .Cm backgroundFade , tinting or .Cm shading options, you MUST set the desktop wallpaper in an Esetroot way. .Op Cm transparent . .BO trf If you choose NOT to set the background in an Esetroot compatible way, then you can still have transparency using this option. (You must also enable the .Cm transparent option). Background changes made by FvwmBacker, xsetbg (xli) or Esetroot compatible programs, will be automatically detected. However changes made by .Xr xv 1 , .Xr xsetroot 1 or other non-Esetroot compatible programs will not be detected. If you're hell bent on non-Esetroot compatible programs to set your background, then do something like .Vb xsetroot -solid "#202040" && fvwm-root -d .Ve Note: To use your precious .Cm backgroundFade , tinting or .Cm shading options, you MUST set the desktop wallpaper in an Esetroot way. .Op Cm transparentForce . .BO trm Enable / disable pseudo-transparent menubar. Pseudo-transparency must be turned on. .Op Cm transparentMenubar . .BO trs Enable / disable pseudo-transparent scrollbar. Pseudo-transparency must be turned on. .Op Cm transparentScrollbar . .BO trt Enable / disable pseudo-transparent tabbar. Pseudo-transparency must be turned on. .Op Cm transparentTabbar . .El .Ed .\" {{{2 background .Ss Background image related options .Bd -filled .Bl -tag -width 4n . .It Fl mbpixmap Ar file Ns Op Ns ; Ns Ar geometry Menubar background image. Pseudo-transparency must be turned off. .Op Cm menubarPixmap . .It Fl pixmap Ar file Ns Op Ns ; Ns Ar geometry Background image for all terminals if not set individually. Pseudo-transparency must be turned off. .Op Cm Pixmap . .It Fl sbpixmap Ar file Ns Op Ns ; Ns Ar geometry Scrollbar background image. Pseudo transparency must be turned off. .Op Cm scrollbarPixmap . .It Fl tbpixmap Ar file Ns Op Ns ; Ns Ar geometry Tabbar background image. Pseudo transparency must be turned off. .Op Cm tabbarPixmap . .BO tupixmap Apply tabbar background image to tabs. .Op Cm tabUsePixmap . .El .Ed .\" {{{2 scrolling .Ss Scrolling related options .Bd -filled .Bl -tag -width 4n . .BO mp scroll one page when press mouse wheel button .Op Cm mouseWheelScrollPage . .It Fl sa Ar mode Scrollbar alignment ( .Ar top | bottom ) .Op Cm scrollbarAlign . .BO sb Hide / show scrollbar .Op Cm scrollBar . .It Fl sbt Ar width Scrollbar thickness/width .Op Cm scrollbarThickness . .BO si Inhibit scrolling on tty output. .Op Cm scrollTtyOutputInhibit . .BO sk scroll-on-keypress .Op Cm scrollTtyKeypress . .It Fl sl Ar n The number of scrolled lines to save (for all tabs) if not set individually. The maximal number of saved lines is 65535. .Op Cm saveLines . .BO sr Scrollbar on right .Op Cm scrollbarRight . .It Fl ss Ar mode Scrollbar style. .Ar mode should be one of .Ar plain , xterm , rxvt , next or .Ar sgi . .Op Cm scrollbarStyle . .BO st Draw floating scrollbar (i.e. without a trough). .Op Cm scrollbarFloating . .El .Ed .\" {{{2 color .Ss Color related options .Bd -filled .Bl -tag -width 4n . .It Fl bg Ar color Background color .Op Cm background . .It Fl bd Ar color Border color .Op Cm borderColor . .It Fl bgfade Ar %d (Obsolete) Make colors .Ar %d darker for background image or pseudo-transparent background. .Ar %d is an integer between 0 and 100. This is like tinting the background with black. This option is obsolete, and you should use the .Cm tint and .Cm shade options instead. .Op Cm backgroundFade . .It Fl bgtype Ar type Transformation type for background pixmap (not implemented yet) . .It Fl cr Ar color color of cursor .Op Cm cursorColor . .It Fl fade Ar %d Make colors .Ar %d darker when mrxvt looses focus. .Ar %d is an integer between 0 and 100 .Op Cm fading . .It Fl fg Ar color Foreground color. .Op Cm foreground . .It Fl itabbg Ar color Background color of inactive tabs and tabbar. .Op Cm itabBackground . .It Fl itabfg Ar color Foreground color of inactive tabs. .Op Cm itabForeground . .It Fl pr Ar color color of pointer .Op Cm pointerColor . .It Fl shade Ar %d Shade background to .Ar %d degree when tinting the background. .Ar %d is an integer between 0 and 100. You must also define a color using the .Cm tint option. When compiled with XRender support, the tabbar, menubar and scroll bar are tinted with their respective background colors for pseudo-transparent terminals. .Op Cm shading . .It Fl tabbg Ar color background color of active tab. .Op Cm tabBackground . .It Fl tabfg Ar color Foreground color of tabbar .Op Cm tabForeground . .It Fl tint Ar color Color tinted on background image or pseudo-transparent background. This works differently depending on the tint type: With XRender (when compiled with --enable-xrender), .Ar color is the color you want to tint your background to. The brighter the color, the less transparent it will be (regardless of the shade degree specified by .Fl shade ) . For example, if you want your background tinted black, set .Ar color to .Sq #000000 , however if you want a white tinted transparent background, set .Ar color to some level of grey (e.g. .Sq #808080 ) but NOT to .Sq #ffffff . .Pp When compiled without XRender support, .Ar color works like a color mask. Thus if you want a black tinted background, set .Ar color to .Sq #ffffff . .Pp The shade degree (using .Fl shade ) must be defined as well. .Op Cm tintColor . .It Fl tinttype Ar type Function applied for background tinting (not implemented yet). . .It Fl ts Ar color color of text shadow .Op Cm textShadow . .It Fl tsm Ar mode Text shadow mode, specify shadow position of text: .Ar left | right | top | bottom | topleft | topright | botleft | botright | none . .Op Cm textShadowMode . .It Fl txttype type Function applied for text drawing (not implemented yet) . .It Fl ufbg Ar color Default background color when the terminal window looses focus. .Op Cm ufBackground . .El .Ed .\" {{{2 font .Ss Font related options .Bd -filled .Bl -tag -width 4n . .It Fl fb Ar fontname bold text X11 font name .Op Cm boldFont . .It Fl fm Ar fontname multichar text X11 font name .Op Cm mfont . .It Fl fn Ar fontname normal text X11 font name .Op Cm font . .BO xft Use freetype font instead of X11 font. This option controls all other freetype font related options. .Op Cm xft . .BO xftaa Enable / disable antialiasing of freetype font. This makes font look much nicer, but significantly slows down the rendering speed. The .Fl xft option must be enabled. .Op Cm xftAntialias . .BO xftah Enable / disable autohint of freetype font. The .Fl xft option must be enabled .Op Cm xftAutoHint . .It Fl xftfm Ar fontname Multichar text freetype font family. The .Fl xft option must be enabled .Op Cm xftmFont . .It Fl xftfn Ar fontname Normal text freetype font family. The .Fl xft option must be enabled .Op Cm xftFont . .BO xftga Enable / disable global advance of freetype font. The .Fl xft option must be enabled .Op Cm xftGlobalAdvance . .BO xftht Enable / disable hinting of freetype font. The .Fl xft option must be enabled .Op Cm xftHinting . .It Fl xftmsz Ar size Freetype multichar font size in pixels. The .Fl xft option must be enabled. .Op Cm xftmSize . .BO xftnfm Do not load freetype mfont, but use freetype font instead. This can avoid a large line space if the size of font and mfont are very different. The .Fl xft option must be enabled .Op Cm xftNomFont . .It Fl xftpfn Ar font Specify a proportionally spaced font to use for drawing tab-titles. If set, the tab bar behaves like Firefox's tab-bar: All tabs have the same width, and the widths are shrunk / expanded to keep the number of tabs specified by .Cm minVisibleTabs visible. The active tab title is drawn in a bold font. (Your colors are still used). .Op Cm xftPFont . .It Fl xftrgb Ar style Freetype font sub-pixel order: .Ar rgb | bgr | vrgb | vbgr | none . The .Fl xft option must be enabled. .Op Cm xftRGBA . .BO xftslow Display freetype multichar string in slow mode for better display effect. The xft option must be enabled. .Op Cm xftSlowOutput . .It Fl xftst Ar style Freetype font slant: .Ar roman | italic | oblique . The .Fl xft option must be enabled. .Op Cm xftSlant . .It Fl xftsz Ar number Freetype font size in pixel. The .Fl xft option must be enabled .Op Cm xftSize . .It Fl xftbwt Ar style Freetype bold font weight: .Ar light | medium | demibold | bold | black . The .Fl xft option must be enabled. .Op Cm xftBoldWeight . .It Fl xftwd Ar style Freetype font width: .Ar ultracondensed | condensed | normal | expanded | ultraexpanded . The .Fl xft option must be enabled. .Op Cm xftWidth . .It Fl xftwt Ar style Freetype font weight: .Ar light | medium | demibold | bold | black . The .Fl xft option must be enabled. .Op Cm xftWeight . .El .Ed .\" {{{2 tabs and commands .Ss Tabs and command related options .Bd -filled .Bl -tag -width 4n . .It Fl aht Automatically hide or show the tab bar depending on the number of tabs. On startup, the tabbar is shown only if there are more than one tabs present. If there is only one tab, and a new one is created, then the tabbar is shown. If there are two tabs and one is closed, then the tabbar is hidden. A keyboard shortcut used at any time to hide / show the tabbar. .Op Cm autohideTabbar .BO at Run command specified with .Fl e on all tabs (by default the command specified by .Fl e is only used for the first tab opened). This causes the profile option .Cm command to be ignored. However a command specified via the .Cm NewTab macro is honored. .Op Cm cmdAllTabs . .BO bt Show tabbar at bottom. .Op Cm bottomTabbar . .It Fl e Op Ar arguments ... Specifies the program (and its command line arguments) to be run in the .Nm window. By default this command is only run initially, and all tabs created after startup will run the default shell (or program supplied by .Fl profile Ns Ar %d Ns ). This behaviour can be overridden with the .Fl at option. .Op Cm command . .BO hb Hide buttons in the tabbar. .Op Cm hideButtons . .It Fl het Ar string Message to display in tabs after the child process exits. (This string is escape and percent interpolated). .Op Cm holdExitText . .It Fl heT Ar string Set the title of tabs to .Ar string after the process in the tab exits. (This string is escape and percent interpolated). .Op Cm holdExitTitle . .It Fl hold Ar mask Hold the tab open after the child process in it exits. .Ar mask is the mask of flags which control weather the tab will be held open based on the exit status of the child process. If the lowest bit (0x01) of .Ar mask is set, then the tab will always be held open after the child exits. If the next bit (0x02) is set, then the tab will only be held open if the child exits abnormally (e.g. via .Xr abort 1 ) . If the third bit (0x04) is set, then the tab will be held open if the child exits with non-zero status. .Pp NOTE: In previous versions of .Nm this was a boolean option. For backward compatibility, the value of .Ar True , On, Yes will be treated as .Ar 1 and anything illegal will be treated as .Ar 0 . The default is 0x06. .Op Cm holdExit . .BO ht Hide tabbar on initialization .Op Cm hideTabbar . .BO htb Highlight inactive tabs only when bell sounds. Default is to highlight inactive tabs whenever they produce output. .Op Cm highlightTabOnBell . .It Fl ip Ar profiles .Ar profiles is a comma separated list of profiles numbers. On startup .Nm opens each of these profiles in a tab. .Op Cm initProfileList . .BO ls Indicates that the shell that is started in the .Nm window will be a login shell (i.e., the first character of argv[0] will be a dash, indicating to the shell that it should read the user's .Pa .login or .Pa .profile). .Op Cm loginShell . .It Fl mtw Ar width The maximum width (in characters) of the displayed tabs. This can not be larger than 40. If you use Xft, then you might want to use the .Cm minVisibleTabs option instead. .Op Cm maxTabWidth . .It Fl mvt Ar n When using .Cm xftPFont to display tabs, keep at least .Ar n tabs visible. .Op Cm minVisibleTabs . .It Fl profile Ns Ar N Ns Cm . Ns Ar option Ar value Set .Ar option to .Ar value in profile .Ar N . When a new tab is created with profile .Ar N it uses all options that are set for this profile. Currently the only options that can be set per profile are .Cm Pixmap , background , command , foreground , saveLines , holdExit , holdExitText , holdExitTitle , tabTitle , titleFormat , winTitleFormat and .Cm workingDirectory . Then all the settings from that profile number are used. .Pp . .Ar N can be any integer between 0 and the compiled in maximum (default 5). The profile number 0 is special, and contains default settings which are used for all profiles where this option is not set (e.g. .Fl profile0.tt Ar mrxvt sets the tab title to .Ar mrxvt for all profiles where the tab title has not been set). In this case the .Fl profile0. can be omitted entirely (i.e. .Fl profile0.tt is equivalent to .Fl tt ) . .Pp This option is intended to replace the .Fl vt Ns Ar %d Ns Cm .xx options from .Nm version 0.5.0. The old .Fl vt Ns Ar %d Ns Cm .xx would set options for the .Ar %d Ns th tab. This causes inconsistent behaviour when the user moves / closes tabs. The behaviour of the .Fl profile option is to set options for a particular profile, and then these settings can be associated (on demand) to newly created tabs. . .Op Cm profile Ns Ar N Ns Cm . Ns Ar option . .BO ps Protect tab from being closed if it is using the secondary screen, for example, when the user is running .Xr vim 1 or .Xr mutt 1 , this can prevent the terminal from being accidentally closed. .Op Cm protectSecondary . .BO sti Synchronize icon name with tab title when switch to a new tab or the title of the active tab changes. .Op Cm syncTabIcon . .BO stt Synchronize terminal title with tab title when switch to a new tab or the title of the active tab changes. (See also the .Fl wtf option). .Op Cm syncTabTitle . .It Fl tnum Ar N OBSOLETE. Opens .Ar N tabs on startup. For backward compatibility, the tabs are opened with profile 0, 1, ... .Ar N Ns -1 . .Op Cm initTermNumber . .It Fl tt Ar string Title of the tab .Op Cm tabTitle . .It Fl tf Ar format If set, this controls the displayed title of each tab. .Ar format is % interpolated, and the result is displayed as the tab title. .Pp .Sy NOTE: Currently this option requires the tab titles to be drawn with a proportionally spaced font (which is currently only possible with Xft). Also, this option only affects the displayed tab title, and thus .Ar %t will still expand to the actual tab title, as set via an escape sequence, or macro. For example, setting this option to .Sq Ar %n. %t will cause all the tabs to be numbered. .Op Cm titleFormat . .BO ut Utmp inhibit. .Op Cm utmpInhibit . .BO vbf If unset, colored bold text will not be rendered using overstrike / bold font. See also .Cm boldColors and .Cm veryBright . .Op Cm veryBoldFont . .It Fl wd Working directory of the child process. If non-empty, then the child process is started in this directory. If set to .Sq \&. then the child process is run in the working directory of the current tab if possible. On Linux, this is the default. (NOTE: It is not always possible to find the working directory of the current tab. This works fine on Linux, but causes problems on other systems [e.g. OpenBSD], which is why it is only enabled by default on Linux). .Op Cm workingDirectory . .It Fl wtf Ar format Controls the format of the window title. If set, and the option .Fl stt is used, then the window title is set to .Ar format (after % interpolation), instead of the tab title. .Op Cm winTitleFormat .El .Ed .\" {{{2 multichar stuff .Ss Multichar and multi-language support .Bd -filled .Bl -tag -width 4n . .BO mcc Multichar cursor movement .Op Cm multibyte_cursor . .It Fl km Ar mode multichar encoding mode .Op Cm multichar_encoding . .It Fl im Ar name name of X Input Method (XIM) .Op Cm inputMethod . .It Fl pt Ar mode XIM input style: .Ar OverTheSpot Ns | Ns Ar OffTheSpot Ns | Ns Ar Root .Op Cm preeditType . .BO thai Thai support .Op Cm thai . .It Fl grk Ar mode Greek keyboard mapping: .Ar iso Ns | Ns Ar ibm .Op Cm greek_keyboard . .El .Ed .\" {{{2 menu .Ss Menu related options .Bd -filled . .Bl -tag -width 4n . .It Fl menu Ar filename Ns Op ; Ns Ar tag Menubar definition file. .Op Cm menu . .BO showmenu show menubar .Op Cm showMenu . .El .Ed .\" {{{2 keyboard / window .Ss Keyboard and window related options .Bd -filled .Bl -tag -width 4n . .It Fl b Ar number internal border width .Op Cm internalBorder . .BO bc Display a blinking cursor. .Op Cm cursorBlink . .BO bcst Enable / disable broadcasting input to all terminals .Op Cm broadcast . .It Fl bci Ar number Cursor blink interval (ms) .Op Cm cursorBlinkInterval . .BO bl Use a borderless window. .Op Cm borderLess . .It Fl blc Ar cmd Bell command instead of beeping. If .Ar cmd begins with .Sq \&! then it is passed to .Cd /bin/sh -c for execution. Otherwise it is split into words at spaces or tabs only, and executed via .Xr execvp 3 . If you don't want a space or tab to cause word splitting, then precede it with a .Sq Sy \e . If you want to pass .Sq \e\ as an argument, double the .Sq \e . .Pp Note: Only backslashes (or chains of backslashes) that precede a space or tab character are treated specially. That is .Sq \e\ea will be left untouched, however .Sq \e\e\ will expand to a .Sq \e and the .Sq \ will cause a word break, and .Sq \e\ will expand to a .Sq \ which does not cause a word break. .Op Cm bellCommand . .It Fl bw Ns | Ns Fl w Ar number external border width .Op Cm externalBorder . .BO ctvb Use a visual bell only for the current tab (i.e. the active tab of a currently focused window). .Op Cm currentTabVBell . .It Fl desktop Ar number Desktop to place the window (for gnome compatible window manager). The number starts from 0, NOT 1! .Op Cm desktop . .BO dm Enable / disable all keyboard macros. This functionality can be toggled at runtime via a pop-up menu, or the .Ic ToggleMacros keyboard shortcut. NOTE: When keyboard macros are disabled, the .Ic ToggleMacros keyboard macro will still work. Thus you can re-enable your keyboard macros via the keyboard using this function. .Op Cm disableMacros . .BO fs Startup fullscreen. Use in conjunction with .Op smoothResize to really make it full screen. Requires an EWMH compatible window manager. .Op Cm fullscreen . .BO lk Enable Linux console style Home/End keys .Op Cm linuxHomeEndKey .It Fl mod Ar mode Meta modifier: .Ar alt Ns | Ns Ar meta Ns | Ns Ar hyper Ns | Ns Ar super Ns | Ns Ar mod1 Ns | Ns Ar ... Ns | Ns Ar mod5 . .Op Cm modifier . .It Fl lsp Ar number Line space between rows .Op Cm lineSpace . .BO m Start maximized (requires an EWMH compatible window manager). .Op Cm maximized . .BO m8 Enable / disable meta8 .Op Cm meta8 . .BO nsc Enable / disable reading the system wide configuration file. Only the default keyboard macros are defined in this file, so this option can effectively disable all default keyboard shortcuts. .Op Cm noSysConfig . .BO or Override redirect .Op Cm overrideRedirect . .BO pb .No Pointer blank (see also Cm pointerBlankDelay ) . .Op Cm pointerBlank . .BO rv reverse video .Op Cm reverseVideo . .BO tcw Triple click word selection .Op Cm tripleclickwords . .BO vb Visual bell .Op Cm visualBell . .El .Ed .\" {{{2 misc .Ss Miscellaneous options .Bd -filled .Bl -tag -width 4n . .It Fl C Intercept console messages . .It Fl dmask Ar namelist Print out debug message defined by a coma separated name list. Available names include: command, screen, ptytty, init, main, logging, macros, menubar, tabbar, scrollbar, images, pixmap, transparent, encoding, gkrelot, memory, session, string, resource, xftacs, misc, and all. . .It Fl dlevel Ar verboselevel Print out debug message defined by verboselevel. Available verboselevel are: fatal, error, warn, info, verbose, and debug. The latter, the more information is printed . .It Fl cf Ar filename X resource configuration file .It Fl cfs Ar filename X resource configuration file to save the current configuration .Op Cm confFileSave . .It Fl path Ar path Colon delimited list of directories to search for background images and menu files. .Nm first searches for the file in the current directory, then in the directories specified by .Ar path , then in the directories specified by the environment variable .Ev PATH_ENV and finally tries in the user configuration directory .Pa ~/.mrxvt and the (compiled in) system wide configuration directory .Pa /etc/mrxvt . .Op Cm path . .It Fl sid Ar string Client identity of mrxvt for X session management .Op Cm smClientID . .BO sm enable X session management .Op Cm sessionMgt . .El .Ed .\" {{{2 resource option list .Ss Long options .Bd -filled . The following options do not have a .Dq short form. If these options are to be used on the command line, they must be prefixed with a .Sq Em -- (or .Sq Em ++ for boolean options). They can of course be used in the .Nm configuration file. . . .Bl -tag -width 4n .It Cm answerBackString Ar string Specify the reply .Nm sends to the shell when an ENQ (control-E) character is passed through. It may contain escape values as described in the entry on .Cm keysym following. . .It Cm backspaceKey Ar string The string to send when the backspace key is pressed. If set to DEC or unset it will send Delete (code 127) or, if shifted, Backspace (code 8) - which can be reversed with the appropriate DEC private mode escape sequence. . .It Cm bgRefreshInterval Ar delay Specify the delay (ms) to wait before refreshing the background in pseudo-transparency. Generally tinting and refreshing the background is slow (especially with XRender), and causes lags while dragging the window. This delay causes enables the window to be dragged smoothly. If you have a fast system, you can reduce or disable this (by setting it to 0). The default value is 100ms. . .It Cm boldFont Ns Ar N Ar font Specifies bold font to use along with fontset .Ar N . . .It Cm boldColors Ar True Ns | Ns Ar False If false, the bold primary colors (0 -- 7) will be rendered using the brighter analogues (8--15) in a regular font. If true a bold font will be used. See also .Cm veryBright . . .It Cm color Ns Ar N Ar color Use the specified colour for the colour value .Ar N , where 0-7 corresponds to low-intensity (normal) colours and 8-15 corresponds to high-intensity colours. .It Cm colorBD Ar color Color to use to display bold text. If unspecified, the text will be displayed using a bold font / overstrike. . .It Cm colorRV Ar color Color to use to display reverse video text. If unspecified, the text will be displayed as reverse video. . .It Cm colorUL Ar color Color to use to display underlined text. If unspecified, the text will be displayed as underlined. . .It Cm cursorColor2 Ar color Second color of cursor. . .It Cm cutChars Ar string String containing all characters to be treated as one word for double click selection. If you want double clicks to select URL's, then set this to a string containing all letters (both upper and lower case), digits and punctuation you find in urls. . .It Cm deleteKey Ar string The string to send when the delete key (not the keypad delete key) is pressed. If unset it will send the sequence traditionally associated with the .Sy Execute key. . .It Cm focusDelay Ar msec The time interval (in mili-seconds) to wait after getting / losing focus, before fading the colors and changing the background color as specified by the .Fl fade and .Fl ufbg options. Set it to 0 if you want your colors faded immediately on focus change events. .Pp This option is there mainly to work around a bug in some window managers which send focus in immediately followed by focus out events when moving windows, or pressing Alt+Tab (e.g. fvwm-2.5.16). . .It Cm font Ns Ar N Ar font Specify the alternative font .Ar n . n No can be 1, 2, 3, 4 or 5. . .It Cm greektoggle_key Ar keysym Key to toggle into greek keyboard mapping. See .Pa README.greek for details. . .It Cm highlightColor Ar color Color to use for selection. If not specified, reverse video is used. (Note blinking text is also displayed with this color). . .It Cm mapAlert Ar True Ns | Ns Ar False If true, de-iconifies the window when a bell is received. . .It Cm mfont Ns Ar n font Specify alternative multiple character font .Ar n . . .It Cm pointerBlankDelay Ar delay Delay (ms) to blank pointer after. . .It Cm printPipe Ar cmd Specify a command pipe for vt100 printer. . .It Cm refreshLimit Ar N This option and .Cm skipPages are to be used to replace the .Sq jump scroll behaviour of other terminal emulators (and previous version of .Nm ) . Generally when data is available from a tab, .Nm reads as much of it as is available (up to our buffer size), and process it. After we are done processing it (generally takes a fraction of a mili-second), we look for more data from the tab. If we obtain not more than .Ar N characters, then we request a screen refresh (which takes a while, especially if you use Xft with anti aliasing). If we obtain more than .Ar N characters from the tab, then we delay the screen refresh until the tab eventually has either .Ar N or fewer characters of output, or the tab has (cumulatively) produced at least .Cm skipPages of data. .Pp The default value is 0. On new fast machines, this is probably the best. If you find screen refreshes laggy on on slow older machines, then increase this value a little (say to 10). Setting it to something enormous (say BUFSIZ) will cause .Nm to request screen refreshes every time the active tab has data, and effectively disable the so called .Sq jump scrolling . . .It Cm scrollColor Ar color Color of scrollbar (see also .Cm troughColor ) . . .It Cm selectStyle Ar mode Set mouse selection style to .Cm old which is 2.20, .Cm oldword which is xterm style with 2.20 old word selection, or anything else which gives xterm style selection. . .It Cm skipPages Ar N This option and .Cm refreshLimit are to be used to replace the .Sq jump scroll behaviour of other terminal emulators (and previous version of .Nm ) . If the screen refresh is delayed because of the .Cm refreshLimit option, then .Nm will refresh the screen every .Ar N pages of output. The default is 25. If you set it to a very large value (say INT_MAX), then .Nm will refresh the screen only after the tab has stopped .Sq flat out scrolling. . .It Cm smartResize Ar True Ns | Ns Ar False Enable / disable smart resize. When the tabbar is shown, or font size is increased, the resize terminal window could be partially off screen. If .Cm smartResize No is enabled, then Nm No tries to move the terminal window to stay on screen. . .It Cm smoothResize Ar True Ns | Ns Ar False .No Enable / disable smooth resize. If enabled, then the Nm No window is resized in pixel increments (instead of character increments). This is useful if you want a full screen / maximized Nm No window that covers the entire screen (without leaving an annoying few pixel wide strip uncovered). . .It Cm troughColor Color of scrollbar trough (see also .Cm scrollColor ) . . .It Cm useFifo Ar True Ns | Ns Ar False If enabled, then mrxvt will create a .Xr fifo 7 Pa /tmp/.mrxvt-%pid and listen for macros on it. To execute macros, just write them to this fifo. For example .Vb /bin/echo -e "NewTab\enRaise" >> /tmp/.mrxvt-%pid .Ve creates a new tab and raises the .Nm window with process ID .Em %pid . .Sy NOTE: The meaning and syntax of this option might change in future versions. . .It Cm vBellDuration Ar ms Amount of time (in milliseconds) to flash the screen if using a visual bell. . .It Cm monitorTimeout Ar ms Amount of time (in milliseconds) to detect the type of monitoring type or tab-inactivity. Default value is 2000 ms this causes that mrxvt is waiting 2 seconds after invoking the .Ic MonitorTab macro with argument "AUTO" or "INACTIVITY" to determine if or what type a notification is needed. The detection of "ACTIVITY" does not make use of the configuration value. . .It Cm monitorCommand Ar command Specifies a command which will be executed if a activity or inactivity event is raised by the .Ic MonitorTab macro. (This string is escape and percent interpolated) . .It Cm veryBright Ar True Ns | Ns Ar False If true, and if .Cm boldColors is false, then bold primary colors are rendered as bright colors with a bold font (this was the default behaviour in 0.5.2 and earlier versions). . .El .Ed .\"}}} . . .Sh CONFIGURATION FILE SYNTAX \"{{{1 .Bd -filled . . A line in the config file generally looks like this .Vb ClassName.OptionName: Value .Ve Blank lines, and lines beginning with .Sq Em # are ignored (comments). .Pp . The ClassName is the name specified via the .Fl name option (by default .Sq Em mrxvt ) . When .Nm starts up, it ONLY reads options with ClassName .Sq Em Mrxvt , .Sq Em XTerm , or the class specified via the .Fl name option. See .Pa /etc/mrxvt/mrxvtrc.sample for how this feature can be used. .Pp . The OptionName is the long name of the option you want to set. It can be any long option (listed under the .Sx "Long Options" sub section), or is specified in brackets as .Op Cm option_name alongside regular options in this man page. Finally Value is the value of this option. .Pp .Ed .\" {{{2 Example .Ss Example .Bd -filled The following is an example .Pa ~/.mrxvtrc file, or in a configuration file you will load with .Fl cf option at startup. You can consult the .Pa doc/mrxvtrc.sample in the directory for more details. .Vb Mrxvt.profile0.tabTitle: term1 Mrxvt.profile1.tabTitle: term2 Mrxvt.profile2.tabTitle: term3 Mrxvt.profile0.saveLines: 600 Mrxvt.profile1.saveLines: 600 Mrxvt.profile2.saveLines: 600 # Mrxvt.profile0.Pixmap: /home/images/vt0bg.xpm # Mrxvt.profile1.Pixmap: /home/images/vt1bg.xpm # Mrxvt.profile2.Pixmap: /home/images/vt2bg.xpm Mrxvt.scrollbarStyle: next Mrxvt.initTermNumber: 3 Mrxvt.transparent: True Mrxvt.transparentScrollbar: True Mrxvt.transparentTabbar: False Mrxvt.transparentMenubar: False Mrxvt.tintColor: #ffffff Mrxvt.shading: 85 Mrxvt.foreground: white Mrxvt.background: black .Ve .Ed .\"}}} . . .Sh MENUS \"{{{1 . . .Bd -filled The menu system is similar to rxvt's menus (see the included file .Pa rxvtRef.txt ) with a few enhancements, and a few notable exceptions: .Bl -dash -width 2 .It The menus can use a proportionally spaced font under Xft ( .Fl xftpfn ) which is significantly less ugly than a mono-spaced font. .It .Nm supports pop-up menus. If you create a menu named .Ic PopupButton Ns Ar N No (where Ar N No is 1, 2, or 3) then that menu is popped up when you control click (with the appropriate mouse button) on the terminal window. Additionally if you right click on the Tab bar, then the menu Ic PopupButton1 No is popped up. .It To create a menu containing a list of all open tabs, create an empty menu called .Ic PopupButton Ns Ar N (which will be popped on control click's as described above). To include a list of all open tabs as a sub menu, create a sub-menu called .Sq Switch to tab . .It Menu actions are completely different in .Nm than the original implementation in .Xr rxvt 1 . The menu actions are exactly the same as macro actions, and are described in the section .Sx "Defining custom shortcuts" . .It On startup .Nm reads the file .Pa default.menu which contains the default menu definitions. The file is searched for in your search path (specified by option .Fl path ) . .El .Ed . . .Sh KEYBOARD AND MOUSE SHORTCUTS \"{{{1 . . .Bd -filled You have several default keyboard shortcuts to ease the use of mrxvt. The default gnome-terminal, Konsole, rxvt shortcuts are predefined for you. You can also define your own shortcuts as described in .Sx "Defining custom shortcuts" . .Ed .Ss "Default keyboard shortcuts" \"{{{2 .Bd -filled The following key combinations are defined by default. These are defined in the system configuration file .Pa /etc/mrxvt/mrxvtrc , and can be disabled using the option .Fl nsc . See the next section for instructions on defining your own custom keyboard shortcuts. .Pp .Em Gnome-terminal style shortcuts: .Bl -tag -width 18n -compact -offset 4n .It Ctrl+Shift+t create a new tab .It Ctrl+Shift+q Close all tabs and exit .It Ctrl+Shift+w Close active tab, and do not hold it open if it exits abnormally. .It Ctrl+PgUp activate left tab .It Ctrl+PgDn activate right tab .It Meta+1 activate 1st tab .It ... .It Meta+0 activate 10th tab .It Ctrl+equal increase font size (next font) .It Ctrl+Shift+plus increase font size by 2 .It Ctrl+minus decrease font size (previous font) .It Ctrl+Shift+underscore decrease font size by 2 .El .Pp . .Em Konsole style default shortcuts: . .Bl -tag -width 18n -compact -offset 4n .It Ctrl+Shift+Left move active tab to left .It Ctrl+Shift+Right: active tab to right .It Shift+Left Activate left tab (Primary only) .It Shift+Right Activate right tab (Primary only) .It Ctrl+Shift+n Create a new tab with the same profile as the current tab. .El .Pp . .Em Vi style default shortcuts: . .Bl -tag -width 18n -compact -offset 4n .It Ctrl+Shift+h activate left tab .It Ctrl+Shift+l activate right tab .El .Pp . .Em Screen style default shortcuts: . .Bl -tag -width 18n -compact -offset 4n .It Ctrl+Shift+p activate previous active tab .El .Pp . .Em Mrxvt default shortcuts: . .Bl -tag -width 18n -compact -offset 4n .It Ctrl+Shift+1 Move tab to 1st position .It ... .It Ctrl+Shift+0 Move tab to 10th position .It Ctrl+Tab activate previous active tab .It Ctrl+Shift+less_than Move active tab left .It Ctrl+Shift+greater_than Move active tab right . .It Ctrl+Shift+o Change opacity of terminal to make it more transparent. .It Ctrl+Shift+u Change opacity of terminal to make it less transparent. .It Ctrl+Shift+j Change shading of terminal to make it more transparent. .It Ctrl+Shift+k Change shading of terminal to make it less transparent. .It Ctrl+Shift+r Toggle psdudo-transparency . .It Ctrl+Shift+i Hide/show tabbar .It Ctrl+Shift+s Hide/show scrollbar .It Ctrl+Shift+m Hide/show menubar .It Ctrl+Shift+a Hide/show tabbar buttons . .It Ctrl+Shift+b Toggle very bold font .It Ctrl+Shift+z Open a .Nm console in a new tab, and enable the .Ic useFifo option if necessary. Anything typed in this console will be executed as a macro. On clean exit the .Ic useFifo option will be disabled. .It Ctrl+Shift+d Toggle input broadcasting (unbound by default) .It Ctrl+Shift+e Toggle holding exited tab .It Ctrl+Shift+f Toggle full screen mode .It Ctrl+Shift+x Save current configuration . .It Shift+Del Set title of active tab to selection. .It Shift+Insert Paste X selection into active tab. .It Ctrl+Shift+v Paste X selection into active tab. .It Ctrl+Shift+c Paste clipboard into active tab. . .It Shift+Up Scroll up one line (Primary screen only) .It Shift+Dn scroll down one line (Primary screen only) .It Shift+PgUp scroll up one page (Primary screen only) .It Shift+PgDn scroll down one page (Primary screen only) .It Shift+Home Scroll to beginning of scroll-back buffer (Primary screen only) .It Shift+End Scroll to end of scroll-back buffer (Primary screen only) . .It Shift+KeypadPlus Increase font size .It Shift+KeypadMinus Decrease font size . . .It Ctrl+Shift+F1 Open .Nm man page in a new tab. .It Ctrl+Shift+F12 Enable / disable all keyboard macros (except this one of course). .El .Ed . .Ss "Defining custom shortcuts" \"{{{2 .Bd -filled NOTE: The .Sq hotkey mechanism used in versions 0.4.2 and earlier is now obsolete. It has been replaced by the .Sq macro functionality (described below) as of version 0.5.0. .Pp You can define your own keyboard shortcuts in your configuration file by using the following syntax: .Vb Mrxvt.macro.[modifiers+]keyname: action .Ve Here .Sq modifiers is a .Sq + separated list of modifiers .Sq Em Ctrl , .Sq Em Alt , .Sq Em Meta , .Sq Em Shift . .Sq Em Primary . and .Sq Em Add . The first four refer to the respective modifier keys. .Sq Em Primary tells .Nm to make the macro available ONLY when the primary screen is displayed (e.g. .Sq Em Primary macros will not be effective when you are running .Xr vim 1 , but will be effective when you are at the shell prompt). Finally .Sq Em Add tells .Nm to add the macro action to any previous action associated to that particular key. For instance .Vb Mrxvt.macro.Primary+Shift+Return: Esc \eec Mrxvt.macro.Primary+Add+Shift+Return: Str ^M .Ve will define the macro .Sq Shift+Return to first send the escape sequence .Sq \eec to .Nm (which has the effect of clearing the scroll back buffer) and then send .Sq Ctrl-M to the child process, but ONLY in the primary screen. If you're running a shell, then this effectively clears the scroll back buffer and executes the command. .Pp . If the .Sq Em Add modifier is not specified, then the macro action replaces any previous action (if any) associated to the specified key. It is an error to add a macro to a non-existing macro. Currently one key can have at most 16 actions associated to it (this might be reduced to 8 in future). .Pp . .Sq keyname is the name of the key you want to bind to the specified macro. Non alpha numeric keys (e.g. punctuation, or cursor/keypad keys) are specified by using their keyname, which you can find by xev(1), or looking directly in the system header file .Pa /usr/include/X11/keysymdef.h . .Pp . In case you want to unbind a default keyboard macro, just bind the appropriate key to the function .Sq Ic Dummy . For example .Vb Mrxvt.macro.Ctrl+Shift+t: Dummy .Ve will disable the default keyboard shortcut .Sq Ctrl+Shift+t . If you want to disable all keyboard macros, use the option .Sq Fl dm (which can also be accessed via a pop-up menu). The default keyboard macros are defined in the system configuration file .Pa /etc/mrxvt/mrxvtrc so if you only want to disable all default shortcuts keys, don't read the system configuration file by using the .Fl nsc option. .Pp . Notice that keyboard shortcuts definitions are incompatible with X Windows own resource parsing API, i.e., XGetDefaults. So, to enable the keyboard shortcuts, you will need to enable resources but disable xgetdefault when you configure .Nm Ns . .Pp Finally .Sq action is the action you want bound to the specified macro key. The available actions you can bind to macros are: .\" {{{3 Available macros list .Bl -tag -width 4n -offset 4n .It Ic Dummy Clear an existing keyboard shortcut .\" ------------------------------------------------------------ .It Ic Esc Ar str Send the escape sequence .Ar str to .Nm . .\" ------------------------------------------------------------ .It Ic Str Ar str Send the string .Ar str to the child process. .\" ------------------------------------------------------------ .It Ic Exec Ar command Executes .Ar command asynchronously. The command run without any controlling shell or TTY. This is generally used to launch X11 programs (e.g. open the selected text in firefox). If you want a command run in a new tab, see the .Ic NewTab macro). .Pp The argument .Ar command is word split exactly as described in the .Fl blc option (thus for instance beginning it with .Sq \&! will pass it to .Cd /bin/sh -c for word splitting and execution). However keep in mind that like all macro arguments, .Ar command is first .Sq Sy \e interpolated. Thus if on the rare occasion you want .Sq \e\ to be part of .Ar command , then you will have to do something like .Sq \e\e\e\e\e\e\ and not .Sq \e\e\e\ as you would with the argument of .Fl blc . .\" ------------------------------------------------------------ .It Ic NewTab Oo Ar -N Oc Oo Ar \*qtitle\*q Oc Op Oo ! Oc Ns Ar command Open a new tab. .Ar N specifies the profile number. If omitted, profile 0 is used. If only .Sq - (with no number) is specified, then the profile of the current active tab is used (i.e. this can be used to duplicate the current tab). .Ar title is specified (needs to be double quoted), use that for the tab title. If .Ar command is specified, execute that command in the new tab (instead of the one specified by the resource file, or the shell). .Pp .Ar command is word split as described in the .Ic Exec macro. However if command begins with an .So ! Sc then run a shell first, and execute the command in the shell as if the user had typed .Ar command at the shell prompt. If instead you want .Ar command to be passed to .Cd /bin/sh -c for word splitting and execution, then begin .Ar command with .Sq \e! . .\" ------------------------------------------------------------ .It Ic Close Op Ar N Close a tab. If no argument is specified, close all tabs and exit. If .Ar N is 0, close the active tab. Otherwise close the .Ar N Ns th tab . .\" ------------------------------------------------------------ .It Ic GotoTab Op Ar N Goto tab. If .Ar N is ommited or 0, then goto the previous active tab. Otherwise goto the .Ar N Ns th tab. If .Ar N begins with a .Sq + or .Sq - then .Ar N is relative to the current tab. .\" ------------------------------------------------------------ .It Ic MoveTab Ar N Move active tab to position .Ar N . If .Ar N begins with a .Sq + or .Sq - then .Ar N is relative to the current tab. .\" ------------------------------------------------------------ .It Ic Scroll Ar amount Scroll the active tab by .Ar amount lines (negative values mean scroll backward). If .Ar amount ends with .Sq p then scroll .Ar amount pages instead of lines. .\" ------------------------------------------------------------ .It Ic Copy Copy selection into clipboard (not implemented). .\" ------------------------------------------------------------ .It Ic Paste Op Ar selection-buffer Paste selection into active tab. The value .Ar selection-buffer specifies the name of the buffer to be pasted. If not specified the first used buffer in the order PRIMARY, SECONDARY and CLIPBOARD will be used. .\" ------------------------------------------------------------ .It Ic PasteFile Ar filename Paste the content of the file specified by .Ar filename to the currently active tab. This can be used to input text-snippets to a shell or any other terminal based program (i.e. somthing like a bash-profile or sequence of administration commands). .\" ------------------------------------------------------------ .It Ic MonitorTab Ar [ACTIVITY|INACTIVITY|AUTO] Monitor the current tab-window for .Ar ACTIVITY or .Ar INACTIVITY or automatically detect the type of monitoring using the .Ar AUTO option. The amount time which is used to detect the type of monitoring or tab-inactivity can be specified by the .Ic monitorTimeout option. The detection of activity or inactivity is signaled by highlighting the tab of the event and ringing the system bell. Additionally it is possible to execute a dedicated command using the .Ic monitorCommand option. .\" ------------------------------------------------------------ .It Ic ToggleSubwin Op Oo Ar + Ns | Ns Ar - Oc Ns Op Ar b Ns | Ns Ar m Ns | Ns Ar s Ns | Ns Ar t Toggle visibility of sub-windows. If the argument begins with a .Sq + the subwindow is shown. If it begins with a .Sq - the subwindow is hidden. Otherwise it is toggled. The letters .Sq Ar b , .Sq Ar m , .Sq Ar s and .Sq Ar t represent the tabbar buttons, menubar, scrollbar and tabbar respectively. NOTE: Currently you can only toggle one subwindow at a time. .\" ------------------------------------------------------------ .It Ic ResizeFont Oo Ar + Ns | Ns Ar - Oc Ns Ar N Resize the font. With Xft, .Ar N represents the size increment of the xft font. Without Xft, .Ar N represents the index of the X11 fonts specified by the .Cm font Ns Ar N resources. .\" ------------------------------------------------------------ .It Ic ToggleVeryBold Toggle use of bold font for colored text. .\" ------------------------------------------------------------ .It Ic ToggleTransparency Toggle pseudo transparency. .\" ------------------------------------------------------------ .It Ic ToggleBroadcast Op Ar status If .Ar status is omitted or .Sq -1 , then input broadcasting to all tabs is toggled. If it is .Sq 1 , input broadcasting is enabled. If it is .Sq 0 , it is disabled. .\" ------------------------------------------------------------ .It Ic ToggleHold Op Ar mask If .Ar mask is not specified, then just close all tabs who's child processes have exited. (This is almost compatible with the behaviour of .Nm 0.5.1 and earlier). If .Ar mask is specified, then change the hold status of the current tab. .Ar mask must begin with .Sq Sy + , .Sq Sy - , or .Sq Sy \&! and be followed by a bit mask (as in the .Ic holdExit option). .Sq Sy + will add bits to the .Ic holdExit option for this tab, .Sq Sy - will subtract, and .Sq Sy \&! will toggle. Remember that if the lowest bit of the current tabs .Ic holdExit option is set, then the tab will always be held open and everything else will be ignored. .\" ------------------------------------------------------------ .It Ic ToggleFullscreen Toggle between full screen and regular mode. Also enable .Fl Fl smoothResize to get true full screen. This will only work if you are running an EWMH compatible window manager (e.g. Fvwm / OpenBox / KDE / Gnome). .\" ------------------------------------------------------------ .It Ic Raise Raise the .Nm window. .\" ------------------------------------------------------------ .It Ic SetTitle Set title of active tab to selection. (The selection must be owned by .Nm ) .\" ------------------------------------------------------------ .It Ic UseFifo Ar status Enable or disable using a .Xr fifo 1 to listen for macros on (see the .Ic useFifo option). The argument .Ar status should be .Sy 0 , 1 , -1 to disable, enable or toggle respectively. .\" ------------------------------------------------------------ .It Ic PrintScreen Oo Fl psn Oc Op Ar command Dump screen to printer (or .Ar command ) . If .Fl p is specified, then the output is pretty printed (i.e. escape sequences are used to get the same color in the output as on your screen). If .Fl s is specified, then the entire scroll back is printed (instead of just the current screen). If .Fl n is specified, then every screen line is terminated with a newline char (by default screen lines that wrap to the next line are not terminated with a newline). Finally, if command is specified it is used as the printer pipe (if not the value of .Ic printPipe or the compiled in default is used). .\" ------------------------------------------------------------ .It Ic SaveConfig Op Ar filename Save config to file. If no filename is specified, save to .Pa ~/.mrxvtrc.save . .\" ------------------------------------------------------------ .It Ic ToggleMacros Toggle the use of keyboard shortcuts. When macros are disabled (either by using this macro, or by the .Fl dm option), then this is the only keyboard shortcut that will work. Thus you can re-enable your keyboard shortcuts via the keyboard using this function. .\" ------------------------------------------------------------ .El .Pp Additionally, the argument to any of the above macros are .Sq Sy \e and .Sq Sy % interpolated as follows: .Pp .Bl -tag -compact -offset 4n -width 8n .It Sy \ea Bell .It Sy \eb Backspace .It Sy \eE , \ee Escape .It Sy \en Newline .It Sy \er Carriage return .It Sy \et Tab .It Sy \e Ns Ar ddd Char with octal ASCII code .Ar ddd . .It Sy ^@ , ^A .. ^Z .. ^_ , ^? Control-@, Control-A ... .Pp .It Sy %G Global (static) tab number. .It Sy %p PID of child process in current tab. .It Sy \&%P PID of .Nm .It Sy %n Tab number. .It Sy % Ns Sy N Expands to .Sq normally if the process exited normally (e.g. by calling .Xr exit 1 ) or .Sq abnormally otherwise. (Note this is independent of the exit status). .It Sy %s Text selected in the .Nm window. .It Sy %S If the process in this tab is dead, then it expands to the exit status of the child process. Otherwise left unchanged. .It Sy %t Tab title. .It Sy \&%T Total number of tabs created in .Nm lifetime. .El .Ed .Ss Mouse shortcuts \"{{{2 .Bd -filled .Bl -tag -width 4n .It Changing tab titles This mouse shortcut can be used to dynamically change the tab title as follows: Select text in the terminal window. Then middle click on a tab to change the tab's title. If you middle click on the tabbar background, then the title of the active tab is changed. .It Tab list menu By default, if you right click on the tab bar, or control-left-click on the terminal window, a popup menu with a list of currently open tabs pops up. The actual menu popped up can be customized as described under the section .Sx MENUS . .It Popup menus If you Control-click on the terminal window (with any mouse button), it pops up a menu. The actual menu popped up can be customized as described under the section .Sx MENUS . .It Moving tabs Click and drag a tab to some other location on the tab-bar to move it. .El .Ed .\"}}} . . .Sh ESCAPE SEQUENCES \"{{{1 . . .Bd -filled You have several escape sequences to control .Nm . All default .Xr rxvt 1 escape sequences are supported by .Nm . A few extra escape sequences have been added to improve DEC compatibility, and allow interaction with extra .Nm features (e.g. tabs). The supported escape sequences are listed in the file .Pa mrxvt_seq.txt included in the distribution. .Pp For omissions in the documentation, and a more complete reference to escape sequences you should look at the file .Pa ctlseqs.txt that comes with the xterm package, .Xr console_codes 4 and the original rxvt documentation in the file .Pa rxvtRef.txt . .Pp For basic interaction with .Nm (e.g. changing the tab title etc.) you should also look at the programs .Pa share/scripts/settitle.c and .Pa share/scripts/mrxvtset.pl that are supplied with the .Nm distribution. .Ed . . .Sh ENVIRONMENT \"{{{1 . . .Bd -filled .Bl -tag -width 4n .It Ev COLORFGBG Set to the terminal foreground and background colors. .It Ev COLORTERM Sets to the terminal sub-name that indicates its color. .It Ev DISPLAY Used (and set) to the X display bieng used. .It Ev PATH_ENV Path to look for menu / background files (see .Fl path option). .It Ev TERM Set to the terminal name in the window you have created. .It Ev MRXVT_TABTITLE Set to the initial tab title of each terminal. Notice that its value will not be altered if the user uses a shortcut or escape sequence to change the tab title. The user must modify it manually after doing that. .It Ev WINDOWID Set to the X window id number of the mrxvt window. .El .Ed . . .Sh FILES \"{{{1 . . .Bd -filled The actual pathnames given may differ on your system. .Bl -tag -width 4n .It Pa default.menu The default menu file loaded at startup (searched for in your .Fl path ) . .It Pa ~/mrxvt Directory in which to look for user menu and image files. .It Pa ~/.mrxvtrc This is the default configuration file (since 0.3.9). If present, resources read from this file override existing resources. .It Pa ~/.Xdefaults (OBSOLETE) This was the default configuration file (before 0.3.9). If present, resources read from this file override existing resources. .It Pa ~/.Xresources (OBSOLETE) If both .Pa .mrxvtrc and .Pa .Xdefaults are not found, try this one. .It Pa /etc/mrxvt System wide directory in which to look for user menu and image files. .It Pa /etc/mrxvt/default.menu Default menu file read on startup. .It Pa /etc/mrxvt/mrxvtrc System wide configuration file. (By default this file only defines the default keyboard macros) .It Pa /etc/utmp System file for login records. .It Pa /usr/lib/X11/rgb.txt Color names. .It Pa /usr/X11R6/lib/X11/app-defaults/XTerm (OBSOLETE) If enable xgetdefaults at compiled time, this is the first configuration file read. .El .Ed . . .Sh BUGS \"{{{1 . . .Ss "Reporting bugs" .Bd -filled Please report bugs using the sourceforge bug tracker system at .Pp .Bd -centered .Ad http://sourceforge.net/projects/materm .Ed .Pp Alternately you can send your bug report to the mrxvt developer mailing list at .Pp .Bd -centered .Mt materm-devel@lists.sourceforge.net .Ed .Pp Be sure you give us enough details to reproduce the bug ourselves, and check to see if your bug still exists in the current CVS version. .Ed .Ss "Known bugs" .Bd -filled .Bl -dash -compact -width 2 .It Tabs don't work properly when running under Xnest. .It Transparency and tinting are global, not specific to a terminal. .It The transparentForce option does not work well with all window managers (e.g. OpenBox). .El .Ed . . .Sh SEE ALSO \"{{{1 . . .Bd -filled .Xr rxvt 1 , .Xr xterm 1 , .Xr resize 1 , .Pa mrxvt_seq.txt , .Ar Xterm control sequences (this is the file .Pa ctlseqs.ms or .Pa ctlseqs.txt ) , .Xr console_codes 4 .Pp .Bd -centered .Ad http://materm.sourceforge.net .Ed .Ed . . .Sh AUTHORS \"{{{1 . . .An "Terminator" < Ns Mt jimmyzhou@users.sourceforge.net Ns > .An "Gautam Iyer" < Ns Mt gi1242@users.sourceforge.net Ns > .An "Marc Schoechlin" < Ns Mt mschoechlin@users.sourceforge.net Ns > . . mrxvt-0.5.4/doc/README.menu.bz20000644000175000001440000000216210756127603012711 00000000000000BZh91AY&SYz9_`0\>7NP^w+9TwHC$&zSmL4i"bhhLɐ4@5SM&DOj42bdɣ biL#0 M&hM e3=@4  !O[_H|tY?wRI#Z-mmSfT}-u7<顣u'z\$zc*z[fzDW{$B&fܗẖnT>V{s_3WpA(z;ĵ{&HŁ:c֜0%a˼N|&dYsx^`{]F"k'K5%&c5K+DŽ$! wM5`b˂}*_ˉVEU섘H8$/՘gIAJiVm2W2R( (#(rV腪\Xh((9S'.aA;W} PJsj~<@m(h˒:uWoN n4tico8z ''#!tǢ]ʈb49KO/j:e. 67-UE!';"֌+w?Ǝt*JR,*Mc!, Vo 1Pjhi}SN-HU3cZAX3B*ҰdYhT!/m@؞m/;.@zWǸ3tʇoz'i~`L؉ YL غy^Jy$~- `"dp`=l;{=H6l#n bx;]J7@6IGCt3jRyn%x0jB>xXYheDQ~. sNW^#[;|$kF۴y{MƂ-] Ueڂpj5f4ҕ$@4e "Hp]+L:n]nU<Ҭ)mH/`jmaUUHd ,1ϯb f!CĴה1՜c6Va0U##8X%ini7]_)&go.ńT&  Z . - Y(pf^%>}jg`0 AU=ܑ̬gnTkR, !Y0Rg5d8Jc3ԎmMIZL!u466Zi{}4٨ܐmhq o0'9zmȍCRa?rR/.kuz&Vm눹!ufS#EKC~kGO0 ,T7~ fwYLH [`mrxvt-0.5.4/src/0000777000175000001440000000000011045531320010462 500000000000000mrxvt-0.5.4/src/encoding.c0000644000175000001440000004602711021037735012346 00000000000000/*--------------------------------*-C-*--------------------------------------* * File: encoding.c *---------------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (C) 2001 Tomohiro KUBOTA * Copyright (C) 2004 Jingmin Zhou * Copyright (C) 2007 Jehan Hysseo * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *--------------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" struct KNOWN_ENCODINGS { char* name; enum enc_label method; void (*func) (unsigned char*, int); }; #ifdef MULTICHAR_SET static struct KNOWN_ENCODINGS known_encodings[] = { {"SHIFTJIS", ENC_SJIS, rxvt_decode_sjis2jis}, {"SJIS", ENC_SJIS, rxvt_decode_sjis2jis}, {"EUC-JISX0213",ENC_SJIS, rxvt_decode_sjis2jis}, {"EUCJ", ENC_EUCJ, rxvt_decode_euc2jis}, {"EUCJP", ENC_EUCJ, rxvt_decode_euc2jis}, {"EUC-JP", ENC_EUCJ, rxvt_decode_euc2jis}, {"UJIS", ENC_EUCJ, rxvt_decode_euc2jis}, {"EUCKR", ENC_EUCKR, rxvt_decode_euc2jis}, {"EUC-KR", ENC_EUCKR, rxvt_decode_euc2jis}, {"KR", ENC_EUCKR, rxvt_decode_dummy}, {"EUCCN", ENC_GB, rxvt_decode_euc2jis}, {"EUC-CN", ENC_GB, rxvt_decode_euc2jis}, {"GB2312", ENC_GB, rxvt_decode_euc2jis}, {"GB", ENC_GB, rxvt_decode_euc2jis}, {"GB18030", ENC_GB18030, rxvt_decode_gb180302jis}, {"GBK", ENC_GBK, rxvt_decode_dummy}, {"BIG5", ENC_BIG5, rxvt_decode_dummy}, {"BIGFIVE", ENC_BIG5, rxvt_decode_dummy}, {"BIG5HKSCS", ENC_BIG5, rxvt_decode_dummy}, {"KOI8R", ENC_KOI8R, rxvt_decode_dummy}, {"KOI8-R", ENC_KOI8R, rxvt_decode_dummy}, {"KOI8U", ENC_KOI8U, rxvt_decode_dummy}, {"KOI8-U", ENC_KOI8U, rxvt_decode_dummy}, {"ISO8859-1", ENC_ISO8859_1, rxvt_decode_dummy}, {"ISO8859-2", ENC_ISO8859_2, rxvt_decode_dummy}, {"ISO8859-3", ENC_ISO8859_3, rxvt_decode_dummy}, {"ISO8859-4", ENC_ISO8859_4, rxvt_decode_dummy}, {"ISO8859-5", ENC_ISO8859_5, rxvt_decode_dummy}, {"ISO8859-6", ENC_ISO8859_6, rxvt_decode_dummy}, {"ISO8859-7", ENC_ISO8859_7, rxvt_decode_dummy}, {"ISO8859-8", ENC_ISO8859_8, rxvt_decode_dummy}, {"ISO8859-9", ENC_ISO8859_9, rxvt_decode_dummy}, {"ISO8859-10", ENC_ISO8859_10, rxvt_decode_dummy}, {"ISO8859-11", ENC_ISO8859_11, rxvt_decode_dummy}, {"ISO8859-12", ENC_ISO8859_12, rxvt_decode_dummy}, {"ISO8859-13", ENC_ISO8859_13, rxvt_decode_dummy}, {"ISO8859-14", ENC_ISO8859_14, rxvt_decode_dummy}, {"ISO8859-15", ENC_ISO8859_15, rxvt_decode_dummy}, {"ISO88591", ENC_ISO8859_1, rxvt_decode_dummy}, {"ISO88592", ENC_ISO8859_2, rxvt_decode_dummy}, {"ISO88593", ENC_ISO8859_3, rxvt_decode_dummy}, {"ISO88594", ENC_ISO8859_4, rxvt_decode_dummy}, {"ISO88595", ENC_ISO8859_5, rxvt_decode_dummy}, {"ISO88596", ENC_ISO8859_6, rxvt_decode_dummy}, {"ISO88597", ENC_ISO8859_7, rxvt_decode_dummy}, {"ISO88598", ENC_ISO8859_8, rxvt_decode_dummy}, {"ISO88599", ENC_ISO8859_9, rxvt_decode_dummy}, {"ISO885910", ENC_ISO8859_10, rxvt_decode_dummy}, {"ISO885911", ENC_ISO8859_11, rxvt_decode_dummy}, {"ISO885912", ENC_ISO8859_12, rxvt_decode_dummy}, {"ISO885913", ENC_ISO8859_13, rxvt_decode_dummy}, {"ISO885914", ENC_ISO8859_14, rxvt_decode_dummy}, {"ISO885915", ENC_ISO8859_15, rxvt_decode_dummy}, {"ISO_8859-1", ENC_ISO8859_1, rxvt_decode_dummy}, {"ISO_8859-2", ENC_ISO8859_2, rxvt_decode_dummy}, {"ISO_8859-3", ENC_ISO8859_3, rxvt_decode_dummy}, {"ISO_8859-4", ENC_ISO8859_4, rxvt_decode_dummy}, {"ISO_8859-5", ENC_ISO8859_5, rxvt_decode_dummy}, {"ISO_8859-6", ENC_ISO8859_6, rxvt_decode_dummy}, {"ISO_8859-7", ENC_ISO8859_7, rxvt_decode_dummy}, {"ISO_8859-8", ENC_ISO8859_8, rxvt_decode_dummy}, {"ISO_8859-9", ENC_ISO8859_9, rxvt_decode_dummy}, {"ISO_8859-10", ENC_ISO8859_10, rxvt_decode_dummy}, {"ISO_8859-11", ENC_ISO8859_11, rxvt_decode_dummy}, {"ISO_8859-12", ENC_ISO8859_12, rxvt_decode_dummy}, {"ISO_8859-13", ENC_ISO8859_13, rxvt_decode_dummy}, {"ISO_8859-14", ENC_ISO8859_14, rxvt_decode_dummy}, {"ISO_8859-15", ENC_ISO8859_15, rxvt_decode_dummy}, {"ISO_8859-1", ENC_ISO8859_1, rxvt_decode_dummy}, {"ISO-8859-2", ENC_ISO8859_2, rxvt_decode_dummy}, {"ISO-8859-3", ENC_ISO8859_3, rxvt_decode_dummy}, {"ISO-8859-4", ENC_ISO8859_4, rxvt_decode_dummy}, {"ISO-8859-5", ENC_ISO8859_5, rxvt_decode_dummy}, {"ISO-8859-6", ENC_ISO8859_6, rxvt_decode_dummy}, {"ISO-8859-7", ENC_ISO8859_7, rxvt_decode_dummy}, {"ISO-8859-8", ENC_ISO8859_8, rxvt_decode_dummy}, {"ISO-8859-9", ENC_ISO8859_9, rxvt_decode_dummy}, {"ISO-8859-10", ENC_ISO8859_10, rxvt_decode_dummy}, {"ISO-8859-11", ENC_ISO8859_11, rxvt_decode_dummy}, {"ISO-8859-12", ENC_ISO8859_12, rxvt_decode_dummy}, {"ISO-8859-13", ENC_ISO8859_13, rxvt_decode_dummy}, {"ISO-8859-14", ENC_ISO8859_14, rxvt_decode_dummy}, {"ISO-8859-15", ENC_ISO8859_15, rxvt_decode_dummy}, {"NOENC", ENC_NOENC, rxvt_decode_dummy}, {"", ENC_NOENC, rxvt_decode_dummy}, {NULL, -1, NULL}, }; #endif struct NFONT_LIST { enum enc_label encoding; char* font[MAX_NFONTS]; }; static struct NFONT_LIST nfont_list[] = { {ENC_NOENC, {NFONT_LIST_NULL}}, #ifdef MULTICHAR_SET {ENC_SJIS, {NFONT_LIST_EUCJ}}, {ENC_EUCJ, {NFONT_LIST_EUCJ}}, {ENC_GB, {NFONT_LIST_GB}}, {ENC_GBK, {NFONT_LIST_GBK}}, {ENC_GB18030, {NFONT_LIST_GB18030}}, {ENC_BIG5, {NFONT_LIST_BIG5}}, {ENC_EUCKR, {NFONT_LIST_EUCKR}}, #endif {ENC_KOI8R, {NFONT_LIST_KOI8R}}, {ENC_KOI8U, {NFONT_LIST_KOI8U}}, {ENC_ISO8859_1, {NFONT_LIST_NULL}}, {ENC_ISO8859_2, {NFONT_LIST_NULL}}, {ENC_ISO8859_3, {NFONT_LIST_NULL}}, {ENC_ISO8859_4, {NFONT_LIST_NULL}}, {ENC_ISO8859_5, {NFONT_LIST_NULL}}, {ENC_ISO8859_6, {NFONT_LIST_NULL}}, {ENC_ISO8859_7, {NFONT_LIST_NULL}}, {ENC_ISO8859_8, {NFONT_LIST_NULL}}, {ENC_ISO8859_9, {NFONT_LIST_NULL}}, {ENC_ISO8859_10, {NFONT_LIST_NULL}}, {ENC_ISO8859_11, {NFONT_LIST_NULL}}, {ENC_ISO8859_12, {NFONT_LIST_NULL}}, {ENC_ISO8859_13, {NFONT_LIST_NULL}}, {ENC_ISO8859_14, {NFONT_LIST_NULL}}, {ENC_ISO8859_15, {NFONT_LIST_NULL}}, }; static char* isofont[] = {NFONT_LIST_ISO8859X}; #ifdef MULTICHAR_SET /* Multicharacter font names, roman fonts sized to match */ struct MFONT_LIST { enum enc_label encoding; char* mfont[MAX_NFONTS]; }; static struct MFONT_LIST mfont_list[] = { {ENC_NOENC, {MFONT_LIST_NULL}}, {ENC_SJIS, {MFONT_LIST_EUCJ}}, {ENC_EUCJ, {MFONT_LIST_EUCJ}}, {ENC_GB, {MFONT_LIST_GB}}, {ENC_GBK, {MFONT_LIST_GBK}}, {ENC_GB18030, {MFONT_LIST_GB18030}}, {ENC_BIG5, {MFONT_LIST_BIG5}}, {ENC_EUCKR, {MFONT_LIST_EUCKR}}, {ENC_KOI8R, {MFONT_LIST_NULL}}, {ENC_KOI8U, {MFONT_LIST_NULL}}, {ENC_ISO8859_1, {MFONT_LIST_NULL}}, {ENC_ISO8859_2, {MFONT_LIST_NULL}}, {ENC_ISO8859_3, {MFONT_LIST_NULL}}, {ENC_ISO8859_4, {MFONT_LIST_NULL}}, {ENC_ISO8859_5, {MFONT_LIST_NULL}}, {ENC_ISO8859_6, {MFONT_LIST_NULL}}, {ENC_ISO8859_7, {MFONT_LIST_NULL}}, {ENC_ISO8859_8, {MFONT_LIST_NULL}}, {ENC_ISO8859_9, {MFONT_LIST_NULL}}, {ENC_ISO8859_10, {MFONT_LIST_NULL}}, {ENC_ISO8859_11, {MFONT_LIST_NULL}}, {ENC_ISO8859_12, {MFONT_LIST_NULL}}, {ENC_ISO8859_13, {MFONT_LIST_NULL}}, {ENC_ISO8859_14, {MFONT_LIST_NULL}}, {ENC_ISO8859_15, {MFONT_LIST_NULL}}, }; #endif /* MULTICHAR_SET */ struct FALLBACK_FONT_LIST { enum enc_label encoding; char* fontname; }; struct ENCODING_NAME { enum enc_label encoding; char* encname; }; static struct ENCODING_NAME encoding_name[] = { {ENC_NOENC, "NOENC"}, # ifdef MULTICHAR_SET {ENC_SJIS, "SJIS"}, {ENC_EUCJ, "EUCJP"}, {ENC_GB, "GB2312"}, {ENC_GBK, "GBK"}, {ENC_GB18030, "GB18030"}, {ENC_BIG5, "BIG5"}, {ENC_EUCKR, "EUCKR"}, # endif {ENC_KOI8R, "KOI8R"}, {ENC_KOI8U, "KOI8U"}, {ENC_ISO8859_1, "ISO8859-1"}, {ENC_ISO8859_2, "ISO8859-2"}, {ENC_ISO8859_3, "ISO8859-3"}, {ENC_ISO8859_4, "ISO8859-4"}, {ENC_ISO8859_5, "ISO8859-5"}, {ENC_ISO8859_6, "ISO8859-6"}, {ENC_ISO8859_7, "ISO8859-7"}, {ENC_ISO8859_8, "ISO8859-8"}, {ENC_ISO8859_9, "ISO8859-9"}, {ENC_ISO8859_10, "ISO8859-10"}, {ENC_ISO8859_11, "ISO8859-11"}, {ENC_ISO8859_12, "ISO8859-12"}, {ENC_ISO8859_13, "ISO8859-13"}, {ENC_ISO8859_14, "ISO8859-14"}, {ENC_ISO8859_15, "ISO8859-15"}, }; #ifdef XFT_SUPPORT static struct FALLBACK_FONT_LIST fallback_mfont_list_xft[] = { {ENC_NOENC, DEFAULT_XFT_FONT_NAME}, # ifdef MULTICHAR_SET {ENC_SJIS, "Kochi Gothic"}, {ENC_EUCJ, "Kochi Gothic"}, {ENC_GB, "SimSun"}, {ENC_GBK, "SimSun"}, {ENC_GB18030, "SimSun"}, {ENC_BIG5, "MingLiU"}, {ENC_EUCKR, "Luxi Mono"}, # endif {ENC_KOI8R, "Courier New"}, {ENC_KOI8U, "Courier New"}, {ENC_ISO8859_1, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_2, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_3, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_4, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_5, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_6, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_7, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_8, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_9, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_10, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_11, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_12, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_13, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_14, DEFAULT_XFT_FONT_NAME}, {ENC_ISO8859_15, DEFAULT_XFT_FONT_NAME}, }; #endif /* XFT_SUPPORT */ static struct FALLBACK_FONT_LIST fallback_mfont_list_x11[] = { {ENC_NOENC, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-1"}, # ifdef MULTICHAR_SET {ENC_SJIS, "-*-*-*-r-*-*-*-*-*-c-*-jisx0208*-0"}, {ENC_EUCJ, "-*-*-*-r-*-*-*-*-*-c-*-jisx0208*-0"}, {ENC_GB, "-*-*-*-*-*-*-*-*-*-*-*-*-gb2312*-0"}, {ENC_GBK, "-*-*-*-*-*-*-*-*-*-*-*-*-gbk-0"}, {ENC_GB18030, "-*-*-*-*-*-*-*-*-*-*-*-*-gb18030*-0"}, {ENC_BIG5, "-*-*-*-*-*-*-*-*-*-*-c-*-big5-0"}, {ENC_EUCKR, "-*-*-*-*-*-*-*-*-*-*-c-*-ksc5601*-0"}, # endif {ENC_KOI8R, "-*-*-*-r-*-*-*-*-*-c-*-koi8-r"}, {ENC_KOI8U, "-*-*-*-r-*-*-*-*-*-c-*-koi8-u"}, {ENC_ISO8859_1, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-1"}, {ENC_ISO8859_2, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-2"}, {ENC_ISO8859_3, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-3"}, {ENC_ISO8859_4, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-4"}, {ENC_ISO8859_5, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-5"}, {ENC_ISO8859_6, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-6"}, {ENC_ISO8859_7, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-7"}, {ENC_ISO8859_8, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-8"}, {ENC_ISO8859_9, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-9"}, {ENC_ISO8859_10, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-10"}, {ENC_ISO8859_11, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-11"}, {ENC_ISO8859_12, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-12"}, {ENC_ISO8859_13, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-13"}, {ENC_ISO8859_14, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-14"}, {ENC_ISO8859_15, "-*-*-*-r-*-*-*-*-*-c-*-iso8859-15"}, }; char** def_fontName; char** def_mfontName; #ifdef MULTICHAR_SET /* EXTPROTO */ void rxvt_decode_euc2jis (unsigned char* str, int len) { register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_ENCODING, "%s (%s : %d)\n", __func__, str, len)); for (i = 0; i < len; i++) str[i] &= 0x7F; } /* EXTPROTO */ void rxvt_decode_sjis2jis (unsigned char* str, int len) { register int i; unsigned char *high, *low; rxvt_dbgmsg ((DBG_DEBUG, DBG_ENCODING, "%s\n", __func__)); for (i = 0; i < len; i += 2, str += 2) { high = str; low = str + 1; (*high) -= (*high > 0x9F ? 0xB1 : 0x71); *high = (*high) * 2 + 1; if (*low > 0x9E) { *low -= 0x7E; (*high)++; } else { if (*low > 0x7E) (*low)--; *low -= 0x1F; } } } /* EXTPROTO */ void rxvt_decode_gb180302jis (unsigned char* str, int len) { register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_ENCODING, "%s\n", __func__)); for (i = 0; i < len; i++) str[i] &= 0x7F; } /* EXTPROTO */ void rxvt_set_multichar_encoding (rxvt_t* r, const char* str) { struct KNOWN_ENCODINGS* a; assert (NOT_NULL(str)); rxvt_msg (DBG_INFO, DBG_ENCODING, "trying to set multichar encoding to %s\n", str); a = (struct KNOWN_ENCODINGS*) known_encodings; for (; a->name; a++) { if (0 == STRCASECMP (str, a->name)) { r->encoding_method = a->method; r->h->multichar_decode = a->func; break; } } /* not a known encoding method */ if (IS_NULL(a->name)) { rxvt_msg (DBG_INFO, DBG_ENCODING, "... effectively set to noenc\n"); r->encoding_method = ENC_NOENC; r->h->multichar_decode = rxvt_decode_dummy; } else rxvt_msg (DBG_INFO, DBG_ENCODING, "... effectively set to %s\n", a->name); #ifdef XFT_SUPPORT # ifdef HAVE_ICONV_H if ((iconv_t) -1 != r->TermWin.xfticonv) { iconv_close (r->TermWin.xfticonv); r->TermWin.xfticonv = (iconv_t) -1; } /* ** If encoding method is set AND mfont is loaded, open the ** iconv. Otherwise, xfticonv is -1 */ if (ENC_NOENC != r->encoding_method && NOTSET_OPTION(r, Opt2_xftNomFont)) r->TermWin.xfticonv = iconv_open ("UTF-8", rxvt_encoding_name(r)); # endif #endif } #endif /* MULTICHAR_SET */ /* EXTPROTO */ void rxvt_decode_dummy (unsigned char* str, int len) { rxvt_dbgmsg ((DBG_DEBUG, DBG_ENCODING, "%s\n", __func__)); } /* EXTPROTO */ void rxvt_set_default_locale (rxvt_t* r) { char* locale; #if defined(HAVE_SETLOCALE) || defined(HAVE_XSETLOCALE) char* lc; #endif locale = getenv ("LC_ALL"); if (IS_NULL(locale)) locale = getenv ("LC_CTYPE"); if (IS_NULL(locale)) locale = getenv ("LANG"); #if defined(HAVE_SETLOCALE) || defined(HAVE_XSETLOCALE) lc = setlocale(LC_CTYPE, ""); if (IS_NULL(locale)) locale = lc; #endif rxvt_msg (DBG_INFO, DBG_ENCODING, "set default locale to %s\n", locale ? locale : "none"); r->h->locale = locale; } /* This function get the encoding method from locale. This should be ** the *correct* way to specify encoding method. The old way, using ** -km option or multichar_encoding resource, should be abandoned in ** the future as we steadily migrate to UTF-8. */ /* EXTPROTO */ char* rxvt_get_encoding_from_locale (rxvt_t* r) { char* enc; if (IS_NULL(r->h->locale)) return NULL; #ifdef HAVE_NL_LANGINFO if (IS_NULL (enc = nl_langinfo (CODESET))) return NULL; #else { char *end; // the codeset is between '.' and '@'. if (IS_NULL(enc = strchr (r->h->locale, '.'))) return NULL; if (!IS_NULL (end = strchr (r->h->locale, '@'))) end[0] = '\0'; enc ++; } #endif if ((char) 0 == *enc) return NULL; return enc; } /* EXTPROTO */ char* rxvt_encoding_name (rxvt_t* r) { assert (r->encoding_method >= 0); assert (r->encoding_method <= ENC_ISO8859_15); return encoding_name[r->encoding_method].encname; } #ifdef XFT_SUPPORT /* Fallback XFT fonts */ /* EXTPROTO */ char* rxvt_fallback_mfont_xft (rxvt_t* r) { assert (r->encoding_method >= 0); assert (r->encoding_method <= ENC_ISO8859_15); return fallback_mfont_list_xft[r->encoding_method].fontname; } /* EXTPROTO */ void rxvt_set_default_font_xft (rxvt_t* r) { if (ISSET_OPTION(r, Opt_xft) && IS_NULL(r->h->rs[Rs_xftfont])) r->h->rs[Rs_xftfont] = DEFAULT_XFT_FONT_NAME; # ifdef MULTICHAR_SET if (ISSET_OPTION(r, Opt_xft) && IS_NULL(r->h->rs[Rs_xftmfont])) r->h->rs[Rs_xftmfont] = rxvt_fallback_mfont_xft (r); # endif } #endif /* XFT_SUPPORT */ /* Fallback X11 fonts */ /* EXTPROTO */ char* rxvt_fallback_mfont_x11 (rxvt_t* r) { assert (r->encoding_method >= 0); assert (r->encoding_method <= ENC_ISO8859_15); return fallback_mfont_list_x11[r->encoding_method].fontname; } /* EXTPROTO */ void rxvt_set_default_font_x11 (rxvt_t* r) { register int i; rxvt_dbgmsg ((DBG_VERBOSE, DBG_ENCODING, "%s\n", __func__)); /* Set default fonts */ def_fontName = (char**) nfont_list[r->encoding_method].font; #ifdef MULTICHAR_SET switch (r->encoding_method) { case ENC_SJIS : def_mfontName = (char**) mfont_list[ENC_SJIS].mfont; break; case ENC_EUCJ : def_mfontName = (char**) mfont_list[ENC_EUCJ].mfont; break; case ENC_GB : def_mfontName = (char**) mfont_list[ENC_GB].mfont; break; case ENC_GBK : def_mfontName = (char**) mfont_list[ENC_GBK].mfont; break; case ENC_GB18030 : def_mfontName = (char**) mfont_list[ENC_GB18030].mfont; break; case ENC_BIG5 : def_mfontName = (char**) mfont_list[ENC_BIG5].mfont; break; case ENC_EUCKR: def_mfontName = (char**) mfont_list[ENC_EUCKR].mfont; break; default: def_mfontName = (char**) mfont_list[r->encoding_method].mfont; break; } /* Found no mfont, fall back to ISO8859-X font */ if (IS_NULL(def_mfontName[0])) { for (i = 0; i < MAX_NFONTS; i ++) { char* ptr = rxvt_malloc (STRLEN(isofont[i])+4); if (r->encoding_method >= ENC_ISO8859_1 && r->encoding_method <= ENC_ISO8859_15) sprintf (ptr, isofont[i], r->encoding_method - ENC_ISO8859_1 + 1); else sprintf (ptr, isofont[i], 1); def_mfontName[i] = ptr; } } #endif /* Found no font, fall back to ISO8859-X font */ if (IS_NULL(def_fontName[0])) { for (i = 0; i < MAX_NFONTS; i ++) { char* ptr = rxvt_malloc (STRLEN(isofont[i])+4); #ifdef MULTICHAR_SET if (r->encoding_method >= ENC_ISO8859_1 && r->encoding_method <= ENC_ISO8859_15) sprintf (ptr, isofont[i], r->encoding_method - ENC_ISO8859_1 + 1); else #endif sprintf (ptr, isofont[i], 1); def_fontName[i] = ptr; } } /* Overrided by -km option or X resources */ for (i = 0; i < MAX_NFONTS; i ++) { if (IS_NULL(r->h->rs[Rs_font +i])) r->h->rs[Rs_font +i] = def_fontName[i]; #ifdef MULTICHAR_SET if (IS_NULL(r->h->rs[Rs_mfont +i])) r->h->rs[Rs_mfont +i] = def_mfontName[i]; #endif } } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/encoding.h0000644000175000001440000001557010756127602012361 00000000000000/*--------------------------------*-H-*---------------------------------* * File: encoding.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (C) 2001 Tomohiro KUBOTA * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __ENCODING_H__ #define __ENCODING_H__ /* * Font definitions for supported encodings * * Font Usage Policy (suggested): * 1. Use fonts available from XFree86 as much as possible. * 2. Use popular fonts in the language community as much as possible. * 3. Use "OpenSource" (by Open Source Definition, * http://www.opensource.org/) fonts as much as possible. * * Comments are the source of these fonts. * xf XFree86 distribution * pd public domain fonts from ftp://ftp.gnu.org/pub/gnu/ * ak public domain "a12k12" fonts * na "naga10" from http://gondow-www.cs.titech.ac.jp/~snagao/fonts/ * cr "Xcyr" fonts from http://sawsoft.newmail.ru/LS/ * ba "baekmuk" fonts from ftp://ftp.mizi.co.kr/pub/baekmuk * * These definitions should be brushed up by native speakers. */ #define MAX_NFONTS (6) #define FONT0_IDX (0) #ifdef MULTICHAR_SET #define NFONT_LIST_EUCJ \ "7x14", "8x16", "9x18", "12x24",\ "-misc-fixed-medium-r-normal--10-90-75-75-c-50-iso8859-1",\ "6x12" #define MFONT_LIST_EUCJ \ "-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208.1983-0",\ "-misc-fixed-medium-r-normal--10-90-75-75-c-100-jisx0208.1983-0",\ "-misc-fixed-medium-r-normal--12-110-75-75-c-120-jisx0208.1983-0",\ "-jis-fixed-medium-r-normal--16-150-75-75-c-160-jisx0208.1983-0",\ "-jis-gothic-medium-r-normal--18-170-75-75-c-180-jisx0208.1983-0",\ "-jis-fixed-medium-r-normal--24-230-75-75-c-240-jisx0208.1983-0" #define NFONT_LIST_GB "8x16", "8x16", "12x24", "8x16", "8x16", "12x24" #define MFONT_LIST_GB \ "-isas-song ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0",\ "-isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0",\ "-isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0",\ "-isas-song ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0",\ "-isas-fangsong ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0",\ "-isas-song ti-medium-r-normal--24-240-72-72-c-240-gb2312.1980-0" #define NFONT_LIST_GBK "7x14", "8x16", "6x12", "7x14", "8x16", "6x12" #define MFONT_LIST_GBK \ "-xtm-songti-medium-r-normal--14-140-75-75-c-140-gbk-0",\ "-xtm-songti-medium-r-normal--16-160-75-75-c-160-gbk-0",\ "-xtm-songti-medium-r-normal--12-120-75-75-c-120-gbk-0",\ "-xtm-songti-medium-r-normal--14-140-75-75-c-140-gbk-0",\ "-xtm-songti-medium-r-normal--16-160-75-75-c-160-gbk-0",\ "-xtm-songti-medium-r-normal--12-120-75-75-c-120-gbk-0" #define NFONT_LIST_GB18030 "8x16", "8x16", "8x16", "8x16", "8x16", "8x16" #define MFONT_LIST_GB18030 \ "-misc-simsun-medium-r-normal--16-0-0-0-p-0-gb18030.2000-0",\ "-misc-simhei-medium-r-normal--16-0-0-0-p-0-gb18030.2000-0",\ "-misc-fzyuanti-medium-i-normal--16-0-0-0-p-0-gb18030.2000-0",\ "-misc-simsun-medium-r-normal--16-0-0-0-p-0-gb18030.2000-0",\ "-misc-simhei-medium-r-normal--16-0-0-0-p-0-gb18030.2000-0",\ "-misc-fzyuanti-medium-i-normal--16-0-0-0-p-0-gb18030.2000-0" #define NFONT_LIST_BIG5 "8x16", "10x20", "12x24", "8x16", "10x20", "12x24" #define MFONT_LIST_BIG5 \ "-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0",\ "-taipei-fixed-medium-r-normal--20-200-75-75-c-200-big5-0",\ "-taipei-fixed-medium-r-normal--24-240-75-75-c-240-big5-0",\ "-eten-fixed-medium-r-normal--16-150-75-75-c-160-big5-0",\ "-eten-fixed-medium-r-normal--20-200-75-75-c-200-big5-0",\ "-eten-fixed-medium-r-normal--24-230-75-75-c-240-big5-0" #define NFONT_LIST_EUCKR "8x16", "9x18", "10x20", "12x24", "6x12", "7x14" #define MFONT_LIST_EUCKR \ "-daewoo-mincho-medium-r-normal--16-120-100-100-c-160-ksc5601.1987-0",\ "-baekmuk-batang-medium-r-normal--18-180-75-75-m-180-ksc5601.1987-0",\ "-baekmuk-batang-medium-r-normal--20-200-75-75-m-200-ksc5601.1987-0",\ "-daewoo-mincho-medium-r-normal--24-170-100-100-c-240-ksc5601.1987-0",\ "-baekmuk-batang-medium-r-normal--12-120-75-75-m-120-ksc5601.1987-0",\ "-baekmuk-batang-medium-r-normal--14-140-75-75-m-140-ksc5601.1987-0" #define MFONT_LIST_NULL NULL,NULL,NULL,NULL,NULL,NULL #endif /* MULTICHAR_SET */ #define NFONT_LIST_KOI8R \ "-misc-fixed-medium-r-normal--14-130-75-75-c-70-koi8-r",\ "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-koi8-r",\ "-misc-fixed-medium-r-normal--13-120-75-75-c-80-koi8-r",\ "-misc-fixed-medium-r-normal--15-140-75-75-c-90-koi8-r",\ "-misc-fixed-medium-r-normal--18-120-100-100-c-90-koi8-r",\ "-misc-fixed-medium-r-normal--20-200-75-75-c-100-koi8-r" #define NFONT_LIST_KOI8U \ "-cronyx-fixed-medium-r-normal--14-130-75-75-c-70-koi8-u",\ "-cronyx-fixed-medium-r-semicondensed--13-120-75-75-c-60-koi8-u",\ "-cronyx-fixed-medium-r-normal--13-120-75-75-c-80-koi8-u",\ "-cronyx-fixed-medium-r-normal--15-140-75-75-c-90-koi8-u",\ "-cronyx-fixed-medium-r-normal--18-120-100-100-c-90-koi8-u",\ "-cronyx-fixed-medium-r-normal--20-200-75-75-c-100-koi8-u" /* special common rule for ISO-8859-* */ #define NFONT_LIST_ISO8859X \ "-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-%d",\ "-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-%d",\ "-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso8859-%d",\ "-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-%d",\ "-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-%d",\ "-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-%d" #define NFONT_LIST_NULL NULL,NULL,NULL,NULL,NULL,NULL enum enc_label { ENC_NOENC, #ifdef MULTICHAR_SET ENC_SJIS , ENC_EUCJ, ENC_GB, ENC_GBK, ENC_GB18030, ENC_BIG5, ENC_EUCKR, #endif ENC_KOI8R, ENC_KOI8U, ENC_ISO8859_1, ENC_ISO8859_2, ENC_ISO8859_3, ENC_ISO8859_4, ENC_ISO8859_5, ENC_ISO8859_6, ENC_ISO8859_7, ENC_ISO8859_8, ENC_ISO8859_9, ENC_ISO8859_10, ENC_ISO8859_11, ENC_ISO8859_12, ENC_ISO8859_13, ENC_ISO8859_14, ENC_ISO8859_15, }; #endif /* __ENCODING_H__ */ mrxvt-0.5.4/src/debug.c0000644000175000001440000002036111014345561011640 00000000000000/*--------------------------------*-C-*---------------------------------* * File: debug.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 2007 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" uint32_t g_dbg_mask = 0L; uint32_t g_dbg_level = DBG_ERROR; static const char* dbg_level_name[DBG_LEVEL_MAX] = { "FATAL", "ERROR", "WARN", "INFO", "VERBOSE", "DEBUG", }; /* !!! Sync the list with the above definition of dbgmask_t !!! */ static const char* dbg_mask_name[DBG_IDX_MAX] = { "COMMAND", "SCREEN", "PTYTTY", "INIT", "MAIN", "LOGGING", "MACROS", "MENUBAR", "TABBAR", "SCROLLBAR", "IMAGES", "PIXMAP", "TRANSPARENT", "ENCODING", "GKRELOT", "MEMORY", "SESSION", "STRING", "RESOURCE", "XFTACS", "MISC", }; /* !!! Sync the list with the above definition of dbgmask_t !!! */ static dbgmask_t dbg_mask_map[DBG_IDX_MAX] = { DBG_COMMAND, DBG_SCREEN, DBG_PTYTTY, DBG_INIT, DBG_MAIN, DBG_LOGGING, DBG_MACROS, DBG_MENUBAR, DBG_TABBAR, DBG_SCROLLBAR, DBG_IMAGES, DBG_PIXMAP, DBG_TRANSPARENT, DBG_ENCODING, DBG_GKRELOT, DBG_MEMORY, DBG_SESSION, DBG_STRING, DBG_RESOURCE, DBG_XFTACS, DBG_MISC, }; /*----------------------------------------------------------------------*/ /* EXTPROTO */ int rxvt_msg (uint32_t level, uint32_t mask, const char* fmt, ...) { /* print fatal/error message regardless of its category */ if (level <= DBG_ERROR || /* print message unless its category and level are defined */ (g_dbg_level >= level && mask & g_dbg_mask)) { int len; va_list ap; va_start (ap, fmt); len = vfprintf (stderr, fmt, ap); va_end (ap); /* add a newline if last character of fmt is not a newline */ if( fmt[ STRLEN(fmt)-1 ] != '\n' ) { fputc( '\n', stderr ); len++; } return (len); } return 0; } /* INTPROTO */ static int rxvt_dbg_parse_masks (const char* maskstring) { int mask = 0; const char* ptr; if ('0' == maskstring[0] && ('x' == maskstring[1] || 'X' == maskstring[1])) { for (ptr = maskstring+2; *ptr; ptr++) { if (*ptr < '0' || *ptr > '9') return 0; /* invalid hex number */ mask = (mask << 4) + (*ptr - '0'); } if (ptr - maskstring > 32) return 0; /* mask hex too long */ } else { const char* pcoma; int len; ptr = pcoma = maskstring; do { while (*pcoma && ',' != *pcoma) pcoma ++; len = pcoma - ptr; if (0 == len) return 0; /* a single ',' without mask name */ if (len == sizeof ("COMMAND") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_COMMAND], ptr, len)) mask |= DBG_COMMAND; else if (len == sizeof ("SCREEN") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_SCREEN], ptr, len)) mask |= DBG_SCREEN; else if (len == sizeof ("PTYTTY") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_PTYTTY], ptr, len)) mask |= DBG_PTYTTY; else if (len == sizeof ("INIT") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_INIT], ptr, len)) mask |= DBG_INIT; else if (len == sizeof ("MAIN") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_MAIN], ptr, len)) mask |= DBG_MAIN; else if (len == sizeof ("LOGGING") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_LOGGING], ptr, len)) mask |= DBG_LOGGING; else if (len == sizeof ("MACROS") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_MACROS], ptr, len)) mask |= DBG_MACROS; else if (len == sizeof ("MENUBAR") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_MENUBAR], ptr, len)) mask |= DBG_MENUBAR; else if (len == sizeof ("TABBAR") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_TABBAR], ptr, len)) mask |= DBG_TABBAR; else if (len == sizeof ("SCROLLBAR") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_SCROLLBAR], ptr, len)) mask |= DBG_SCROLLBAR; else if (len == sizeof ("IMAGES") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_IMAGES], ptr, len)) mask |= DBG_IMAGES; else if (len == sizeof ("PIXMAP") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_PIXMAP], ptr, len)) mask |= DBG_PIXMAP; else if (len == sizeof ("TRANSPARENT") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_TRANSPARENT], ptr, len)) mask |= DBG_TRANSPARENT; else if (len == sizeof ("ENCODING") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_ENCODING], ptr, len)) mask |= DBG_ENCODING; else if (len == sizeof ("GKRELOT") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_GKRELOT], ptr, len)) mask |= DBG_GKRELOT; else if (len == sizeof ("MEMORY") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_MEMORY], ptr, len)) mask |= DBG_MEMORY; else if (len == sizeof ("SESSION") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_SESSION], ptr, len)) mask |= DBG_SESSION; else if (len == sizeof ("STRING") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_STRING], ptr, len)) mask |= DBG_STRING; else if (len == sizeof ("RESOURCE") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_RESOURCE], ptr, len)) mask |= DBG_RESOURCE; else if (len == sizeof ("XFTACS") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_XFTACS], ptr, len)) mask |= DBG_XFTACS; else if (len == sizeof ("MISC") -1 && 0 == STRNCASECMP (dbg_mask_name[DBG_IDX_MISC], ptr, len)) mask |= DBG_MISC; else if (len == sizeof ("ALL") -1 && 0 == STRNCASECMP ("ALL", ptr, len)) mask |= 0xffffffff; else { fprintf (stderr, "Error: unknown debug mask name %s\n", ptr); return 0; /* invalid mask name */ } if (!*pcoma) break; pcoma ++; ptr = pcoma; } while (*ptr); } g_dbg_mask = mask; return 1; } /* INTPROTO */ static int rxvt_dbg_parse_level (const char* levelstring) { int level; if ((char) 0 == *levelstring) return 0; if ('0' <= *levelstring && *levelstring <= '9') level = atoi (levelstring); else { for (level = 0; level < DBG_LEVEL_MAX; level ++) if (0 == STRCASECMP (dbg_level_name[level], levelstring)) break; } if (level < 0 || level >= DBG_LEVEL_MAX) return 0; g_dbg_level = level; return 1; } /* INTPROTO */ static void rxvt_dbg_usage (const char* argv) { int i; fprintf (stderr, "Usage: %s -dm dbg_masks -dl dbg_level\n", argv); fprintf (stderr, " Available debug masks values and their names are:\n"); for (i = 0; i < DBG_IDX_MAX; i ++) fprintf (stderr, " 0x%08x : %s\n", dbg_mask_map[i], dbg_mask_name[i]); fprintf (stderr, " 0xffffffff : ALL\n"); fprintf (stderr, " Available debug levels and their names are:\n"); for (i = 0; i < DBG_LEVEL_MAX; i ++) fprintf (stderr, " %d : %s\n", i, dbg_level_name[i]); } /* EXTPROTO */ void rxvt_parse_dbg_arguments (int argc, const char* const* argv) { int i; for (i = 0; i < argc - 1; i ++) { if (0 == STRCASECMP("-dmask", argv[i])) { if (!rxvt_dbg_parse_masks (argv[i+1])) { rxvt_dbg_usage (argv[0]); exit (1); } i ++; /* skip arguments to -dm option */ } if (0 == STRCASECMP("-dlevel", argv[i])) { if (!rxvt_dbg_parse_level (argv[i+1])) { rxvt_dbg_usage (argv[0]); exit (1); } i ++; /* skip arguments to -dl option */ } } #ifdef DEBUG fprintf (stderr, "Debug mask: 0x%08x, debug level: %d\n", g_dbg_mask, g_dbg_level); #endif } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/debug.h0000644000175000001440000000707610756127602011663 00000000000000/*--------------------------------*-H-*---------------------------------* * File: debug.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 2007 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __DEBUG_H__ #define __DEBUG_H__ /* Debug level definition. * fatal : fatal error, mrxvt must abort immediately * error : serious error, mrxvt should gracefully exit * warn : some problems cause certain function of mrxvt not working * info : informative messages about mrxvt execution * verbose: verbose information about mrxvt that is useful for developers * debug : more information about mrxvt that is useful for developers */ typedef enum { DBG_FATAL = 0, DBG_ERROR, DBG_WARN, DBG_INFO, DBG_VERBOSE, /* used by rxvt_dbgmsg macro */ DBG_DEBUG, /* used by rxvt_dbgmsg macro */ DBG_LEVEL_MAX, } dbglevel_t; typedef enum { DBG_COMMAND = 0x00000001, DBG_SCREEN = 0x00000002, DBG_PTYTTY = 0x00000004, DBG_INIT = 0x00000008, DBG_MAIN = 0x00000010, DBG_LOGGING = 0x00000020, DBG_MACROS = 0x00000040, DBG_MENUBAR = 0x00000080, DBG_TABBAR = 0x00000100, DBG_SCROLLBAR = 0x00000200, DBG_IMAGES = 0x00000400, DBG_PIXMAP = 0x00000800, DBG_TRANSPARENT = 0x00001000, DBG_ENCODING = 0x00002000, DBG_GKRELOT = 0x00004000, DBG_MEMORY = 0x00008000, DBG_SESSION = 0x00010000, DBG_STRING = 0x00020000, DBG_RESOURCE = 0x00040000, DBG_XFTACS = 0x00080000, DBG_MISC = 0x00100000, } dbgmask_t; /* !!! Sync the list with the above definition of dbgmask_t !!! */ typedef enum { DBG_IDX_COMMAND = 0, DBG_IDX_SCREEN, DBG_IDX_PTYTTY, DBG_IDX_INIT, DBG_IDX_MAIN, DBG_IDX_LOGGING, DBG_IDX_MACROS, DBG_IDX_MENUBAR, DBG_IDX_TABBAR, DBG_IDX_SCROLLBAR, DBG_IDX_IMAGES, DBG_IDX_PIXMAP, DBG_IDX_TRANSPARENT, DBG_IDX_ENCODING, DBG_IDX_GKRELOT, DBG_IDX_MEMORY, DBG_IDX_SESSION, DBG_IDX_STRING, DBG_IDX_RESOURCE, DBG_IDX_XFTACS, DBG_IDX_MISC, DBG_IDX_MAX, } dbgmask_index_t; /* * rxvt_dbgmsg macro is used for DBG_DEBUG and DBG_VERBOSE level only. * for other level of information, you should call rxvt_msg directly. * * Note: the call of rxvt_dbgmsg is different to the call of rxvt_msg! * rxvt_dbgmsg ((argument list)); * rxvt_msg (argument list); */ #ifdef DEBUG # define rxvt_dbgmsg(x) rxvt_msg x #else # define rxvt_dbgmsg(x) #endif /* * For temporary debugging (so that only certain messages can be enabled). */ #define rxvt_dbgtmsg(x) rxvt_msg x #endif /* __DEBUG_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/left_d.xpm0000644000175000001440000000077210756127602012403 00000000000000/* XPM */ static char * left_d_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #8585F8", "..................", "..................", "..................", "............+.....", "...........++.....", "..........+++.....", ".........++++.....", "........+++++.....", ".......++++++.....", "......+++++++.....", ".......++++++.....", "........+++++.....", ".........++++.....", "..........+++.....", "...........++.....", "............+.....", "..................", ".................."}; mrxvt-0.5.4/src/scrollbar-next.c0000644000175000001440000003564710756127602013534 00000000000000/*--------------------------------*-C-*---------------------------------* * File: scrollbar-next.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1998 Alfredo K. Kojima * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ #ifdef HAVE_SCROLLBARS #ifdef NEXT_SCROLLBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL)) #define TILEGC (r->scrollBar.next_stippleGC) #define DIMPLE (r->scrollBar.next_dimple) #define UPARROW (r->scrollBar.next_upArrow) #define HIUPARROW (r->scrollBar.next_upArrowHi) #define DNARROW (r->scrollBar.next_downArrow) #define HIDNARROW (r->scrollBar.next_downArrowHi) #define n_stp_width 8 #define n_stp_height 2 const unsigned char n_stp_bits[] = { 0x55, 0xaa }; /* * N*XTSTEP like scrollbar - written by Alfredo K. Kojima */ #define DIMPLE_WIDTH 6 #define DIMPLE_HEIGHT 6 #define ARROW_WIDTH 11 #define ARROW_HEIGHT 13 const char *const SCROLLER_DIMPLE[] = { ".%###.", "%#%%%%", "#%%...", "#%.. ", "#%. ", ".%. ." }; const char *const SCROLLER_ARROW_UP[] = { "...........", "...........", ".....%.....", ".....#.....", "....%#%....", "....###....", "...%###%...", "...#####...", "..%#####%..", "..#######..", ".%#######%.", "...........", "..........." }; const char *const SCROLLER_ARROW_DOWN[] = { "...........", "...........", ".%#######%.", "..#######..", "..%#####%..", "...#####...", "...%###%...", "....###....", "....%#%....", ".....#.....", ".....%.....", "...........", "..........." }; const char *const HI_SCROLLER_ARROW_UP[] = { " ", " ", " % ", " % ", " %%% ", " %%% ", " %%%%% ", " %%%%% ", " %%%%%%% ", " %%%%%%% ", " %%%%%%%%% ", " ", " " }; const char *const HI_SCROLLER_ARROW_DOWN[] = { " ", " ", " %%%%%%%%% ", " %%%%%%% ", " %%%%%%% ", " %%%%% ", " %%%%% ", " %%% ", " %%% ", " % ", " % ", " ", " " }; /* INTPROTO */ static Pixmap rxvt_render_pixmap(rxvt_t *r, const char *const *data, int width, int height) { char a; int x, y; Pixmap d; unsigned long pointcolour; d = XCreatePixmap (r->Xdisplay, r->scrollBar.win, width, height, XDEPTH); if (NOT_PIXMAP(d)) return None; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { if ((a = data[y][x]) == ' ' || a == 'w') pointcolour = r->scrollBar.next_white; else if (a == '.' || a == 'l') pointcolour = r->scrollBar.next_bg; else if (a == '%' || a == 'd') pointcolour = r->scrollBar.next_dark; else /* if (a == '#' || a == 'b' || a) */ pointcolour = r->scrollBar.next_fg; CHOOSE_GC_FG(r, pointcolour); XDrawPoint(r->Xdisplay, d, r->scrollBar.gc, x, y); } } return d; } /* EXTPROTO */ void rxvt_scrollbar_init_next (rxvt_t *r) { XGCValues gcvalue; unsigned long gcmask; XColor xcol; Pixmap stipple; UNSET_GC(TILEGC); UNSET_PIXMAP(DIMPLE); gcvalue.graphics_exposures = False; /* Initialize the colors */ r->scrollBar.next_fg = r->pixColorsFocus[Color_Black]; xcol.red = 0xaeba; xcol.green = 0xaaaa; xcol.blue = 0xaeba; if (!rxvt_alloc_color(r, &xcol, "light gray")) xcol.pixel = r->pixColorsFocus[Color_AntiqueWhite]; r->scrollBar.next_bg = xcol.pixel; r->scrollBar.next_white = r->pixColorsFocus[Color_White]; xcol.red = 0x51aa; xcol.green = 0x5555; xcol.blue = 0x5144; if (!rxvt_alloc_color(r, &xcol, "dark gray")) xcol.pixel = r->pixColorsFocus[Color_Grey25]; r->scrollBar.next_dark = xcol.pixel; /* Create scrollBar GC */ gcvalue.foreground = r->scrollBar.next_fg; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcvalue.background = r->scrollBar.next_bg; gcmask = GCForeground; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcmask |= GCBackground; r->scrollBar.gc = XCreateGC (r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(r->scrollBar.gc)); /* Create stipple GC */ stipple = XCreateBitmapFromData(r->Xdisplay, r->scrollBar.win, (char *)n_stp_bits, n_stp_width, n_stp_height); if (IS_PIXMAP(stipple)) { gcvalue.foreground = r->scrollBar.next_dark; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcvalue.background = r->scrollBar.next_bg; gcvalue.fill_style = FillOpaqueStippled; gcvalue.stipple = stipple; gcmask = GCForeground | GCStipple | GCFillStyle; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcmask |= GCBackground; TILEGC = XCreateGC(r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(TILEGC)); } /* Create pixmaps */ DIMPLE = rxvt_render_pixmap(r, SCROLLER_DIMPLE, DIMPLE_WIDTH, DIMPLE_HEIGHT); assert (IS_PIXMAP(DIMPLE)); UPARROW = rxvt_render_pixmap(r, SCROLLER_ARROW_UP, ARROW_WIDTH, ARROW_HEIGHT); assert (IS_PIXMAP(UPARROW)); HIUPARROW = rxvt_render_pixmap(r, HI_SCROLLER_ARROW_UP, ARROW_WIDTH, ARROW_HEIGHT); assert (IS_PIXMAP(HIUPARROW)); DNARROW = rxvt_render_pixmap(r, SCROLLER_ARROW_DOWN, ARROW_WIDTH, ARROW_HEIGHT); assert (IS_PIXMAP(DNARROW)); HIDNARROW = rxvt_render_pixmap(r, HI_SCROLLER_ARROW_DOWN, ARROW_WIDTH, ARROW_HEIGHT); assert (IS_PIXMAP(HIDNARROW)); #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif XSetWindowBackground (r->Xdisplay, r->scrollBar.win, r->scrollBar.next_bg); } /* EXTPROTO */ void rxvt_scrollbar_exit_next (rxvt_t *r) { if (IS_GC(r->scrollBar.next_stippleGC)) { XFreeGC (r->Xdisplay, r->scrollBar.next_stippleGC); UNSET_GC(r->scrollBar.next_stippleGC); } if (IS_PIXMAP(r->scrollBar.next_dimple)) { XFreePixmap (r->Xdisplay, r->scrollBar.next_dimple); UNSET_PIXMAP(r->scrollBar.next_dimple); } if (IS_PIXMAP(r->scrollBar.next_upArrow)) { XFreePixmap (r->Xdisplay, r->scrollBar.next_upArrow); UNSET_PIXMAP(r->scrollBar.next_upArrow); } if (IS_PIXMAP(r->scrollBar.next_upArrowHi)) { XFreePixmap (r->Xdisplay, r->scrollBar.next_upArrowHi); UNSET_PIXMAP(r->scrollBar.next_upArrowHi); } if (IS_PIXMAP(r->scrollBar.next_downArrow)) { XFreePixmap (r->Xdisplay, r->scrollBar.next_downArrow); UNSET_PIXMAP(r->scrollBar.next_downArrow); } if (IS_PIXMAP(r->scrollBar.next_downArrowHi)) { XFreePixmap (r->Xdisplay, r->scrollBar.next_downArrowHi); UNSET_PIXMAP(r->scrollBar.next_downArrowHi); } } /* Draw bevel & arrows */ /* INTPROTO */ static void next_draw_bevel (rxvt_t *r, Drawable d, int x1, int y1, int w, int h) { int x2, y2; x2 = x1 + w - 1; /* right point */ y2 = y1 + h - 1; /* bottom point */ /* white top and left */ CHOOSE_GC_FG(r, r->scrollBar.next_white); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x1, y1, x2, y1); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x1, y1, x1, y2); /* black bottom and right */ CHOOSE_GC_FG(r, r->scrollBar.next_fg); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x1, y2, x2, y2); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x2, y1, x2, y2); /* dark inside bottom and right */ CHOOSE_GC_FG(r, r->scrollBar.next_dark); x1++, y1++, x2--, y2--; /* move in one point */ XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x1, y2, x2, y2); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x2, y1, x2, y2); } /* EXTPROTO */ int rxvt_scrollbar_show_next(rxvt_t *r, int update, int last_top, int last_bot, int scroller_len) { int height; Drawable s; int page = ATAB(r); height = r->scrollBar.end + NEXT_SB_TBTN_HEIGHT + NEXT_SB_PAD; if (PVTS(r, page)->nscrolled == 0 || !update) { XClearArea (r->Xdisplay, r->scrollBar.win, 0, 0, SB_WIDTH_NEXT + 1, height, False); CHOOSE_GC_FG(r, r->scrollBar.next_fg); XDrawRectangle(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, NEXT_SB_BD_WIDTH, SB_WIDTH_NEXT, height + NEXT_SB_BD_WIDTH); # ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) # endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif XFillRectangle(r->Xdisplay, r->scrollBar.win, TILEGC, NEXT_SB_LPAD, 0, NEXT_SB_BTN_WIDTH, height); } if (PVTS(r, page)->nscrolled) { if (last_top < r->scrollBar.top || !update) { /* ** Area above the scroller */ # ifdef TRANSPARENT /* clear background when there's transparent */ if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) XClearArea (r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, NEXT_SB_PAD + last_top, NEXT_SB_BTN_WIDTH, r->scrollBar.top - last_top, False); else # endif # ifdef BACKGROUND_IMAGE /* clear background when there's bg image */ if (IS_PIXMAP(r->scrollBar.pixmap)) XClearArea (r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, NEXT_SB_PAD + last_top, NEXT_SB_BTN_WIDTH, r->scrollBar.top - last_top, False); else # endif XFillRectangle(r->Xdisplay, r->scrollBar.win, TILEGC, NEXT_SB_LPAD, NEXT_SB_PAD + last_top, NEXT_SB_BTN_WIDTH, r->scrollBar.top - last_top); } if (r->scrollBar.bot < last_bot || !update) { /* ** Area above the buttons but below the scroller */ # ifdef TRANSPARENT /* clear background when there's transparent */ if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) XClearArea(r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, r->scrollBar.bot + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, (last_bot - r->scrollBar.bot), False); else # endif # ifdef BACKGROUND_IMAGE /* clear background when there's bg image */ if (IS_PIXMAP(r->scrollBar.pixmap)) XClearArea (r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, r->scrollBar.bot + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, (last_bot - r->scrollBar.bot), False); else # endif XFillRectangle(r->Xdisplay, r->scrollBar.win, TILEGC, NEXT_SB_LPAD, r->scrollBar.bot + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, (last_bot - r->scrollBar.bot)); } /* ** Area of the scroller */ # ifdef TRANSPARENT /* clear background when there's transparent */ if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) XClearArea (r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, r->scrollBar.top + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, scroller_len/*-NEXT_SB_BTN_HEIGHT*/, False); else # endif # ifdef BACKGROUND_IMAGE /* clear background when there's bg image */ if (IS_PIXMAP(r->scrollBar.pixmap)) XClearArea (r->Xdisplay, r->scrollBar.win, NEXT_SB_LPAD, r->scrollBar.top + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, scroller_len/*-NEXT_SB_BTN_HEIGHT*/, False); else # endif { CHOOSE_GC_FG(r, r->scrollBar.next_bg); XFillRectangle(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, NEXT_SB_LPAD, r->scrollBar.top + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, scroller_len/*-NEXT_SB_BTN_HEIGHT*/); } /* ** Here comes the dimple in the scroller */ CHOOSE_GC_FG(r, r->scrollBar.next_white); XCopyArea(r->Xdisplay, DIMPLE, r->scrollBar.win, r->scrollBar.gc, 0, 0, DIMPLE_WIDTH, DIMPLE_HEIGHT, (SB_WIDTH_NEXT - DIMPLE_WIDTH) / 2, r->scrollBar.top + NEXT_BEVEL_ULEFT_WIDTH + (scroller_len - DIMPLE_HEIGHT) / 2); /* ** Bevel around the scroller */ next_draw_bevel(r, r->scrollBar.win, NEXT_BEVEL_X, r->scrollBar.top + NEXT_SB_PAD, NEXT_SB_BTN_WIDTH, scroller_len); /* ** Bevel around the buttons */ next_draw_bevel(r, r->scrollBar.win, NEXT_BEVEL_X, height - NEXT_SB_DBTN_HEIGHT, NEXT_SB_BTN_WIDTH, NEXT_SB_BTN_HEIGHT); next_draw_bevel(r, r->scrollBar.win, NEXT_BEVEL_X, height - NEXT_SB_SBTN_HEIGHT, NEXT_SB_BTN_WIDTH, NEXT_SB_BTN_HEIGHT); /* ** Top button */ CHOOSE_GC_FG(r, r->scrollBar.next_white); s = (scrollbar_isUp()) ? HIUPARROW : UPARROW; XCopyArea(r->Xdisplay, s, r->scrollBar.win, r->scrollBar.gc, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, NEXT_BTN_FACE_X, height-NEXT_SB_DBTN_HEIGHT+NEXT_BEVEL_ULEFT_WIDTH); /* ** Bottom button */ s = (scrollbar_isDn()) ? HIDNARROW : DNARROW; XCopyArea(r->Xdisplay, s, r->scrollBar.win, r->scrollBar.gc, 0, 0, ARROW_WIDTH, ARROW_HEIGHT, NEXT_BTN_FACE_X, height-NEXT_SB_SBTN_HEIGHT+NEXT_BEVEL_ULEFT_WIDTH); } return 1; } #endif /* NEXT_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/scrollbar-sgi.c0000644000175000001440000004006010756127602013321 00000000000000 /*--------------------------------*-C-*---------------------------------* * File: scrollbar-sgi.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1998 Alfredo K. Kojima * Copyright (c) 1998 Sasha Vasko * Copyright (c) 2000 Frank Everdij * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ #ifdef HAVE_SCROLLBARS #ifdef SGI_SCROLLBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL)) static char *SCROLLER_DIMPLE[] = { " ", "############", ".==========%", ".==========%", " ", "############", ".==========%", ".==========%", " ", "############" }; #define SCROLLER_DIMPLE_WIDTH 12 #define SCROLLER_DIMPLE_HEIGHT 10 static char *SCROLLER_ARROW_UP[] = { "============", "============", "=====*======", "=====**=====", "=====**=====", "====****====", "====****====", "===******===", "===******===", "==********==", "==********==", "============", "============", "============" }; static char *SCROLLER_ARROW_DOWN[] = { "============", "============", "=*********==", "==********==", "==********==", "===******===", "===******===", "====****====", "====****====", "=====**=====", "=====**=====", "============", "============", "============" }; static char *LO_SCROLLER_ARROW_UP[] = { "============", "============", "=====-======", "=====--=====", "=====--=====", "====----====", "====----====", "===------===", "===------===", "==--------==", "==--------==", "============", "============", "============" }; static char *LO_SCROLLER_ARROW_DOWN[] = { "============", "============", "=---------==", "==--------==", "==--------==", "===------===", "===------===", "====----====", "====----====", "=====--=====", "=====--=====", "============", "============", "============" }; static char *HI_SCROLLER_ARROW_UP[] = { " ", " ", " % ", " %% ", " %% ", " %%%% ", " %%%% ", " %%%%%% ", " %%%%%% ", " %%%%%%%% ", " %%%%%%%% ", " ", " ", " " }; static char *HI_SCROLLER_ARROW_DOWN[] = { " ", " ", " %%%%%%%%% ", " %%%%%%%% ", " %%%%%%%% ", " %%%%%% ", " %%%%%% ", " %%%% ", " %%%% ", " %% ", " %% ", " ", " ", " " }; #define ARROW_SOURCE_WIDTH 12 #define ARROW_SOURCE_HEIGHT 14 #ifndef SCROLL_SHADOW_HEIGHT # define SCROLL_SHADOW_HEIGHT 1 #endif /* end unconfigurable stuff */ #define stp_width 8 #define stp_height 8 static unsigned char stp_bits[] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa}; /* INTPROTO */ static Pixmap create_icon (rxvt_t* r, char **data, int sx, int sy, unsigned int width, unsigned int height) { register int i, k; register int x, y; unsigned long pixel; Pixmap pixmap; pixmap = XCreatePixmap (r->Xdisplay, r->scrollBar.win, width, height, XDEPTH); if (NOT_PIXMAP(pixmap)) return None; y = sy; for (i = 0; i < height ; y++, i++ ) { x = sx ; for (k = 0; k < width ; k++, x++ ) { switch (data[y][x]) { case ' ': case 'w': pixel = r->scrollBar.sgi_white; break; case '.': case 'l': pixel = r->scrollBar.sgi_fg; break; case '-': case 'g': pixel = r->scrollBar.sgi_lmedium; break; case '%': case 'd': pixel = r->scrollBar.sgi_dark; break; case '*': case 'v': pixel = r->scrollBar.sgi_vdark; break; case '#': case 'b': pixel = r->scrollBar.sgi_black; break; case '=': case 'm': default: pixel = r->scrollBar.sgi_bg; break; } CHOOSE_GC_FG(r, pixel); XDrawPoint (r->Xdisplay, pixmap, r->scrollBar.gc, k, i); } } return (pixmap); } /* Draw bevel & arrows */ /* INTPROTO */ static void sgi_draw_bevel (rxvt_t* r, Drawable d, int x, int y, int w, int h) { CHOOSE_GC_FG(r, r->scrollBar.sgi_fg); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x, y, x+w, y); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x, y, x, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+1, x+w-1, y+1); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+1, x+1, y+h-1); CHOOSE_GC_FG(r, r->scrollBar.sgi_dark); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+w, y+1, x+w, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+1, y+h, x+w, y+h); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+w-1, y+2, x+w-1, y+h-1); XDrawLine(r->Xdisplay, d, r->scrollBar.gc, x+2, y+h-1, x+w-1, y+h-1); } /* INTPROTO */ static void scrollbar_fill_back (rxvt_t* r, unsigned int height) { /* fill background */ XClearArea (r->Xdisplay, r->scrollBar.win, 0, SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI, height, False); /* fill top button space */ CHOOSE_GC_FG(r, r->scrollBar.sgi_fg); XFillRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, 0, SB_WIDTH_SGI, SGI_SB_BUTTON_HEIGHT); /* fill bottom button space */ XFillRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, height+SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI, SGI_SB_BUTTON_HEIGHT); CHOOSE_GC_FG(r, r->scrollBar.sgi_dark); /* right vertical border line */ XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, SB_WIDTH_SGI-1, 0, SB_WIDTH_SGI-1, height+SGI_SB_BUTTONS_HEIGHT); /* bottom horizontal line */ XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 2, height+SGI_SB_BUTTONS_HEIGHT-1, SB_WIDTH_SGI, height+SGI_SB_BUTTONS_HEIGHT-1); } /* EXTPROTO */ void rxvt_scrollbar_init_sgi (rxvt_t* r) { XGCValues gcvalue; unsigned long gcmask; Pixmap stipple; XColor xcol; unsigned int x_offset, y_offset; /* Initialize colors */ r->scrollBar.sgi_black = BlackPixelOfScreen(DefaultScreenOfDisplay(r->Xdisplay)); r->scrollBar.sgi_white = WhitePixelOfScreen(DefaultScreenOfDisplay(r->Xdisplay)); /* alloc light gray */ xcol.red = 0xde00; xcol.green = 0xde00; xcol.blue = 0xde00; if (!rxvt_alloc_color (r, &xcol, "light gray")) { #ifndef NO_BRIGHTCOLOR r->scrollBar.sgi_fg = r->pixColorsFocus [Color_AntiqueWhite]; #else r->scrollBar.sgi_fg = r->pixColorsFocus [Color_White]; #endif } else r->scrollBar.sgi_fg = xcol.pixel; /* alloc light medium gray */ xcol.red = 0xaa00; xcol.green = 0xaa00; xcol.blue = 0xaa00; if (!rxvt_alloc_color (r, &xcol, "light medium gray")) { #ifndef NO_BRIGHTCOLOR r->scrollBar.sgi_lmedium = r->pixColorsFocus [Color_AntiqueWhite]; #else r->scrollBar.sgi_lmedium = r->pixColorsFocus [Color_White]; #endif } else r->scrollBar.sgi_lmedium = xcol.pixel; /* alloc medium gray */ xcol.red = 0xbd00; xcol.green = 0xbd00; xcol.blue = 0xbd00; if (!rxvt_alloc_color (r, &xcol, "medium gray")) { #ifndef NO_BRIGHTCOLOR r->scrollBar.sgi_bg = r->pixColorsFocus [Color_Black]; #else r->scrollBar.sgi_bg = r->pixColorsFocus [Color_Grey50]; #endif } else r->scrollBar.sgi_bg = xcol.pixel; /* alloc dark gray */ xcol.red = 0x8e00; xcol.green = 0x8e00; xcol.blue = 0x8e00; if (!rxvt_alloc_color (r, &xcol, "dark gray")) { #ifndef NO_BRIGHTCOLOR r->scrollBar.sgi_dark = r->pixColorsFocus [Color_Grey25]; #else r->scrollBar.sgi_dark = r->pixColorsFocus [Color_Black]; #endif } r->scrollBar.sgi_dark = xcol.pixel; /* alloc very dark gray */ xcol.red = 0x5e00; xcol.green = 0x5e00; xcol.blue = 0x5e00; if (!rxvt_alloc_color (r, &xcol, "very dark gray")) { #ifndef NO_BRIGHTCOLOR r->scrollBar.sgi_vdark = r->pixColorsFocus [Color_Grey25]; #else r->scrollBar.sgi_vdark = r->pixColorsFocus [Color_Black]; #endif } r->scrollBar.sgi_vdark = xcol.pixel; /* Create GCs */ gcvalue.foreground = r->scrollBar.sgi_white; gcmask = GCForeground; r->scrollBar.gc = XCreateGC (r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); stipple = XCreateBitmapFromData(r->Xdisplay, r->scrollBar.win, (const char*) stp_bits, stp_width, stp_height); assert (IS_PIXMAP(stipple)); gcvalue.foreground = r->scrollBar.sgi_dark; gcvalue.background = r->scrollBar.sgi_bg; gcvalue.fill_style = FillStippled; gcvalue.stipple = stipple; gcmask = GCForeground | GCBackground | GCStipple | GCFillStyle; r->scrollBar.sgi_stippleGC = XCreateGC(r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(r->scrollBar.sgi_stippleGC)); /* Create icons */ r->scrollBar.sgi_dimple = create_icon (r, SCROLLER_DIMPLE, 0, 0, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT); assert (IS_PIXMAP(r->scrollBar.sgi_dimple)); x_offset = y_offset = (ARROW_SOURCE_WIDTH-SGI_ARROW_WIDTH)>>1; r->scrollBar.sgi_upArrow = create_icon (r, SCROLLER_ARROW_UP, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); r->scrollBar.sgi_upArrowHi = create_icon (r, HI_SCROLLER_ARROW_UP, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); r->scrollBar.sgi_upArrowLow = create_icon (r, LO_SCROLLER_ARROW_UP, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); r->scrollBar.sgi_downArrow = create_icon (r, SCROLLER_ARROW_DOWN, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); r->scrollBar.sgi_downArrowHi = create_icon (r, HI_SCROLLER_ARROW_DOWN, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); r->scrollBar.sgi_downArrowLow = create_icon (r, LO_SCROLLER_ARROW_DOWN, x_offset, y_offset, ARROW_SOURCE_WIDTH, ARROW_SOURCE_HEIGHT); #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif XSetWindowBackground (r->Xdisplay, r->scrollBar.win, r->scrollBar.sgi_bg); } /* EXTPROTO */ void rxvt_scrollbar_exit_sgi (rxvt_t* r) { if (IS_GC(r->scrollBar.sgi_stippleGC)) { XFreeGC (r->Xdisplay, r->scrollBar.sgi_stippleGC); UNSET_GC(r->scrollBar.sgi_stippleGC); } if (IS_PIXMAP(r->scrollBar.sgi_dimple)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_dimple); UNSET_PIXMAP(r->scrollBar.sgi_dimple); } if (IS_PIXMAP(r->scrollBar.sgi_upArrow)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_upArrow); UNSET_PIXMAP(r->scrollBar.sgi_upArrow); } if (IS_PIXMAP(r->scrollBar.sgi_upArrowHi)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_upArrowHi); UNSET_PIXMAP(r->scrollBar.sgi_upArrowHi); } if (IS_PIXMAP(r->scrollBar.sgi_upArrowLow)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_upArrowLow); UNSET_PIXMAP(r->scrollBar.sgi_upArrowLow); } if (IS_PIXMAP(r->scrollBar.sgi_downArrow)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_downArrow); UNSET_PIXMAP(r->scrollBar.sgi_downArrow); } if (IS_PIXMAP(r->scrollBar.sgi_downArrowHi)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_downArrowHi); UNSET_PIXMAP(r->scrollBar.sgi_downArrowHi); } if (IS_PIXMAP(r->scrollBar.sgi_downArrowLow)) { XFreePixmap (r->Xdisplay, r->scrollBar.sgi_downArrowLow); UNSET_PIXMAP(r->scrollBar.sgi_downArrowLow); } } /* EXTPROTO */ int rxvt_scrollbar_show_sgi (rxvt_t* r, int update, int last_top, int last_bot, int scroller_len) { register int new_height = r->scrollBar.end + SGI_SB_BUTTON_HEIGHT + ((r->sb_shadow) << 1); if (!update) scrollbar_fill_back (r, r->scrollBar.end); if (0 == AVTS(r)->nscrolled) { /* top button */ XCopyArea (r->Xdisplay, r->scrollBar.sgi_upArrowLow, r->scrollBar.win, r->scrollBar.gc, /* src x, y, width, height */ 0, 0, SGI_ARROW_WIDTH, SGI_ARROW_HEIGHT, /* dst x, y */ ((SB_WIDTH_SGI)>>1)-(SGI_ARROW_WIDTH>>1)+1, SGI_BEVEL_SIZE); /* bottom button */ XCopyArea (r->Xdisplay, r->scrollBar.sgi_downArrowLow, r->scrollBar.win, r->scrollBar.gc, /* src x, y, width, height */ 0, 0, SGI_ARROW_WIDTH, SGI_ARROW_HEIGHT, /* dst x, y */ ((SB_WIDTH_SGI)>>1)-(SGI_ARROW_WIDTH>>1)+1, new_height - SGI_ARROW_HEIGHT - SGI_BEVEL_SIZE); } else { /* (AVTS(r)->nscrolled > 0) */ rxvt_dbgmsg ((DBG_DEBUG, DBG_SCROLLBAR, "top=%d, bot=%d, last_top=%d, last_bot=%d\n", r->scrollBar.top, r->scrollBar.bot, last_top, last_bot)); if (last_top < r->scrollBar.top) XClearArea (r->Xdisplay, r->scrollBar.win, 0, last_top, SB_WIDTH_SGI-1, (last_top - r->scrollBar.top), False); if (r->scrollBar.bot < last_bot) XClearArea (r->Xdisplay, r->scrollBar.win, 0, r->scrollBar.bot, SB_WIDTH_SGI-1, (last_bot - r->scrollBar.bot + 1), False); XClearArea (r->Xdisplay, r->scrollBar.win, 0, r->scrollBar.top, SB_WIDTH_SGI-1, scroller_len, False); /* scroller frame */ CHOOSE_GC_FG(r, r->scrollBar.sgi_vdark); XDrawRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, r->scrollBar.top, SB_WIDTH_SGI-1, scroller_len); /* bevel of scroller, inside scroller frame */ sgi_draw_bevel (r, r->scrollBar.win, 1, r->scrollBar.top+1, SB_WIDTH_SGI-3, scroller_len-2); /* sgi_draw_bevel (r, r->scrollBar.win, 0, 0, SB_WIDTH_SGI-1, SGI_SB_BUTTON_HEIGHT); sgi_draw_bevel (r, r->scrollBar.win, 0, new_height-SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI-1, SGI_SB_BUTTON_HEIGHT); */ /* dimple */ XCopyArea (r->Xdisplay, r->scrollBar.sgi_dimple, r->scrollBar.win, r->scrollBar.gc, 0, 0, SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT, ((SB_WIDTH_SGI)>>1)-(SCROLLER_DIMPLE_WIDTH>>1)+1, r->scrollBar.top + ((scroller_len-SCROLLER_DIMPLE_HEIGHT)>>1)); /* top button */ XCopyArea (r->Xdisplay, (scrollbar_isUp()) ? r->scrollBar.sgi_upArrowHi : r->scrollBar.sgi_upArrow, r->scrollBar.win, r->scrollBar.gc, /* src x, y, width, height */ 0, 0, SGI_ARROW_WIDTH, SGI_ARROW_HEIGHT, /* dst x, y */ ((SB_WIDTH_SGI)>>1)-(SGI_ARROW_WIDTH>>1)+1, SGI_BEVEL_SIZE); /* bottom button */ XCopyArea (r->Xdisplay, (scrollbar_isDn()) ? r->scrollBar.sgi_downArrowHi : r->scrollBar.sgi_downArrow, r->scrollBar.win, r->scrollBar.gc, /* src x, y, width, height */ 0, 0, SGI_ARROW_WIDTH, SGI_ARROW_HEIGHT, /* dst x, y */ ((SB_WIDTH_SGI)>>1)-(SGI_ARROW_WIDTH>>1)+1, new_height - SGI_ARROW_HEIGHT - SGI_BEVEL_SIZE); } /* bottom line of top button */ CHOOSE_GC_FG(r, r->scrollBar.sgi_fg); XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, SGI_SB_BUTTON_HEIGHT-1, SB_WIDTH_SGI-1, SGI_SB_BUTTON_HEIGHT-1); /* top line of bottom button */ XDrawLine (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, 0, new_height-SGI_SB_BUTTON_HEIGHT, SB_WIDTH_SGI-1, new_height-SGI_SB_BUTTON_HEIGHT); return 1; } #endif /* SGI_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/menubar.c0000644000175000001440000017560311013341424012206 00000000000000/*--------------------------------*-C-*---------------------------------* * File: menubar.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 2004 Jingmin Zhou * Copyright (c) 2005-6 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #define NEWARGLIM 500 #ifdef HAVE_MENUBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->menuBar.gc, (PIXCOL)) #define TRIANGLE_WIDTH (HEIGHT_TEXT * 3 / 5 - 2 * SHADOW) /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ menuitem_t* rxvt_menuitem_find (const menu_t*, const unsigned char*); void rxvt_menuitem_free (rxvt_t*, menu_t*, menuitem_t*); /* int rxvt_action_type (action_t*, unsigned char*); */ /* int rxvt_action_dispatch (rxvt_t*, action_t*); */ int rxvt_menuarrow_find (char); void rxvt_menuarrow_free (rxvt_t*, unsigned char); void rxvt_menuarrow_add (rxvt_t*, unsigned char*); menuitem_t* rxvt_menuitem_add (rxvt_t*, menu_t*, const unsigned char*, const unsigned char*, const unsigned char*); unsigned char* rxvt_menu_find_base (rxvt_t*, menu_t**, unsigned char*); menu_t* rxvt_menu_delete (rxvt_t*, menu_t*); menu_t* rxvt_menu_add (rxvt_t*, menu_t*, unsigned char*); void rxvt_drawbox_menubar (rxvt_t*, int, int, int); void rxvt_menubar_draw_triangle (rxvt_t*, int, int, int); void rxvt_drawbox_menuitem (rxvt_t*, int, int); void rxvt_build_tablist (rxvt_t*, menu_t *); void rxvt_menu_display (rxvt_t*, void (*update)(rxvt_t*)); void rxvt_menu_hide_all (rxvt_t*); void rxvt_menu_hide (rxvt_t*); void rxvt_menu_clear (rxvt_t*, menu_t*); void rxvt_menubar_clear (rxvt_t*); void rxvt_draw_arrows (rxvt_t*, int, int); void rxvt_menubar_select (rxvt_t*, XButtonEvent*); void rxvt_menubar_draw_labels (rxvt_t*); void resizeSubMenus (rxvt_t*, menu_t*); #ifdef DEBUG void rxvt_print_menu_ancestors (menu_t*); void rxvt_print_menu_descendants (menu_t*); #endif /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ static const struct { const char name; /* (l)eft, (u)p, (d)own, (r)ight */ const unsigned char str[5]; /* str[0] = STRLEN (str+1) */ } Arrows[NARROWS] = { { 'l', "\003\033[D" }, { 'u', "\003\033[A" }, { 'd', "\003\033[B" }, { 'r', "\003\033[C" } }; #ifdef XFT_SUPPORT #define PTEXTWIDTH( R, s, len) \ ( (ISSET_OPTION(R, Opt_xft) && r->TermWin.xftpfont ) ? \ ( xftPfontTextWidth( (R), (s), (len)) ) : \ Width2Pixel(len)) int xftPfontTextWidth( rxvt_t *r, const unsigned char *s, int len) { if( s && len ) { XGlyphInfo ginfo; XftTextExtents8( r->Xdisplay, r->TermWin.xftpfont, s, len, &ginfo); return ginfo.width; } else return 0; } # else # define PTEXTWIDTH( r, s, len) (Width2Pixel((len))) #endif #define MENUWIDTH( menu ) \ ( MENU_ITEM_WIDTH( (menu)->lwidth, (menu)->rwidth ) ) #define MENU_ITEM_WIDTH( item_lwidth, item_rwidth ) \ ((item_lwidth) + (item_rwidth) + 2*SHADOW + 3*HSPACE_PIXEL) /* * find an item called NAME in MENU */ /* INTPROTO */ menuitem_t* rxvt_menuitem_find(const menu_t *menu, const unsigned char *name) { menuitem_t *item; #ifdef DEBUG assert(NOT_NULL(name)); assert(NOT_NULL(menu)); #endif rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuitem_find(%s) ... ", name)); /* find the last item in the menu, this is good for separators */ for (item = menu->tail; NOT_NULL(item); item = item->prev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "%d", item->entry.itemType)); if (item->entry.itemType == MenuSubMenu) { if (!STRCMP(name, (item->entry.submenu.menu)->name)) break; } else if ((isSeparator(name) && isSeparator(item->name)) || !STRCMP(name, item->name)) break; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, ",")); } rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "Returning %p\n", item)); return item; } /* * unlink ITEM from its MENU and free its memory */ /* INTPROTO */ void rxvt_menuitem_free(rxvt_t *r, menu_t *menu, menuitem_t *item) { /* disconnect */ menuitem_t *prev, *next; #ifdef DEBUG assert(NOT_NULL(menu)); #endif rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuitem_free()\n")); prev = item->prev; next = item->next; if (NOT_NULL(prev)) prev->next = next; if (NOT_NULL(next)) next->prev = prev; /* new head, tail */ if (menu->tail == item) menu->tail = prev; if (menu->head == item) menu->head = next; switch (item->entry.itemType) { case MenuSubMenu: rxvt_menu_delete(r, item->entry.submenu.menu); SET_NULL(item->entry.submenu.menu); break; case MenuItem: rxvt_free(item->entry.action.str); SET_NULL(item->entry.action.str); break; } if (NOT_NULL(item->name)) rxvt_free(item->name); if (NOT_NULL(item->name2)) rxvt_free(item->name2); rxvt_free(item); } /* return the arrow index corresponding to NAME */ /* INTPROTO */ int rxvt_menuarrow_find(char name) { int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuarrow_find()\n")); for (i = 0; i < NARROWS; i++) if (name == Arrows[i].name) return i; return -1; } /* free the memory associated with arrow NAME of the current menubar */ /* INTPROTO */ void rxvt_menuarrow_free(rxvt_t *r, unsigned char name) { int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuarrow_free()\n")); if (name) { i = rxvt_menuarrow_find(name); if (i >= 0) { action_t *act = &(r->h->MenuBar.arrows[i]); if (act->len) { assert (NOT_NULL(act->str)); rxvt_free(act->str); SET_NULL(act->str); act->len = 0; } act->type = MenuLabel; } } else { /* Free all arrows */ /* * 2006-02-22 gi1242 XXX: If Arrows[i].name is NULL this will lead to an * infinite loop. WTF. */ for (i = 0; i < NARROWS; i++) rxvt_menuarrow_free(r, Arrows[i].name); } } /* INTPROTO */ void rxvt_menuarrow_add(rxvt_t *r, unsigned char *string) { int i; unsigned short xtra_len; unsigned char *p; struct { unsigned char *str; unsigned short len; } beg = { NULL, 0 }, end = { NULL, 0 }, *cur, parse[NARROWS]; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuarrow_add()\n")); MEMSET(parse, 0, sizeof(parse)); for (p = string; NOT_NULL(p) && *p; string = p) { p = (string + 3); switch (string[1]) { case 'b': cur = &beg; break; case 'e': cur = &end; break; default: i = rxvt_menuarrow_find(string[1]); if (i >= 0) cur = &(parse[i]); else continue; /* not found */ break; } string = p; cur->str = string; cur->len = 0; if (cur == &end) { p = (unsigned char*) STRCHR(string, '\0'); } else { unsigned char *next = string; while (1) { p = (unsigned char*) STRCHR(next, '<'); if (NOT_NULL(p)) { if (p[1] && p[2] == '>') break; /* parsed */ } else { if (IS_NULL(beg.str)) /* no end needed */ p = (unsigned char*) STRCHR(next, '\0'); break; } next = (p + 1); } } if (IS_NULL(p)) return; cur->len = (p - string); } #ifdef DEBUG cur = &beg; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "(len %d) = %.*s\n", cur->len, (cur->str ? (char*) cur->str : ""))); for (i = 0; i < NARROWS; i++) { cur = &(parse[i]); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "<%c>(len %d) = %.*s\n", Arrows[i].name, cur->len, (cur->str ? (char*) cur->str : ""))); } cur = &end; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "(len %d) = %.*s\n", cur->len, (cur->str ? (char*) cur->str : ""))); #endif xtra_len = (beg.len + end.len); for (i = 0; i < NARROWS; i++) { if (xtra_len || parse[i].len) rxvt_menuarrow_free(r, Arrows[i].name); } for (i = 0; i < NARROWS; i++) { char str[NEWARGLIM]; unsigned short len; if (!parse[i].len) continue; /* possible integer overflow? */ assert (parse[i].len <= 0xffff - xtra_len - 1); /* str = rxvt_malloc(parse[i].len + xtra_len + 1); */ len = 0; if (beg.len) { STRNCPY(str + len, beg.str, beg.len); len += beg.len; } STRNCPY(str + len, parse[i].str, parse[i].len); len += parse[i].len; if (end.len) { STRNCPY(str + len, end.str, end.len); len += end.len; } str[len] = '\0'; #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "<%c>(len %d) = %s\n", Arrows[i].name, len, str)); #endif rxvt_set_action( &(r->h->MenuBar.arrows[i]), str); } } /* INTPROTO */ menuitem_t * rxvt_menuitem_add(rxvt_t *r, menu_t *menu, const unsigned char *name, const unsigned char *name2, const unsigned char *action) { menuitem_t *item; unsigned int len; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menuitem_add()\n")); #ifdef DEBUG assert(NOT_NULL(name)); assert(NOT_NULL(action)); #endif if (IS_NULL(menu)) return NULL; if (isSeparator(name)) { /* add separator, no action */ name = (unsigned char *) ""; action = (unsigned char *) ""; } else { /* * add/replace existing menu item */ item = rxvt_menuitem_find(menu, name); if (NOT_NULL(item)) { if (NOT_NULL(item->name2) && NOT_NULL(name2)) { rxvt_free(item->name2); item->len2 = 0; SET_NULL(item->name2); } switch (item->entry.itemType) { case MenuSubMenu: rxvt_menu_delete(r, item->entry.submenu.menu); SET_NULL(item->entry.submenu.menu); break; case MenuItem: rxvt_free(item->entry.action.str); SET_NULL(item->entry.action.str); break; } goto Item_Found; } } /* allocate a new itemect */ item = (menuitem_t *) rxvt_malloc( sizeof( menuitem_t) ); SET_NULL(item->entry.action.str); /* If not null will be freed by rxvt_action_set */ item->len2 = 0; SET_NULL(item->name2); len = STRLEN(name); /* possible integer overflow? */ assert (len >= 0 && len + 1 >= 0); item->name = rxvt_malloc(len + 1); STRCPY(item->name, name); if (name[0] == '.' && name[1] != '.') len = 0; /* hidden menu name */ item->len = len; /* add to tail of list */ item->prev = menu->tail; SET_NULL(item->next); if (NOT_NULL(menu->tail)) (menu->tail)->next = item; menu->tail = item; /* fix head */ if (IS_NULL(menu->head)) menu->head = item; /* * add action */ Item_Found: if (NOT_NULL(name2) && IS_NULL(item->name2)) { len = STRLEN(name2); if (len == 0) SET_NULL(item->name2); else { /* possible integer overflow? */ assert (len > 0 && len + 1 > 0); item->name2 = rxvt_malloc(len + 1); STRCPY(item->name2, name2); } item->len2 = len; } item->entry.itemType = MenuLabel; len = STRLEN(action); if (len == 0 && NOT_NULL(item->name2)) { action = item->name2; len = item->len2; } if (len) { char str[NEWARGLIM]; /* possible integer overflow? */ assert (len > 0 && len + 1 > 0); /* str = rxvt_malloc(len + 1); */ STRCPY(str, action); SET_NULL(item->entry.action.str); if( rxvt_set_action( &(item->entry.action), str) ) item->entry.itemType = MenuItem; } /* new item and a possible increase in width */ len = PTEXTWIDTH( r, item->name, item->len ); /* Left text width */ if( menu->lwidth < len ) menu->lwidth = len; len = PTEXTWIDTH( r, item->name2, item->len2); /* Right text width */ if( menu->rwidth < len ) menu->rwidth = len; return item; } /* * search for the base starting menu for NAME. * return a pointer to the portion of NAME that remains */ /* INTPROTO */ unsigned char* rxvt_menu_find_base(rxvt_t *r, menu_t **menu, unsigned char *path) { menu_t *m = NULL; menuitem_t *item; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_find_base()\n")); #ifdef DEBUG assert(NOT_NULL(menu)); #endif if (path[0] == '\0') return path; if (NOT_NULL(STRCHR(path, '/'))) { unsigned char *p = path; while (NOT_NULL(p = (unsigned char*) STRCHR(p, '/'))) { p++; if (*p == '/') path = p; } if (path[0] == '/') { path++; SET_NULL(*menu); } while (NOT_NULL(p = (unsigned char*) STRCHR(path, '/'))) { p[0] = '\0'; if (path[0] == '\0') return NULL; if (!STRCMP(path, DOT)) { /* nothing to do */ } else if (!STRCMP(path, DOTS)) { if (NOT_NULL(*menu)) *menu = (*menu)->parent; } else { path = rxvt_menu_find_base(r, menu, path); if (path[0] != '\0') /* not found */ { p[0] = '/'; /* fix-up name again */ return path; } } path = (p + 1); } } if (!STRCMP(path, DOTS)) { path += STRLEN(DOTS); if (NOT_NULL(*menu)) *menu = (*menu)->parent; return path; } /* find this menu */ if (IS_NULL(*menu)) { for (m = r->h->MenuBar.tail; NOT_NULL(m); m = m->prev) { if (!STRCMP(path, m->name)) break; } } else { /* find this menu */ for (item = (*menu)->tail; NOT_NULL(item); item = item->prev) { if ( item->entry.itemType == MenuSubMenu && !STRCMP(path, (item->entry.submenu.menu)->name) ) { m = (item->entry.submenu.menu); break; } } } if (NOT_NULL(m)) { *menu = m; path += STRLEN(path); } return path; } /* * delete this entire menu */ /* INTPROTO */ menu_t* rxvt_menu_delete(rxvt_t *r, menu_t *menu) { menu_t *parent = NULL, *prev, *next; menuitem_t *item; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_delete()\n")); assert( menu != r->h->ActiveMenu ); /* Shouldn't delete current menu */ /* delete the entire menu */ if (IS_NULL(menu)) return NULL; parent = menu->parent; /* unlink MENU */ prev = menu->prev; next = menu->next; if (NOT_NULL(prev)) prev->next = next; if (NOT_NULL(next)) next->prev = prev; if (IS_NULL(parent)) { /* * If we got here, then this menu is either a popup menu, or a pulldown * submenu of the main menubar. */ const int width = 2 * HSPACE_PIXEL + PTEXTWIDTH( r, menu->name, menu->len); /* * Reset start / end of menus in the menubar if we deleted the first / * last pulldown menu. */ if (r->h->MenuBar.tail == menu) r->h->MenuBar.tail = prev; if (r->h->MenuBar.head == menu) r->h->MenuBar.head = next; /* * Move all subsequent entries of the menubar to the left. Popups don't * have next or prev set, so no worries doing this */ for (next = menu->next; NOT_NULL(next); next = next->next) next->x -= width; } else { for (item = parent->tail; NOT_NULL(item); item = item->prev) { if (item->entry.itemType == MenuSubMenu && item->entry.submenu.menu == menu) { /* Unlink from the parent menu */ SET_NULL(item->entry.submenu.menu); rxvt_menuitem_free(r, menu->parent, item); break; } } } item = menu->tail; while (NOT_NULL(item)) { menuitem_t *p = item->prev; rxvt_menuitem_free(r, menu, item); item = p; } rxvt_free(menu->name); rxvt_free(menu); return parent; } /* INTPROTO */ menu_t* rxvt_menu_add(rxvt_t *r, menu_t *parent, unsigned char *path) { menu_t *menu; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_add(): Adding menu %s to parent %s\n", path, NOT_NULL(parent) ? (char *)parent->name : "(nil)")); if (NOT_NULL(STRCHR(path, '/'))) { unsigned char *p; if (path[0] == '/') { /* shouldn't happen */ path++; SET_NULL(parent); } while (NOT_NULL(p = (unsigned char*) STRCHR(path, '/'))) { p[0] = '\0'; if (path[0] == '\0') return NULL; parent = rxvt_menu_add(r, parent, path); path = (p + 1); } } if (!STRCMP(path, DOTS)) return (NOT_NULL(parent) ? parent->parent : parent); if (!STRCMP(path, DOT) || path[0] == '\0') return parent; /* allocate a new menu */ menu = (menu_t *) rxvt_malloc(sizeof(menu_t)); menu->lwidth = menu->rwidth = 0; menu->parent = parent; menu->len = STRLEN(path); /* possible integer overflow? */ assert (menu->len > 0 && menu->len+1 > 0); menu->name = rxvt_malloc((menu->len + 1)); STRCPY(menu->name, path); /* initialize head/tail */ SET_NULL(menu->head); SET_NULL(menu->tail); SET_NULL(menu->prev); SET_NULL(menu->next); UNSET_WIN(menu->win); menu->x = menu->y = menu->height = 0; SET_NULL(menu->item); if (IS_NULL(parent)) { /* Add menus named PopupButton%d to popupMenu[%d] */ if( !STRNCASECMP("popupbutton", (char*) path, (sizeof("popupbutton")-1)) && path[sizeof("popupbutton")-1] >= '1' && path[sizeof("popupbutton")-1] <= '3' && path[sizeof("popupbutton")] == '\0' ) { int i = path[sizeof("popupbutton")-1] - '1'; /* Free the menu */ if( r->h->popupMenu[i] ) rxvt_menu_delete( r, r->h->popupMenu[i] ); r->h->popupMenu[i] = menu; } else { /* * Add this menu as a the last pulldown menu in the menubar. */ menu->prev = r->h->MenuBar.tail; if (NOT_NULL(r->h->MenuBar.tail)) r->h->MenuBar.tail->next = menu; r->h->MenuBar.tail = menu; /* fix head */ if (IS_NULL(r->h->MenuBar.head)) r->h->MenuBar.head = menu; if (menu->prev) menu->x = menu->prev->x + 2 * HSPACE_PIXEL + PTEXTWIDTH( r, menu->prev->name, menu->prev->len); } } else { menuitem_t *item; item = rxvt_menuitem_add(r, parent, path, (unsigned char*) "", (unsigned char*) ""); if (IS_NULL(item)) { if (NOT_NULL(menu->name)) rxvt_free( menu->name ); rxvt_free(menu); return parent; } #ifdef DEBUG assert(item->entry.itemType == MenuLabel); #endif item->entry.itemType = MenuSubMenu; item->entry.submenu.menu = menu; } return menu; } /* INTPROTO */ void rxvt_drawbox_menubar(rxvt_t *r, int x, int len, int state) { unsigned long top, bot; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_drawbox_menubar()\n")); /* XXXMENU */ len += HSPACE_PIXEL + SHADOW; if (x >= TWIN_WIDTH(r)) return; else if (x + len >= TWIN_WIDTH(r)) len = (TWIN_WIDTH(r) - x); #ifdef MENUBAR_SHADOW_IN state = -state; #endif switch (state) { case +1: top = r->menuBar.topshadow; bot = r->menuBar.botshadow; break; /* SHADOW_OUT */ case -1: top = r->menuBar.botshadow; bot = r->menuBar.topshadow; break; /* SHADOW_IN */ default: top = bot = r->menuBar.bg; break; /* neutral */ } rxvt_draw_shadow(r->Xdisplay, r->menuBar.win, r->menuBar.gc, top, bot, x, 0, len, rxvt_menubar_height(r)); } /* INTPROTO */ void rxvt_menubar_draw_triangle(rxvt_t *r, int x, int y, int state) { unsigned long top, bot; int w; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_draw_triangle()\n")); #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = r->menuBar.topshadow; bot = r->menuBar.botshadow; break; /* SHADOW_OUT */ case -1: top = r->menuBar.botshadow; bot = r->menuBar.topshadow; break; /* SHADOW_IN */ default: top = bot = r->menuBar.bg; break; /* neutral */ } w = TRIANGLE_WIDTH; x -= SHADOW + (3 * w / 2); y += SHADOW*2 + (HEIGHT_TEXT - TRIANGLE_WIDTH)/2; rxvt_draw_triangle (r->Xdisplay, r->h->ActiveMenu->win, r->menuBar.gc, top, bot, x, y, w, 'r'); } /* INTPROTO */ void rxvt_drawbox_menuitem(rxvt_t *r, int y, int state) { unsigned long top, bot; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_drawbox_menuitem()\n")); #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = r->menuBar.topshadow; bot = r->menuBar.botshadow; break; /* SHADOW_OUT */ case -1: top = r->menuBar.botshadow; bot = r->menuBar.topshadow; break; /* SHADOW_IN */ default: top = bot = r->menuBar.bg; break; /* neutral */ } rxvt_draw_shadow (r->Xdisplay, r->h->ActiveMenu->win, r->menuBar.gc, top, bot, SHADOW + 0, SHADOW + y, MENUWIDTH( r->h->ActiveMenu ) - 2 * (SHADOW), HEIGHT_TEXT + 2 * SHADOW); XFlush(r->Xdisplay); } #ifdef DEBUG /* INTPROTO */ void rxvt_print_menu_ancestors(menu_t *menu) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_print_menu_ancestors()\n")); if (IS_NULL(menu)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "Top Level menu\n")); return; } rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "menu %s ", menu->name)); if (NOT_NULL(menu->parent)) { menuitem_t *item; for (item = menu->parent->head; NOT_NULL(item); item = item->next) { if (item->entry.itemType == MenuSubMenu && item->entry.submenu.menu == menu) { break; } } if (IS_NULL(item)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "is an orphan!\n")); return; } } rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "\n")); rxvt_print_menu_ancestors(menu->parent); } /* INTPROTO */ void rxvt_print_menu_descendants(menu_t *menu) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_print_menu_descendants()\n")); menuitem_t *item; menu_t *parent; int i, level = 0; parent = menu; do { level++; parent = parent->parent; } while (NOT_NULL(parent)); for (i = 0; i < level; i++) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, ">")); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "%s\n", menu->name)); for (item = menu->head; NOT_NULL(item); item = item->next) { if (item->entry.itemType == MenuSubMenu) { if (IS_NULL(item->entry.submenu.menu)) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "> %s == NULL\n", item->name)); else rxvt_print_menu_descendants(item->entry.submenu.menu); } else { for (i = 0; i < level; i++) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "+")); if (item->entry.itemType == MenuLabel) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "label: ")); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "%s\n", item->name)); } } for (i = 0; i < level; i++) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "<")); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "\n")); } #endif /* DEBUG */ /* * Build a menu with all the titles of current tabs. */ /* INTPROTO */ void rxvt_build_tablist(rxvt_t *r, menu_t *menu) { int i; unsigned char action[16], title[MAX_DISPLAY_TAB_TXT + 4]; assert( menu); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_build_tablist()\n")); /* * Empty menus should get renamed to "Switch to tab". */ if( !menu->head && STRCMP( menu->name, "Switch to tab")) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "Renaming menu to Switch to tab\n")); menu->name = rxvt_realloc( menu->name, 14); STRCPY( menu->name, "Switch to tab"); } rxvt_menu_clear( r, menu); for( i=0; i <= LTAB(r); i++) { sprintf( (char*) title, "%2d. %.*s", i+1, MAX_DISPLAY_TAB_TXT-1, PVTS(r, i)->tab_title); /* sprintf( action, "]\e]%d;%d\a", Xterm_switchtab, i+1); */ sprintf( (char*) action, "GotoTab %d", i + 1); rxvt_menuitem_add( r, menu, title, NULL, action); rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "Added menuentry for %s\n", PVTS(r, i)->tab_title)); } } /* pop up/down the current menu and redraw the menuBar button */ /* EXTPROTO */ void rxvt_menu_show(rxvt_t *r) { int y, xright; menu_t *ActiveMenu = r->h->ActiveMenu; menuitem_t *item; unsigned short amenu_width; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_show()\n")); if (IS_NULL(ActiveMenu)) return; /* * Popup tablist for menus named tablist, or empty popupbutton menus. */ if( !STRCASECMP( (char*) ActiveMenu->name, "Switch to tab") || ( !STRNCASECMP( (char*) ActiveMenu->name, "popupbutton", 11 ) && ActiveMenu->head == NULL ) ) rxvt_build_tablist( r, ActiveMenu ); if (IS_NULL(ActiveMenu->parent)) { register int h; /* find the height */ for (h = 0, item = ActiveMenu->head; NOT_NULL(item); item = item->next) h += isSeparator(item->name) ? HEIGHT_SEPARATOR : HEIGHT_TEXT + 2 * SHADOW; ActiveMenu->height = h + 2 * SHADOW; if( !( r->h->showingMenu & POPUP_MENU )) { rxvt_drawbox_menubar(r, ActiveMenu->x, PTEXTWIDTH( r, ActiveMenu->name, ActiveMenu->len), -1); ActiveMenu->y = rxvt_menubar_height( r ); } } amenu_width = MENUWIDTH( ActiveMenu ); /* * Move popup menus, or submenus back on screen if they are not completely * on screen. * * XXX 2006-02-02 gi1242: It would be a LOT nicer if we could move all * parents of the menu too. We should only do this for popup menus. This is * what fvwm does :) * * BUG: If a moved menu obscures a grandparent menu, then that menu is not * redrawn when the child is removed. */ if( (r->h->showingMenu & POPUP_MENU) || ActiveMenu->parent != NULL) { int unused_x, unused_y; unsigned rootWidth, rootHeight, unused_depth, unused_border_width; Window unused_win; XGetGeometry( r->Xdisplay, XROOT, &unused_win, &unused_x, &unused_y, &rootWidth, &rootHeight, &unused_border_width, &unused_depth); if( r->szHint.x + ActiveMenu->x + amenu_width >= rootWidth && amenu_width < rootWidth) ActiveMenu->x = rootWidth - amenu_width - r->szHint.x; if( r->szHint.y + ActiveMenu->y + ActiveMenu->height >= rootHeight && ActiveMenu->height < rootHeight) ActiveMenu->y = rootHeight - ActiveMenu->height - r->szHint.y; } /* * Create the menu window. */ if (NOT_WIN(ActiveMenu->win)) { #if 0 ActiveMenu->win = XCreateSimpleWindow(r->Xdisplay, r->TermWin.parent, x, ActiveMenu->y, ActiveMenu->width, ActiveMenu->height, 0, r->pixColorsFocus[Color_fg], r->pixColorsFocus[Color_scroll]); #endif /* * 2006-02-05 gi1242: We should make menu windows childs of the root * window. That way they can go outside the terminal window's * boundaries. */ XSetWindowAttributes attrs; attrs.override_redirect = True; attrs.save_under = True; attrs.cursor = r->h->bar_pointer; attrs.background_pixel = r->pixColorsFocus[ Color_scroll ]; attrs.border_pixel = r->pixColorsFocus[Color_fg]; ActiveMenu->win = XCreateWindow( r->Xdisplay, XROOT, r->szHint.x + ActiveMenu->x, r->szHint.y + ActiveMenu->y, amenu_width, ActiveMenu->height, 0, CopyFromParent, CopyFromParent, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWCursor | CWBackPixel | CWBorderPixel, &attrs); XMapWindow(r->Xdisplay, ActiveMenu->win); } #ifdef XFT_SUPPORT else if (ISSET_OPTION(r, Opt_xft)) XClearWindow( r->Xdisplay, ActiveMenu->win ); #endif rxvt_draw_shadow (r->Xdisplay, ActiveMenu->win, r->menuBar.gc, r->menuBar.topshadow, r->menuBar.botshadow, 0, 0, amenu_width, ActiveMenu->height); /* determine the correct right-alignment */ for (xright = 0, item = ActiveMenu->head; NOT_NULL(item); item = item->next) if( item->name2 && item->len ) { int width = PTEXTWIDTH( r, item->name2, item->len2); if( xright < width ) xright = width; } for (y = 0, item = ActiveMenu->head; NOT_NULL(item); item = item->next) { const int xoff = (SHADOW + HSPACE_PIXEL/2); register int h; if (isSeparator(item->name)) { rxvt_draw_shadow (r->Xdisplay, ActiveMenu->win, r->menuBar.gc, r->menuBar.topshadow, r->menuBar.botshadow, SHADOW, y + SHADOW + 1, amenu_width - 2 * SHADOW, 0); h = HEIGHT_SEPARATOR; } else { unsigned char *name = item->name; unsigned short len = item->len; if (item->entry.itemType == MenuSubMenu) { int x1, y1; menuitem_t *it; menu_t *menu = item->entry.submenu.menu; rxvt_menubar_draw_triangle(r, amenu_width, y, +1); name = menu->name; len = menu->len; if( name && !STRCMP( menu->name, "Switch to tab")) rxvt_build_tablist( r, menu); y1 = ActiveMenu->y + y; #if 0 /* place sub-menu at midpoint of parent menu */ x1 = ActiveMenu->width / 2; if (x1 > menu->width) /* right-flush menu if too small */ x1 += (x1 - menu->width); x1 += x; #endif /* * 2006-01-28 gi1242: Oh my god. This is so ugly. Place * sub-menus near the triangle. That'll look a *little* better. */ x1 = ActiveMenu->x + amenu_width - TRIANGLE_WIDTH - xoff; /* find the height of this submenu */ for (h = 0, it = menu->head; NOT_NULL(it); it = it->next) h += isSeparator(it->name) ? HEIGHT_SEPARATOR : HEIGHT_TEXT + 2 * SHADOW; menu->height = h + 2 * SHADOW; /* * XXX 2006-02-02 gi1242: Should we really move the menu back * over the terminal window? It's a better idea to do what fvwm * does. */ #if 0 /* ensure menu is in window limits */ if ((x1 + menu->width) >= TWIN_WIDTH(r)) x1 = (TWIN_WIDTH(r) - menu->width); if ((y1 + menu->height) >= TWIN_HEIGHT(r)) y1 = (TWIN_HEIGHT(r) - menu->height); #endif menu->x = (x1 < 0 ? 0 : x1); menu->y = (y1 < 0 ? 0 : y1); } else if (item->name2 && !STRCMP(name, item->name2)) SET_NULL(name); if (item->entry.itemType == MenuLabel) { CHOOSE_GC_FG (r, r->menuBar.botshadow); } else { CHOOSE_GC_FG (r, r->menuBar.fg); } if (len && name) { # ifdef XFT_SUPPORT /* * TODO: Add multichar support. */ if (ISSET_OPTION(r, Opt_xft)) { XftFont *font = r->TermWin.xftpfont ? r->TermWin.xftpfont : r->TermWin.xftfont; XftDrawChange( r->menuBar.xftDraw, ActiveMenu->win); XftDrawString8( r->menuBar.xftDraw, &r->menuBar.xftFore, font, xoff, 2 * SHADOW + y + font->ascent + 1, name, len); } else #endif #ifdef USE_XIM if (r->TermWin.fontset) { XmbDrawString(r->Xdisplay, ActiveMenu->win, r->TermWin.fontset, r->menuBar.gc, xoff, 2 * SHADOW + y + r->TermWin.font->ascent + 1, (char*) name, len); } else #endif XDrawString(r->Xdisplay, ActiveMenu->win, r->menuBar.gc, xoff, 2 * SHADOW + y + r->TermWin.font->ascent + 1, (char*) name, len); } len = item->len2; name = item->name2; if (len && name) { # ifdef XFT_SUPPORT /* * XXX Add multichar support. */ if (ISSET_OPTION(r, Opt_xft)) { XftFont *font = r->TermWin.xftpfont ? r->TermWin.xftpfont : r->TermWin.xftfont; XftDrawChange( r->menuBar.xftDraw, ActiveMenu->win); XftDrawString8( r->menuBar.xftDraw, &r->menuBar.xftFore, font, amenu_width - (xoff + xright), 2 * SHADOW + y + font->ascent + 1, name, len); } else #endif #ifdef USE_XIM if (r->TermWin.fontset) XmbDrawString(r->Xdisplay, ActiveMenu->win, r->TermWin.fontset, r->menuBar.gc, amenu_width - (xoff + xright), 2 * SHADOW + y + r->TermWin.font->ascent + 1, (char*) name, len); else #endif XDrawString(r->Xdisplay, ActiveMenu->win, r->menuBar.gc, amenu_width - (xoff + xright), 2 * SHADOW + y + r->TermWin.font->ascent + 1, (char*) name, len); } h = HEIGHT_TEXT + 2 * SHADOW; } y += h; } #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) /* * 2006-01-29 gi1242: For some reason if we leave xftDraw * with drawable ActiveMenu->win, we get a RenderBadPicture * error (I'm not sure on what function call). Thus we reset * it. */ XftDrawChange( r->menuBar.xftDraw, r->menuBar.win); #endif } /* * Destroy the ActiveMenu window if any, and redisplay (using update) the * parent. Setting updated to recursively call this function will hide all menus * (as in rxvt_menu_hide_all) */ /* INTPROTO */ void rxvt_menu_display(rxvt_t *r, void (*update)(rxvt_t *)) { menu_t *ActiveMenu = r->h->ActiveMenu; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_display()\n")); if (IS_NULL(ActiveMenu)) return; if (IS_WIN(ActiveMenu->win)) { XDestroyWindow(r->Xdisplay, ActiveMenu->win); UNSET_WIN(ActiveMenu->win); } SET_NULL(ActiveMenu->item); if (IS_NULL(ActiveMenu->parent) && !(r->h->showingMenu & POPUP_MENU) ) /* * 2006-01-30 gi1242: Just clearing the shadow will be enough. But with * transparency, drawbox_menubar(0) is not enough. */ #if 0 rxvt_drawbox_menubar(r, ActiveMenu->x, ActiveMenu->len, 0); #endif rxvt_menubar_draw_labels(r); r->h->ActiveMenu = ActiveMenu->parent; update(r); } /* INTPROTO */ void rxvt_menu_hide_all(rxvt_t *r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_hide_all()\n")); rxvt_menu_display(r, rxvt_menu_hide_all); /* r->h->showingMenu &= ~PULLDOWN_MENU; */ } /* * Hide current menu window, and redisplay the parent. */ /* INTPROTO */ void rxvt_menu_hide(rxvt_t *r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_hide()\n")); /* * rxvt_menu_display just destroys the current menu window, and reshow's the * parent (if rxvt_menu_show is passed as update function). */ rxvt_menu_display(r, rxvt_menu_show); } /* INTPROTO */ void rxvt_menu_clear(rxvt_t *r, menu_t *menu) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_clear()\n")); if (NOT_NULL(menu)) { menuitem_t *item = menu->tail; while (NOT_NULL(item)) { rxvt_menuitem_free(r, menu, item); /* it didn't get freed ... why? */ if (item == menu->tail) return; item = menu->tail; } menu->lwidth = menu->rwidth = 0; } } /* INTPROTO */ void rxvt_menubar_clear(rxvt_t *r) { menu_t *menu = r->h->MenuBar.tail; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_clear()\n")); while (NOT_NULL(menu)) { menu_t *prev = menu->prev; rxvt_menu_delete(r, menu); menu = prev; } SET_NULL(r->h->MenuBar.head); SET_NULL(r->h->MenuBar.tail); if (r->h->MenuBar.title) { rxvt_free(r->h->MenuBar.title); SET_NULL(r->h->MenuBar.title); } rxvt_menuarrow_free(r, 0); /* remove all arrow functions */ } /* INTPROTO */ void rxvt_draw_arrows(rxvt_t *r, int name, int state) { unsigned long top, bot; int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_draw_arrows()\n")); #ifdef MENU_SHADOW_IN state = -state; #endif switch (state) { case +1: top = r->menuBar.topshadow; bot = r->menuBar.botshadow; break; /* SHADOW_OUT */ case -1: top = r->menuBar.botshadow; bot = r->menuBar.topshadow; break; /* SHADOW_IN */ default: top = bot = r->menuBar.bg; break; /* neutral */ } if (!r->h->Arrows_x) return; for (i = 0; i < NARROWS; i++) { const int w = MENUBAR_ARROW_WIDTH; const int y = (rxvt_menubar_height(r) - w) / 2; int x = r->h->Arrows_x + (5 * MENUBAR_ARROW_WIDTH * i) / 4; if (!name || name == Arrows[i].name) rxvt_draw_triangle (r->Xdisplay, r->menuBar.win, r->menuBar.gc, top, bot, x, y, w, Arrows[i].name); } XFlush(r->Xdisplay); } /* EXTPROTO */ int rxvt_menu_select(rxvt_t *r, XButtonEvent *ev) { menuitem_t *thisitem, *item = NULL; int this_y, y; menu_t *ActiveMenu = r->h->ActiveMenu; unsigned short amenu_width = MENUWIDTH( ActiveMenu ); Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menu_select() (%d)\n", ev->type)); if (IS_NULL(ActiveMenu)) return 0; XQueryPointer(r->Xdisplay, ActiveMenu->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->x), &(ev->y), &unused_mask); if (NOT_NULL(ActiveMenu->parent) && (ev->x < 0 || ev->y < 0)) { rxvt_menu_hide(r); return 1; } /* determine the menu item corresponding to the Y index */ y = SHADOW; if (ev->x >= 0 && ev->x <= (amenu_width - SHADOW)) { for (item = ActiveMenu->head; NOT_NULL(item); item = item->next) { int h = HEIGHT_TEXT + 2 * SHADOW; if (isSeparator(item->name)) h = HEIGHT_SEPARATOR; else if (ev->y >= y && ev->y < (y + h)) break; y += h; } } if (IS_NULL(item) && ev->type == ButtonRelease) { rxvt_menu_hide_all(r); return 0; } thisitem = item; this_y = y - SHADOW; /* erase the last item */ if (NOT_NULL(ActiveMenu->item) || ev->type == ButtonRelease) { if (ActiveMenu->item && ActiveMenu->item != thisitem) { /* * Erase shadow of old menuitem. We can not get here during a button * release. */ for (y = 0, item = ActiveMenu->head; NOT_NULL(item); item = item->next) { int h; if (isSeparator(item->name)) h = HEIGHT_SEPARATOR; else if (item == ActiveMenu->item) { /* erase old menuitem shadow */ rxvt_drawbox_menuitem(r, y, 0); /* No Shadow */ if (item->entry.itemType == MenuSubMenu) rxvt_menubar_draw_triangle(r, amenu_width, y, +1); break; } else h = HEIGHT_TEXT + 2 * SHADOW; y += h; } } else { switch (ev->type) { case ButtonRelease: rxvt_dbgmsg ((DBG_VERBOSE, DBG_MENUBAR, "Menuitem released\n")); switch (item->entry.itemType) { case MenuLabel: case MenuSubMenu: rxvt_menu_hide_all(r); break; case MenuItem: rxvt_drawbox_menuitem(r, this_y, -1); { #ifdef HAVE_NANOSLEEP struct timespec rqt; rqt.tv_sec = 0; rqt.tv_nsec = MENU_DELAY_USEC * 1000; nanosleep(&rqt, NULL); #else /* use select for timing */ struct timeval tv; tv.tv_sec = 0; tv.tv_usec = MENU_DELAY_USEC; select(0, NULL, NULL, NULL, &tv); #endif } /* remove menu before sending keys to the application */ rxvt_menu_hide_all(r); rxvt_dispatch_action(r, &(item->entry.action), (XEvent *) ev ); #ifdef DEBUG /* DEBUG */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MENUBAR, "%s: %s\n", item->name, item->entry.action.str)); #endif /* DEBUG */ break; } break; default: if (item->entry.itemType == MenuSubMenu) goto DoMenu; break; } return 0; } } DoMenu: ActiveMenu->item = thisitem; y = this_y; if (NOT_NULL(thisitem)) { item = ActiveMenu->item; if (item->entry.itemType != MenuLabel) rxvt_drawbox_menuitem(r, y, +1); if (item->entry.itemType == MenuSubMenu) { int x; rxvt_menubar_draw_triangle(r, amenu_width, y, -1); x = ev->x + ActiveMenu->x; if (x >= item->entry.submenu.menu->x) { r->h->ActiveMenu = item->entry.submenu.menu; rxvt_menu_show(r); return 1; } } } return 0; } /* INTPROTO */ void rxvt_menubar_select(rxvt_t *r, XButtonEvent *ev) { menu_t *menu = NULL; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_select()\n")); /* determine the pulldown menu corresponding to the X index */ if ( ev->y >= 0 && ev->y <= (rxvt_menubar_height(r)-MENUBAR_MARGIN) ) { for (menu = r->h->MenuBar.head; NOT_NULL(menu); menu = menu->next) { int w = HSPACE_PIXEL + PTEXTWIDTH( r, menu->name, menu->len); if ((ev->x >= menu->x && ev->x < menu->x + w)) break; } } switch (ev->type) { case ButtonRelease: rxvt_menu_hide_all(r); break; case ButtonPress: if (IS_NULL(menu) && r->h->Arrows_x && ev->x >= r->h->Arrows_x) { int i; for (i = 0; i < NARROWS; i++) { if (ev->x >= (r->h->Arrows_x + (Width2Pixel(4 * i + i)) / 4) && ev->x < (r->h->Arrows_x + (Width2Pixel(4 * i + i + 4)) / 4)) { rxvt_draw_arrows(r, Arrows[i].name, -1); { #ifdef HAVE_NANOSLEEP struct timespec rqt; rqt.tv_sec = 0; rqt.tv_nsec = MENU_DELAY_USEC * 1000; nanosleep(&rqt, NULL); #else /* use select for timing */ struct timeval tv; tv.tv_sec = 0; tv.tv_usec = MENU_DELAY_USEC; select(0, NULL, NULL, NULL, &tv); #endif } rxvt_draw_arrows(r, Arrows[i].name, +1); rxvt_dispatch_action(r, &(r->h->MenuBar.arrows[i]), (XEvent *) ev); return; } } } /* FALLTHROUGH */ default: /* * press menubar or move to a new entry */ if (NOT_NULL(menu) && menu != r->h->ActiveMenu) { rxvt_menu_hide_all(r); /* pop down old menu */ r->h->ActiveMenu = menu; rxvt_menu_show(r); /* pop up new menu */ } break; } } /* EXTPROTO */ void rxvt_menubar_create (rxvt_t* r) { XGCValues gcvalue; unsigned long gcmask; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR,"rxvt_menubar_create\n")); /* * Only create a menubar if it's non-empty. */ r->menuBar.state = 0; r->menuBar.win = XCreateSimpleWindow(r->Xdisplay, r->TermWin.parent, 0, 0, TWIN_WIDTH(r), rxvt_menubar_rheight (r), 0, r->pixColorsFocus[Color_fg], r->pixColorsFocus[Color_scroll]); assert (IS_WIN(r->menuBar.win)); # ifdef DEBUG_X rxvt_set_win_title (r, r->menuBar.win, "menubar"); # endif XDefineCursor(r->Xdisplay, r->menuBar.win, r->h->bar_pointer); XSelectInput(r->Xdisplay, r->menuBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask)); # ifdef BACKGROUND_IMAGE UNSET_PIXMAP(r->menuBar.pixmap); /* Initialize it to None */ # ifdef TRANSPARENT if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_menubar) )) # endif if (r->h->rs[Rs_menubarPixmap]) { long w = 0, h = 0; r->menuBar.pixmap = rxvt_load_pixmap (r, r->h->rs[Rs_menubarPixmap], &w, &h); if (IS_PIXMAP(r->menuBar.pixmap)) XSetWindowBackgroundPixmap (r->Xdisplay, r->menuBar.win, r->menuBar.pixmap); } # endif # ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_menubar)) { XSetWindowBackgroundPixmap (r->Xdisplay, r->menuBar.win, ParentRelative); } # endif /* * Initialize the colors. TODO: Add a sperate resource for this, instead of * mooching of the scroll bar resources. */ if( XDEPTH > 2 ) { /* * If Color_scroll is too dark, then we should use White for the menu * foreground. */ XColor xcol; xcol.pixel = r->pixColorsFocus[Color_scroll]; XQueryColor( r->Xdisplay, XCMAP, &xcol); r->menuBar.fg = r->pixColorsFocus[ (xcol.red <= 0x60 && xcol.green <= 0x60 && xcol.blue <= 0x60 ) ? Color_White : Color_Black ]; } else r->menuBar.fg = r->pixColorsFocus[ Color_bg ]; /* Reverse video */ r->menuBar.bg = r->pixColorsFocus[XDEPTH <= 2 ? Color_fg : Color_scroll]; r->menuBar.topshadow = r->pixColorsFocus[Color_topShadow]; r->menuBar.botshadow = r->pixColorsFocus[Color_bottomShadow]; gcvalue.foreground = r->menuBar.fg; # ifdef TRANSPARENT if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_menubar) )) # endif # ifdef BACKGROUND_IMAGE if (NOT_PIXMAP(r->menuBar.pixmap)) # endif gcvalue.background = r->menuBar.bg; gcmask = GCForeground; # ifdef TRANSPARENT if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_menubar) )) # endif # ifdef BACKGROUND_IMAGE if (NOT_PIXMAP(r->menuBar.pixmap)) # endif gcmask |= GCBackground; r->menuBar.gc = XCreateGC (r->Xdisplay, r->menuBar.win, gcmask, &gcvalue); assert (IS_GC(r->menuBar.gc)); # ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { /* * Set up Xft stuff here. */ XColor xcol; r->menuBar.xftDraw = XftDrawCreate( r->Xdisplay, r->menuBar.win, XVISUAL, XCMAP); xcol.pixel = r->menuBar.fg; XQueryColor( r->Xdisplay, XCMAP, &xcol ); rxvt_alloc_xft_color( r, &xcol, &r->menuBar.xftFore); } else # endif { XSetFont(r->Xdisplay, r->menuBar.gc, r->TermWin.font->fid); } } /* EXTPROTO */ void rxvt_menubar_clean_exit (rxvt_t* r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_clean_exit()\n")); # ifdef XFT_SUPPORT /* * Sometimes gives a RenderBadPicture error, so don't destroy it. */ # if 0 if (ISSET_OPTION(r, Opt_xft)) { XftDrawDestroy( r->menuBar.xftDraw); } # endif # endif UNSET_WIN(r->menuBar.win); /* Destroyed by XDestroySubwindows */ if (IS_GC(r->menuBar.gc)) { XFreeGC (r->Xdisplay, r->menuBar.gc); UNSET_GC(r->menuBar.gc); } # ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->menuBar.pixmap)) { XFreePixmap (r->Xdisplay, r->menuBar.pixmap); UNSET_PIXMAP(r->menuBar.pixmap); } # endif } /* ** Is the menubar visible */ /* EXTPROTO */ int rxvt_menubar_visible (rxvt_t* r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_visible()\n")); return (IS_WIN(r->menuBar.win) && r->menuBar.state); } /* ** Hide the menubar */ /* EXTPROTO */ int rxvt_menubar_hide (rxvt_t* r) { int changed = 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_hide()\n")); assert (IS_WIN(r->menuBar.win)); changed = r->menuBar.state; XUnmapWindow(r->Xdisplay, r->menuBar.win); r->menuBar.state = 0; return (changed); } /* ** Show the menubar */ /* EXTPROTO */ int rxvt_menubar_show (rxvt_t* r) { int changed = 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_show()\n")); assert (IS_WIN(r->menuBar.win)); changed = !r->menuBar.state; XMapWindow(r->Xdisplay, r->menuBar.win); r->menuBar.state = 1; return (changed); } /* * Menubar expose handler */ /* EXTPROTO */ void rxvt_menubar_expose(rxvt_t *r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_expose()\n")); if (!r->menuBar.state || NOT_WIN(r->menuBar.win)) return; rxvt_menu_hide_all(r); rxvt_menubar_draw_labels(r); } /* INTPROTO */ void rxvt_menubar_draw_labels( rxvt_t *r) { menu_t *menu; int x; XClearWindow(r->Xdisplay, r->menuBar.win); x = 0; for (menu = r->h->MenuBar.head; NOT_NULL(menu); menu = menu->next) { unsigned short len = menu->len; x = (menu->x + menu->len + HSPACE); # ifdef DEBUG rxvt_print_menu_descendants(menu); # endif /* if (x >= r->TermWin.ncol) len = (r->TermWin.ncol - (menu->x + HSPACE)); */ /* 2006-01-29 gi1242: Boxes in the menubar are ugly */ #if 0 rxvt_drawbox_menubar(r, menu->x, len, +1); #endif CHOOSE_GC_FG (r, r->menuBar.fg); # ifdef XFT_SUPPORT /* * XXX Add multichar support. */ if (ISSET_OPTION(r, Opt_xft)) { XftFont *font = r->TermWin.xftpfont ? r->TermWin.xftpfont : r->TermWin.xftfont; XftDrawString8( r->menuBar.xftDraw, &r->menuBar.xftFore, font, (menu->x + HSPACE_PIXEL / 2), rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - font->descent, menu->name, len); } else # endif # ifdef USE_XIM if (r->TermWin.fontset) XmbDrawString(r->Xdisplay, r->menuBar.win, r->TermWin.fontset, r->menuBar.gc, (menu->x + HSPACE_PIXEL / 2), rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - r->TermWin.font->descent, (char*) menu->name, len); else # endif /* USE_XIM */ XDrawString(r->Xdisplay, r->menuBar.win, r->menuBar.gc, (menu->x + HSPACE_PIXEL / 2), rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - r->TermWin.font->descent, (char*) menu->name, len); if (x >= TWIN_WIDTH(r) ) break; } #if 0 rxvt_drawbox_menubar(r, x, r->TermWin.ncol, (r->h->CurrentBar ? +1 : -1)); #endif /* add the menuBar title, if it exists and there's plenty of room */ r->h->Arrows_x = 0; if (x < TWIN_WIDTH(r) ) { const unsigned char *str; int npixels; /* used to be ncol */ unsigned short len; unsigned char title[256]; npixels = TWIN_WIDTH(r); if (x < (npixels - NARROWS * MENUBAR_ARROW_WIDTH - HSPACE_PIXEL)) { npixels -= NARROWS * MENUBAR_ARROW_WIDTH + HSPACE_PIXEL; r->h->Arrows_x = npixels; } rxvt_draw_arrows(r, 0, +1); str = ( r->h->MenuBar.title) ? r->h->MenuBar.title : (unsigned char*) "%n-%v"; for (len = 0; str[0] && len < sizeof(title) - 1; str++) { const char *s = NULL; switch (str[0]) { case '%': str++; switch (str[0]) { case 'n': s = r->h->rs[Rs_name]; break; /* resource name */ case 'v': s = VERSION; break; /* version number */ case '%': s = "%"; break; /* literal '%' */ } if (NOT_NULL(s)) while (*s && len < sizeof(title) - 1) title[len++] = *s++; break; default: title[len++] = str[0]; break; } } title[len] = '\0'; npixels -= x + HSPACE_PIXEL + PTEXTWIDTH( r, title, len); if (len > 0 && npixels >= 0) { CHOOSE_GC_FG (r, r->menuBar.fg); # ifdef XFT_SUPPORT /* * XXX Add multichar support. */ if (ISSET_OPTION(r, Opt_xft)) { XftFont *font = r->TermWin.xftpfont ? r->TermWin.xftpfont : r->TermWin.xftfont; XftDrawString8( r->menuBar.xftDraw, &r->menuBar.xftFore, font, x + (npixels + HSPACE_PIXEL) / 2, rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - font->descent, title, len); } else # endif # ifdef USE_XIM if (r->TermWin.fontset) XmbDrawString(r->Xdisplay, r->menuBar.win, r->TermWin.fontset, r->menuBar.gc, x + (npixels + HSPACE_PIXEL) / 2, rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - r->TermWin.font->descent, (char*) title, len); else # endif /* USE_XIM */ XDrawString(r->Xdisplay, r->menuBar.win, r->menuBar.gc, x + (npixels + HSPACE_PIXEL) / 2, rxvt_menubar_height(r) - SHADOW - MENUBAR_MARGIN - r->TermWin.font->descent, (char*) title, len); } } } /* ** user interface for building/deleting and otherwise managing menus */ /* EXTPROTO */ void rxvt_menubar_dispatcher(rxvt_t *r, unsigned char *str) { int n, cmd; unsigned char *path, *name, *name2; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_dispatcher()\n")); #if 0 if (rxvt_menubar_visible(r) && NOT_NULL(r->h->ActiveMenu)) rxvt_menubar_expose(r); else SET_NULL(r->h->ActiveMenu); #endif cmd = *str; switch (cmd) { case '.': case '/': /* absolute & relative path */ case MENUITEM_BEG: /* menuitem */ /* add `+' prefix for these cases */ cmd = '+'; break; case '+': case '-': str++; /* skip cmd character */ break; case '<': if (str[1] && str[2] == '>') /* arrow commands */ rxvt_menuarrow_add(r, str); break; case '[': /* extended command */ while (str[0] == '[') { unsigned char *next = (++str); /* skip leading '[' */ if (str[0] == ':') /* [:command:] */ { do { next++; if (IS_NULL(next = (unsigned char*) STRCHR(next, ':'))) return; /* parse error */ } while (next[1] != ']'); /* remove and skip ':]' */ *next = '\0'; next += 2; } else { if (IS_NULL(next = (unsigned char*) STRCHR(next, ']'))) return; /* parse error */ /* remove and skip ']' */ *next = '\0'; next++; } if (str[0] == ':') rxvt_menubar_dispatcher(r, str + 1); else if (!STRCMP(str, "clear")) rxvt_menubar_clear(r); else if ( !STRCMP((char*) str, "done") || rxvt_str_match( (char*) str, "done:") ) { /* We shouldn't ever get here */ assert(0); } /* * 2006-02-02 gi1242: Using this command in config files will * override the users --showmenu option. Since there are other * escape sequences and shortcuts to do the same, we don't need * this here. */ #if 0 else if (!STRCMP(str, "show")) { if (rxvt_menubar_show(r)) rxvt_resize_on_subwin (r, SHOW_MENUBAR); } else if (!STRCMP(str, "hide")) { if (rxvt_menubar_hide(r)) rxvt_resize_on_subwin (r, HIDE_MENUBAR); } #endif else if ((n = rxvt_str_match( (char*) str, "read:")) != 0) { /* read in a menu from a file */ str += n; rxvt_menubar_load_file(r, str); } else if ((n = rxvt_str_match( (char*) str, "title:")) != 0) { str += n; if (*str) { name = rxvt_realloc(r->h->MenuBar.title, STRLEN(str) + 1); if (NOT_NULL(name)) { STRCPY(name, str); r->h->MenuBar.title = name; } } else { rxvt_free(r->h->MenuBar.title); SET_NULL(r->h->MenuBar.title); } } else if ((n = rxvt_str_match( (char*) str, "pixmap:")) != 0) { str += n; rxvt_xterm_seq(r, ATAB(r), XTerm_Pixmap, (char*) str, CHAR_ST); } str = next; /* * 2006-02-04 gi1242: Don't clear the menu currently bieng * built. This will enable [read:...] commands to add to the * current menu, instead of the menubar. */ #if 0 SET_NULL(r->h->BuildMenu); SET_NULL(r->h->ActiveMenu); rxvt_menubar_expose(r); #endif } return; break; } switch (cmd) { case '+': case '-': path = name = str; SET_NULL(name2); /* parse STR, allow spaces inside (name) */ if (path[0] != '\0') { name = (unsigned char*) STRCHR(path, MENUITEM_BEG); str = (unsigned char*) STRCHR(path, MENUITEM_END); if (NOT_NULL(name) || NOT_NULL(str)) { if (IS_NULL(name) || IS_NULL(str) || str <= (name + 1) || (name > path && name[-1] != '/') ) { rxvt_msg (DBG_ERROR, DBG_MENUBAR, "menu error <%s>\n", path); break; } if (str[1] == MENUITEM_BEG) { name2 = (str + 2); str = (unsigned char*) STRCHR(name2, MENUITEM_END); if (IS_NULL(str)) { rxvt_msg (DBG_ERROR, DBG_MENUBAR, "menu error <%s>\n", path); break; } name2[-2] = '\0'; /* remove prev MENUITEM_END */ } if (name > path && name[-1] == '/') name[-1] = '\0'; *name++ = '\0'; /* delimit */ *str++ = '\0'; /* delimit */ while (isspace((int) *str)) str++; /* skip space */ } rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "`%c' path = <%s>, name = <%s>, name2 = <%s>, action = <%s>\n", cmd, (path ? (char*) path : "(nil)"), (name ? (char*) name : "(nil)"), (name2 ? (char*) name2 : "(nil)"), (str ? (char*) str : "(nil)"))); } /* process the different commands */ switch (cmd) { case '+': /* add/replace existing menu or menuitem */ if (path[0] != '\0') { int len; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "Current menu %s\n", NOT_NULL(r->h->BuildMenu) ? (char *)r->h->BuildMenu->name : "(nil)")); path = rxvt_menu_find_base(r, &(r->h->BuildMenu), path); len = STRLEN(path); /* don't allow menus called `*' */ if (path[0] == '*') { rxvt_menu_clear(r, r->h->BuildMenu); break; } else if (len >= 2 && !STRCMP((path + len - 2), "/*")) { path[len - 2] = '\0'; } if (path[0] != '\0') r->h->BuildMenu = rxvt_menu_add(r, r->h->BuildMenu, path); } if (NOT_NULL(name) && name[0] != '\0') rxvt_menuitem_add(r, r->h->BuildMenu, (STRCMP(name, SEPARATOR_NAME) ? name : (unsigned char *) ""), name2, str); break; case '-': /* delete menu entry */ if ( !STRCMP(path, "/*") && (IS_NULL(name) || name[0] == '\0') ) { rxvt_menubar_clear(r); SET_NULL(r->h->BuildMenu); break; } else if (path[0] != '\0') { int len; menu_t *menu = r->h->BuildMenu; path = rxvt_menu_find_base(r, &menu, path); len = STRLEN(path); /* submenu called `*' clears all menu items */ if (path[0] == '*') { rxvt_menu_clear(r, menu); break; /* done */ } else if (len >= 2 && !STRCMP(&path[len - 2], "/*")) { /* done */ break; } else if (path[0] != '\0') { SET_NULL(r->h->BuildMenu); break; } else r->h->BuildMenu = menu; } if (NOT_NULL(r->h->BuildMenu)) { if (IS_NULL(name) || name[0] == '\0') r->h->BuildMenu = rxvt_menu_delete(r, r->h->BuildMenu); else { const unsigned char *n1; menuitem_t *item; menu_t *BuildMenu = r->h->BuildMenu; n1 = STRCMP(name, SEPARATOR_NAME) ? name : (unsigned char*) ""; item = rxvt_menuitem_find(BuildMenu, n1); if (NOT_NULL(item) && item->entry.itemType != MenuSubMenu ) { rxvt_menuitem_free(r, BuildMenu, item); /* fix up the width */ BuildMenu->lwidth = BuildMenu->rwidth = 0; for (item = BuildMenu->head; NOT_NULL(item); item = item->next) { unsigned short l; l = PTEXTWIDTH( r, item->name, item->len); MAX_IT(BuildMenu->lwidth, l); l = PTEXTWIDTH( r, item->name2, item->len2); MAX_IT(BuildMenu->rwidth, l); } } } } break; } break; } } /* ** general dispatch routine, ** it would be nice to have `sticky' menus */ /* EXTPROTO */ void rxvt_menubar_control(rxvt_t *r, XButtonEvent *ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_control()\n")); switch (ev->type) { case ButtonPress: if (ev->button == Button1) rxvt_menubar_select(r, ev); break; case ButtonRelease: if (ev->button == Button1 && r->h->ActiveMenu) rxvt_menu_select(r, ev); break; case MotionNotify: while (XCheckTypedWindowEvent(r->Xdisplay, r->TermWin.parent, MotionNotify, (XEvent *) ev)) ; if (r->h->ActiveMenu) while (rxvt_menu_select(r, ev)) ; else ev->y = -1; if (ev->y < 0) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; XQueryPointer(r->Xdisplay, r->menuBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->x), &(ev->y), &unused_mask); rxvt_menubar_select(r, ev); } break; } } /* * read in menubar commands from FILENAME * ignore all input before the tag line [menu] or [menu:???] * * Note that since File_find () is used, FILENAME can be semi-colon * delimited such that the second part can refer to a tag * so that a large `database' of menus can be collected together * * FILENAME = "file" * FILENAME = "file;" * read `file' starting with first [menu] or [menu:???] line * * FILENAME = "file;tag" * read `file' starting with [menu:tag] */ /* EXTPROTO */ void rxvt_menubar_load_file(rxvt_t *r, const unsigned char *filename) { /* read in a menu from a file */ FILE *fp; unsigned char buffer[256]; unsigned char *p, *file, *tag = NULL; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_load_file()\n")); file = (unsigned char*) rxvt_File_find( (char*) filename, ".menu", r->h->rs[Rs_path]); if (IS_NULL(file)) { rxvt_msg (DBG_ERROR, DBG_MENUBAR, "Could not open file %s\n", filename); return; } fp = fopen( (char*) file, "rb"); rxvt_free(file); if (IS_NULL(fp)) return; /* semi-colon delimited */ if (NOT_NULL(tag = (unsigned char*) STRCHR(filename, ';'))) { tag++; if (*tag == '\0') SET_NULL(tag); } rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "[read:%s]\n", filename)); if (tag) rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "looking for [menu:%s]\n", tag)); while (NOT_NULL(p = (unsigned char*) fgets( (char*) buffer, sizeof(buffer), fp))) { int n; if ((n = rxvt_str_match( (char*) p, "[menu")) != 0) { if (tag) { /* looking for [menu:tag] */ if (p[n] == ':' && p[n + 1] != ']') { n++; n += rxvt_str_match( (char*) p + n, (char*) tag); if (p[n] == ']') { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "[menu:%s]\n", tag)); break; } } } else if (p[n] == ':' || p[n] == ']') break; } } /* found [menu], [menu:???] tag */ while (NOT_NULL(p)) { int n; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "read line = %s\n", p)); /* looking for [done:tag] or [done:] */ if ((n = rxvt_str_match( (char*) p, "[done")) != 0) { if (p[n] == ']') { break; } else if (p[n] == ':') { n++; if (p[n] == ']') { break; } else if (tag) { n += rxvt_str_match( (char*) p + n, (char*) tag); if (p[n] == ']') { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "[done:%s]\n", tag)); break; } } else { /* what? ... skip this line */ p[0] = COMMENT_CHAR; } } } /* * remove leading/trailing space and strip-off leading/trailing quotes * skip blank or comment lines */ rxvt_str_trim( (char*) p); if (*p && *p != '#') rxvt_menubar_dispatcher(r, p); /* get another line */ p = (unsigned char*) fgets( (char*) buffer, sizeof(buffer), fp); } fclose(fp); } /* EXTPROTO */ unsigned short rxvt_menubar_height(rxvt_t *r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_height()\n")); /* If menubar is not created or not mapped, return 0 */ return (NOT_WIN(r->menuBar.win) || !r->menuBar.state) ? 0 : rxvt_menubar_rheight(r); } /* EXTPROTO */ unsigned short rxvt_menubar_rheight(rxvt_t *r) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_rheight()\n")); # ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) return (r->TermWin.pheight + 2*SHADOW + 2*MENUBAR_MARGIN); else # endif return (r->TermWin.fheight + 2*SHADOW + 2*MENUBAR_MARGIN); } /* EXTPROTO */ int rxvt_is_menubar_win(rxvt_t *r, Window w) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_is_menubar_win()\n")); return (w == r->menuBar.win); } /* EXTPROTO */ void rxvt_menubar_resize(rxvt_t *r) { menu_t *menu; int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_MENUBAR, "rxvt_menubar_resize()\n")); if (IS_WIN(r->menuBar.win) && r->menuBar.state) XMoveResizeWindow(r->Xdisplay, r->menuBar.win, 0, 0, TWIN_WIDTH(r), rxvt_menubar_rheight(r)); /* * All submenus now need to be traversed and resized. */ for (menu = r->h->MenuBar.head; NOT_NULL(menu); menu = menu->next) { resizeSubMenus( r, menu ); /* X coordinate of menu names in menubar need to be updated */ if( menu->prev ) menu->x = menu->prev->x + 2 * HSPACE_PIXEL + PTEXTWIDTH( r, menu->prev->name, menu->prev->len); } /* * Resize the popup menus if any. */ for( i=0; i < 3; i++) if( r->h->popupMenu[i] ) resizeSubMenus( r, r->h->popupMenu[i]); } /* * Update menu->width for all submenus. */ /* INTPROTO */ void resizeSubMenus( rxvt_t *r, menu_t *menu) { menuitem_t *item; menu->lwidth = menu->rwidth = 0; for( item = menu->head; NOT_NULL(item); item = item->next) { unsigned short width; width = PTEXTWIDTH( r, item->name, item->len); if( menu->lwidth < width ) menu->lwidth = width; width = PTEXTWIDTH( r, item->name2, item->len2); if( menu->rwidth < width ) menu->rwidth = width; if( item->entry.itemType == MenuSubMenu && item->entry.submenu.menu) resizeSubMenus( r, item->entry.submenu.menu ); } } #endif /* HAVE_MENUBAR */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/menubar.h0000644000175000001440000000724310756127602012222 00000000000000/*--------------------------------*-H-*---------------------------------* * File: menubar.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1997-2001 Geoff Wing * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __MENUBAR_H__ #define __MENUBAR_H__ typedef struct { /* short menuType; */ /* must not be changed; first element */ struct menu_t *menu; /* sub-menu */ } submenu_t; typedef struct menuitem_t { struct menuitem_t *prev; /* prev menu-item */ struct menuitem_t *next; /* next menu-item */ unsigned char *name; /* character string displayed */ unsigned char *name2; /* character string displayed (right) */ unsigned short len; /* strlen (name) */ unsigned short len2; /* strlen (name) */ struct { short itemType; /* must not be changed; first element */ union { action_t action; submenu_t submenu; }; } entry; } menuitem_t; enum menuitem_t_action { MenuLabel=0, MenuSubMenu, MenuItem }; typedef struct menu_t { struct menu_t *parent;/* parent menu */ struct menu_t *prev; /* prev menu */ struct menu_t *next; /* next menu */ menuitem_t *head; /* double-linked list */ menuitem_t *tail; /* double-linked list */ menuitem_t *item; /* current item */ unsigned char *name; /* menu name */ unsigned short len; /* strlen (name) */ Window win; /* window of the menu */ short x; /* x location [pixels] relative to terminal win */ short y; /* y location [pixels] relative to terminal win */ unsigned short lwidth, /* Max width of the left text items */ rwidth, /* Max width of the right text items */ height; /* Window height (pixels) */ } menu_t; typedef struct bar_t { menu_t *head, *tail; /* double-linked list of menus */ unsigned char *title; /* title to put in the empty menuBar */ #define NARROWS 4 action_t arrows[NARROWS]; } bar_t; #define HSPACE 1 /* one space */ #define isSeparator(name) ((name)[0] == '\0') #define HEIGHT_SEPARATOR (SHADOW + 1) #ifdef XFT_SUPPORT # define HSPACE_PIXEL (r->TermWin.pwidth) # define HEIGHT_TEXT (r->TermWin.pheight + 2) #else # define HSPACE_PIXEL (r->TermWin.fwidth) # define HEIGHT_TEXT (r->TermWin.fheight + 2) #endif #define MENUBAR_ARROW_WIDTH HSPACE_PIXEL #define MENU_DELAY_USEC 250000 /* 1/4 sec */ #define SEPARATOR_NAME "-" #define MENUITEM_BEG '{' #define MENUITEM_END '}' #define COMMENT_CHAR '#' #define DOT "." #define DOTS ".." /* * Values for r->h->showingMenu */ #define NOMENU (0) #define POPUP_MENU (1) #define PULLDOWN_MENU (1 << 1) #endif /* __MENUBAR_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/transparent.c0000644000175000001440000010255310756127602013125 00000000000000/*--------------------------------*-C-*---------------------------------* * File: transparent.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 2004-2005 Jingmin Zhou * Copyright (c) 2005 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /* ------------------- Begin Internal Prototypes ---------------------- */ #ifdef TRANSPARENT int tempDisableTransparent (rxvt_t*); void expose_transparent_subwin (rxvt_t*); int resetParentPixmap (rxvt_t*, unsigned, unsigned, unsigned rootd); #endif #ifdef TINTING_SUPPORT # ifdef HAVE_LIBXRENDER void xrenderShadeIntersect (rxvt_t*, Picture, unsigned long, int, int, int, unsigned, unsigned, int, int, unsigned, unsigned); # else static void shade_ximage (rxvt_t*, XImage*); # endif #endif /* -------------------------- End Internal Prototypes ----------------------- */ /* {{{1 General functions */ /* {{{2 rxvt_set_opacity(r) */ /* INTPROTO */ int rxvt_set_opacity (rxvt_t* r) { int k; unsigned int n; Window wintree[PARENT_NUMBER]; Window root; Window* list; CARD32 opacity; /* do not set opacity */ if (IS_NULL(r->h->rs[Rs_opacity]) || NOT_ATOM(r->h->xa[XA_NET_WM_WINDOW_OPACITY])) return 0; #ifdef TRANSPARENT /* Override pseudo-transparent in case */ if (ISSET_OPTION(r, Opt_transparent)) UNSET_OPTION(r, Opt_transparent); XSetWindowBackground(r->Xdisplay, r->TermWin.parent, VTBG(r,0) ); #endif opacity = (CARD32) (r->TermWin.opacity * (0xffffffff / 100)); /* ** look for parent tree of top level window because the window ** manager may embed our window into some frame windows */ wintree[0] = r->TermWin.parent; for (k = 1; k < PARENT_NUMBER; k++) { XQueryTree (r->Xdisplay, wintree[k-1], &root, &(wintree[k]), &list, &n); XFree (list); if (wintree[k] == XROOT) break; } /* Set opacity for all windows */ if (k != PARENT_NUMBER) { while (k-- > 0) XChangeProperty (r->Xdisplay, wintree[k], r->h->xa[XA_NET_WM_WINDOW_OPACITY], XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &opacity, 1L); } XSync(r->Xdisplay, False); return 1; } /* {{{2 rxvt_process_reparentnotify( r, ev) */ /* EXTPROTO */ void rxvt_process_reparentnotify (rxvt_t* r, XEvent* ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "ReparentNotify event\n")); rxvt_set_opacity (r); #ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent)) { if( r->h->bgRefreshInterval) gettimeofday( &r->h->lastCNotify, NULL); else if( rxvt_check_our_parents(r) ) r->h->want_full_refresh = 1; } #endif } /* {{{1 Transparent only functions */ #ifdef TRANSPARENT /* tempDisableTransparent(r) {{{2 * * Temporarily disable transparency (because something failed) */ /* INTPROTO */ int tempDisableTransparent( rxvt_t *r) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Disabling XROOT pseudo-transparency\n")); if( r->h->am_transparent ) { /* * Need to update the window background. */ r->h->am_transparent = 0; r->h->want_full_refresh = 1; if( NOTSET_OPTION(r, Opt_forceTransparent) ) { XSetWindowBackground( r->Xdisplay, r->TermWin.parent, VTBG(r,0) ); expose_transparent_subwin( r ); } return 1; } else return 0; } /* expose_transparent_subwin(r) {{{2 * * Send Expose events to all transparent subwindows. */ void expose_transparent_subwin( rxvt_t *r) { /* Do not handle the subwindows if VT windows have not been ** created. Otherwise, the following will cause crash. */ if (-1 == LTAB(r)) return; # ifdef HAVE_SCROLLBARS if (ISSET_OPTION(r, Opt_transparent_scrollbar)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "reset background image for scrollbar\n")); XClearWindow (r->Xdisplay, r->scrollBar.win); r->scrollBar.update (r, 1, r->scrollBar.top, r->scrollBar.bot, r->h->scroller_len); } # endif # ifdef HAVE_MENUBAR if (ISSET_OPTION(r, Opt_transparent_menubar)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "reset background image for menubar\n")); rxvt_menubar_expose (r); } # endif if (ISSET_OPTION(r, Opt_transparent_tabbar)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "reset background image for tabbar\n")); rxvt_tabbar_expose (r, NULL); } } /* {{{2 resetParentPixmap(r, rootw, rooth, rootd) * * Grabs the root background, shades it and sets as the windows background * pixmap. rwidth / height / depth are the respective attributes of the root * window. * * xerror_return must be set to Success before entering this function. (It's not * reset in this function either). */ /* INTPROTO */ int resetParentPixmap( rxvt_t *r, unsigned rootw, unsigned rooth, unsigned rootd) { Pixmap pmap; GC gc; int sx = r->szHint.x, /* coordinates to grab root img */ sy = r->szHint.y, nx = 0, ny = 0; /* coordinates to put root image */ unsigned int nw = r->szHint.width, /* dims of root image to grab */ nh = r->szHint.height; # ifdef DEBUG if( sx + nw <= 0 || sx >= (int) rootw || sy + nh <= 0 || sy >= (int) rooth) { rxvt_msg (DBG_WARN, DBG_TRANSPARENT, "Possible error: grabbing offscreen (%d, %d, %u, %u)\n", sx, sy, nw, nh); } # endif pmap = XCreatePixmap( r->Xdisplay, r->TermWin.parent, r->szHint.width, r->szHint.height, rootd); if (NOT_PIXMAP(pmap)) return 0; gc = XCreateGC( r->Xdisplay, r->TermWin.parent, 0, NULL); if (sx < 0) { nw += sx; nx = -sx; sx = 0; } if (sy < 0) { nh += sy; ny = -sy; sy = 0; } MIN_IT(nw, (unsigned int) (rootw - sx)); MIN_IT(nh, (unsigned int) (rooth - sy)); # if defined(HAVE_LIBXRENDER) || !defined(TINTING_SUPPORT) rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "XRender: Grab root pmap at %ux%u+%d+%d\n", nw, nh, sx, sy)); if( r->h->rpWidth < rootw || r->h->rpHeight < rooth ) { /* Tile the root background on the window. */ XGCValues values; values.ts_x_origin = -sx + nx; values.ts_y_origin = -sy + ny; values.fill_style = FillTiled; values.tile = r->h->rootPixmap; XChangeGC( r->Xdisplay, gc, GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin | GCTile, &values); XFillRectangle( r->Xdisplay, pmap, gc, nx, ny, nw, nh); } else XCopyArea( r->Xdisplay, r->h->rootPixmap, pmap, gc, sx, sy, nw, nh, nx, ny); # if defined(HAVE_LIBXRENDER) && defined(TINTING_SUPPORT) xrenderShadeParentPixmap( r, pmap, nx, ny, nw, nh, True ); # endif # else /* if HAVE_LIBXRENDER || !TINTING_SUPPORT */ { /* * We need to tint the root pixmap ourself now. Since our tinting * functions use XImages we have to get the root background into an * ximage first. */ XImage *image; rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Fast transparency -- XGetImage (%d, %d, %d, %d)\n", sx, sy, nw, nh)); if( r->h->rpWidth < rootw || r->h->rpHeight < rooth ) { XGCValues values; /* * Tile the root background on the window. Xlib only tiles into * pixmaps, so we tile into pmap, and then XGetImage it. */ values.ts_x_origin = -sx; values.ts_y_origin = -sy; values.fill_style = FillTiled; values.tile = r->h->rootPixmap; XChangeGC( r->Xdisplay, gc, GCFillStyle | GCTileStipXOrigin | GCTileStipYOrigin | GCTile, &values); XFillRectangle( r->Xdisplay, pmap, gc, 0, 0, nw, nh); image = XGetImage( r->Xdisplay, pmap, 0, 0, nw, nh, AllPlanes, ZPixmap); } else image = XGetImage( r->Xdisplay, r->h->rootPixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); if( image != NULL) { /* * Image now has our root background. We have to tint it, and put it * back as a pixmap. */ shade_ximage( r, image); XPutImage(r->Xdisplay, pmap, gc, image, 0, 0, /* src x and y */ nx, ny, nw, nh); /* dst coords */ XDestroyImage( image); } else if( r->h->xerror_return == Success ) { /* * If image == NULL, there must have been an XError. So if we got * here we have a bug :) */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparency messed up in function resetParentPixmap")); r->h->xerror_return = LastExtensionError; } } # endif /* HAVE_LIBXRENDER */ /* * XRender or not, pmap now contains a wonderfully tinted copy of the root * background. */ if( r->h->xerror_return == Success ) { XSetWindowBackgroundPixmap( r->Xdisplay, r->TermWin.parent, pmap); /* * If we just became transparent, then make all child terminals * transparent. */ if( !r->h->am_transparent && !r->h->am_pixmap_trans ) { int i; for (i = 0; i <= LTAB(r); i ++) { XSetWindowBackgroundPixmap (r->Xdisplay, PVTS(r, i)->vt, ParentRelative); } } } /* else Caller will handle faliures */ XFreeGC( r->Xdisplay, gc); XFreePixmap( r->Xdisplay, pmap); return r->h->xerror_return == Success; } /* {{{2 rxvt_toggle_transparency(r) */ /* EXTPROTO */ void rxvt_toggle_transparency (rxvt_t* r) { register int i; if (ISSET_OPTION(r, Opt_transparent)) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "unset background transparency\n")); UNSET_OPTION(r, Opt_transparent); r->h->am_transparent = 0; r->h->am_pixmap_trans = 0; r->h->bgGrabbed = False; XSetWindowBackground (r->Xdisplay, r->TermWin.parent, VTBG(r, 0) ); for (i = 0; i <= LTAB(r); i ++) { # ifdef BACKGROUND_IMAGE if (IS_PIXMAP(PVTS(r, i)->pixmap)) XSetWindowBackgroundPixmap (r->Xdisplay, PVTS(r, i)->vt, PVTS(r, i)->pixmap); else # endif /* BACKGROUND_IMAGE */ if( i == ATAB(r) ) { /* Background colors need to be forcibly reset */ r->fgbg_tabnum = -1; rxvt_set_vt_colors( r, ATAB(r) ); } } # ifdef HAVE_SCROLLBARS if (IS_WIN(r->scrollBar.win) && ISSET_OPTION(r, Opt_transparent_scrollbar)) { # ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->scrollBar.pixmap)) XSetWindowBackgroundPixmap (r->Xdisplay, r->scrollBar.win, r->scrollBar.pixmap); else # endif /* BACKGROUND_IMAGE */ { XSetWindowBackground (r->Xdisplay, r->scrollBar.win, rxvt_scrollbar_bg(r) ); } /* The scrollbar update will not clear it's window background */ XClearWindow( r->Xdisplay, r->scrollBar.win); } # endif /* HAVE_SCROLLBARS */ # ifdef HAVE_MENUBAR if (IS_WIN(r->menuBar.win) && ISSET_OPTION(r, Opt_transparent_menubar)) { # ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->menuBar.pixmap)) XSetWindowBackgroundPixmap (r->Xdisplay, r->menuBar.win, r->menuBar.pixmap); else # endif /* BACKGROUND_IMAGE */ XSetWindowBackground (r->Xdisplay, r->menuBar.win, r->menuBar.bg); } # endif /* HAVE_MENUBAR */ if (ISSET_OPTION(r, Opt_transparent_tabbar)) { # ifdef BACKGROUND_IMAGE if (r->tabBar.hasPixmap) { long w=0, h=0; Pixmap pmap; pmap = rxvt_load_pixmap (r, r->h->rs[Rs_tabbarPixmap], &w, &h); if (IS_PIXMAP(pmap)) { XSetWindowBackgroundPixmap (r->Xdisplay, r->tabBar.win, pmap); XFreePixmap( r->Xdisplay, pmap); } else r->tabBar.hasPixmap = False; } else # endif /* BACKGROUND_IMAGE */ XSetWindowBackground (r->Xdisplay, r->tabBar.win, r->tabBar.ibg); } } else { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "set background transparency\n")); SET_OPTION(r, Opt_transparent); XSetWindowBackgroundPixmap (r->Xdisplay, r->TermWin.parent, ParentRelative); for (i = 0; i <= LTAB(r); i ++) { XSetWindowBackgroundPixmap (r->Xdisplay, PVTS(r, i)->vt, ParentRelative); } # ifdef HAVE_SCROLLBARS if (IS_WIN(r->scrollBar.win) && ISSET_OPTION(r, Opt_transparent_scrollbar)) XSetWindowBackgroundPixmap (r->Xdisplay, r->scrollBar.win, ParentRelative); # endif # ifdef HAVE_MENUBAR if (IS_WIN(r->menuBar.win) && ISSET_OPTION(r, Opt_transparent_menubar)) XSetWindowBackgroundPixmap (r->Xdisplay, r->menuBar.win, ParentRelative); # endif if (ISSET_OPTION(r, Opt_transparent_tabbar)) XSetWindowBackgroundPixmap (r->Xdisplay, r->tabBar.win, ParentRelative); XSelectInput(r->Xdisplay, XROOT, PropertyChangeMask); rxvt_check_our_parents (r); } /* Clear all windows */ XClearWindow (r->Xdisplay, r->TermWin.parent); # ifdef HAVE_SCROLLBARS rxvt_scrollbar_update (r, 0); # endif # ifdef HAVE_MENUBAR rxvt_menubar_expose (r); # endif rxvt_tabbar_expose (r, NULL); rxvt_scr_clear (r, ATAB(r)); rxvt_scr_touch (r, ATAB(r), True); } /* refreshRootBGVars(r) {{{2 * * Refresh our information about the root pixmap and it's geometry etc. This * should be called every time the desktop changes. */ /* EXTPROTO */ void refreshRootBGVars(rxvt_t *r ) { unsigned long nitems, bytes_after; Atom atype; int aformat; unsigned char *prop = NULL; r->h->allowedxerror = 1; r->h->xerror_return = Success; /* Get new root pixmap ID in h->rootPixmap*/ if ( IS_ATOM(r->h->xa[XA_XROOTPMAPID]) && XGetWindowProperty( r->Xdisplay, XROOT, r->h->xa[XA_XROOTPMAPID], 0L, 1L, False, XA_PIXMAP, &atype, &aformat, &nitems, &bytes_after, &prop) == Success && prop != NULL ) { int u_rootx, u_rooty; /* u_ variables are unused */ unsigned u_bw, u_depth; Window u_cr; r->h->rootPixmap = *( (Pixmap *) prop ); r->h->bgGrabbed = False; XFree( prop); /* Get root pixmap geometry */ XGetGeometry( r->Xdisplay, r->h->rootPixmap, &u_cr, &u_rootx, &u_rooty, &r->h->rpWidth, &r->h->rpHeight, &u_bw, &u_depth); } else /* Failed. */ UNSET_PIXMAP(r->h->rootPixmap); r->h->allowedxerror = 0; if( r->h->xerror_return != Success ) /* Set by xerror handler */ UNSET_PIXMAP(r->h->rootPixmap); rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Got %snull root pixmap %lx\n", NOT_PIXMAP(r->h->rootPixmap) ? "" : "non-", r->h->rootPixmap)); } /* {{{2 rxvt_check_our_parents(r) * * Check our parents are still who we think they are. Do transparency updates if * required. */ /* EXTPROTO */ int rxvt_check_our_parents(rxvt_t *r) { int have_changed = 0, rootdepth; XWindowAttributes wattr, wrootattr; Window u_cr; /* * We dont' really have to check our parents if we're not transparent :) */ if (NOTSET_OPTION(r, Opt_transparent)) return have_changed; rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "rxvt_check_our_parent ()\n")); /* * Don't try transparency if window depth is not the same as the root depth. */ XGetWindowAttributes(r->Xdisplay, XROOT, &wrootattr); rootdepth = wrootattr.depth; XGetWindowAttributes(r->Xdisplay, r->TermWin.parent, &wattr); if (rootdepth != wattr.depth ) { /* * Oops. We can't be transparent (or pixmap_transparent). */ assert (-1 != LTAB(r)); /* should't happen */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Bad depth, transparency failed: (%u, %u)\n", rootdepth, wattr.depth)); rxvt_msg (DBG_ERROR, DBG_TRANSPARENT, "Root window has different depth. Disabling transparency"); r->h->am_pixmap_trans = 0; UNSET_OPTION(r, (Opt_forceTransparent | Opt_transparent)); return tempDisableTransparent( r ); } /* * r->szHint should contain the correct location of this window if we got * here from a configure notify event. If we got here from reparent_notify, * then we need to set it ourselves to offset WM decorations */ XTranslateCoordinates( r->Xdisplay, r->TermWin.parent, XROOT, 0, 0, &r->szHint.x, &r->szHint.y, &u_cr); /* * Don't try refreshing our background if we're completely off screen. */ if ( r->szHint.x + r->szHint.width <= 0 || r->szHint.x >= (int) wrootattr.width || r->szHint.y + r->szHint.height <= 0 || r->szHint.y >= (int) wrootattr.height ) return 0; XSync(r->Xdisplay, False); r->h->allowedxerror = 1; r->h->xerror_return = Success; /* * Use "do" instead of "if" so we can break out if transparency updates * don't need to be performed. */ do /* while( 0 ) */ { /* * Copy XROOT pixmap transparency */ int retvt = 0; if (NOT_PIXMAP(r->h->rootPixmap)) { have_changed = tempDisableTransparent( r); break; } retvt = resetParentPixmap( r, wrootattr.width, wrootattr.height, wrootattr.depth); if (retvt ) { /* All good. */ r->h->bgGrabbed = True; r->h->prevPos.x = r->szHint.x; r->h->prevPos.y = r->szHint.y; r->h->prevPos.width = r->szHint.width; r->h->prevPos.height = r->szHint.height; have_changed = 1; r->h->am_transparent = 1; r->h->am_pixmap_trans = 0; expose_transparent_subwin( r ); rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Enabled XROOT pseudo-transparency\n")); } else have_changed = tempDisableTransparent( r); } while( 0 ); /* * Disable transparency if something went wrong above. */ r->h->allowedxerror = 0; if( r->h->xerror_return != Success && r->h->am_transparent ) /* Only call if we're still transparent (otherwise we might call * tempDisableTransparent twice). */ have_changed = tempDisableTransparent( r ); /* * 2006-01-07 gi1242: This code doesn't work too well. The problem is that * if the user sets the desktop with say xsetroot, and we recieve an expose * event, then we only refresh part of our window. This causes really ugly * effects. */ if( !r->h->am_transparent && ISSET_OPTION(r, Opt_forceTransparent) ) { /* * Try "transparent transparency" legacy code. */ Window root, oldp, *list; unsigned int i, n; /* * Make the frame window set by the window manager that have the root * background. Some window managers put multiple nested frame windows for * each client, so we have to take care about that. */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparent Seeking to %08lx\n", XROOT)); for (i = 1; i < PARENT_NUMBER; i++) { /* * Check if any of our "parents" have changed. */ oldp = r->TermWin.parenttree[i]; XQueryTree(r->Xdisplay, r->TermWin.parenttree[i - 1], &root, &r->TermWin.parenttree[i], &list, &n); XFree(list); rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparent Parent[%d] = %08lx\n", i, r->TermWin.parenttree[i] )); if (r->TermWin.parenttree[i] == XROOT) { if (IS_WIN(oldp)) have_changed = 1; break; } if (oldp != r->TermWin.parenttree[i]) have_changed = 1; } n = 0; /* * Now set background of all windows in this tree to ParentRelative. */ for (; n < (unsigned int)i; n++) { /* * Make sure we don't have any input only (or different depth) * windows. */ XGetWindowAttributes(r->Xdisplay, r->TermWin.parenttree[n], &wattr); rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparent Checking Parent[%d]: %s\n", n, (wattr.depth == rootdepth && wattr.class != InputOnly) ? "OK" : "FAIL")); if (wattr.depth != rootdepth || wattr.class == InputOnly) { n = PARENT_NUMBER + 1; break; } } if (n > PARENT_NUMBER) { /* * Bummer. We got an inputonly (or bad depth) window. Fail. */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparent Turning off\n")); if( r->h->am_pixmap_trans ) { r->h->am_pixmap_trans = 0; r->h->want_full_refresh = 1; have_changed = 1; XSetWindowBackground(r->Xdisplay, r->TermWin.parent, VTBG(r, 0) ); expose_transparent_subwin( r ); } } else { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "Transparent Turning on (%d parents). Geometry %ux%u+%d+%d\n", i - 1, r->szHint.width, r->szHint.height, r->szHint.x, r->szHint.y)); for (n = 0; n < i; n ++) XSetWindowBackgroundPixmap(r->Xdisplay, r->TermWin.parenttree[n], ParentRelative); r->h->am_pixmap_trans = 1; have_changed = 1; expose_transparent_subwin( r ); } /* * Set the tail portion of our tree to None for future calls */ for (; i < PARENT_NUMBER; i++) UNSET_WIN(r->TermWin.parenttree[i]); } rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "am_transparent: %hhu am_pixmap_trans: %hhu have_changed %d\n", r->h->am_transparent, r->h->am_pixmap_trans, have_changed)); return have_changed; } #endif /* TRANSPARENT */ /* {{{1 Background image + Transparent functions */ #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) /* {{{2 rxvt_refresh_bg_image( r, page, imediate) */ /* EXTPROTO */ void rxvt_refresh_bg_image (rxvt_t* r, int page, Bool imediate) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TRANSPARENT, "rxvt_refresh_bg_image\n")); # ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent)) { if( imediate || !r->h->bgRefreshInterval ) { /* reset background NOW */ rxvt_check_our_parents (r); rxvt_scr_clear (r, page); rxvt_scr_touch (r, page, imediate); } else { /* Generate a timeout to refresh the bg image. TODO lastCNotify * should be called something else */ gettimeofday( &r->h->lastCNotify, NULL); r->h->bgGrabbed = False; /* So timeout will force refresh */ } } else # endif /* TRANSPARENT */ { # ifdef BACKGROUND_IMAGE /* Reset background image */ register int i; for (i = 0; i <= LTAB(r); i ++) rxvt_resize_pixmap (r, i); # endif /* BACKGROUND_IMAGE */ rxvt_scr_clear (r, page); rxvt_scr_touch (r, page, imediate); } } #endif /* BACKGROUND_IMAGE || TRANSPARENT */ /* {{{1 Tinting functions */ #ifdef TINTING_SUPPORT # ifdef HAVE_LIBXRENDER /* {{{2 XRender tinting functions */ /* {{{3 xrenderShadeParentPixmap( r, pmap, nx, ny, nw, nh, shadeSubwin) * * Shade the pixmap as though it were the parent window's pixmap. The * coordinates nx, ny, nw, nh determine the location in pmap that needs to be * shaded (e.g. if the window is partially off screen, we only need to shade the * portion of pmap that's on screen). * * If shadeSubwin is true, then areas corresponding to the tab / scroll / menu * bar are tinted with their respective background colors. * * pmap should have dimensions equal to the parent window. */ /* EXTPROTO */ void xrenderShadeParentPixmap( rxvt_t *r, Pixmap pmap, int nx, int ny, unsigned nw, unsigned nh, Bool shadeSubwin) { int rx = 0, ry = 0; /* coords of tabbar etc */ unsigned rw = TWIN_WIDTH (r), /* dims of tabbar etc */ rh = TWIN_HEIGHT (r); Picture pic; XRenderPictFormat *format; XRenderPictureAttributes attrs; format = XRenderFindVisualFormat( r->Xdisplay, XVISUAL); pic = XRenderCreatePicture( r->Xdisplay, pmap, format, 0, &attrs); if( shadeSubwin ) { # ifdef HAVE_MENUBAR if( rxvt_menubar_visible( r ) ) { /* Shade menubar */ if (ISSET_OPTION(r, Opt_transparent_menubar)) xrenderShadeIntersect( r, pic, r->menuBar.bg, r->TermWin.shade, nx, ny, nw, nh, 0, 0, rw, rxvt_menubar_height(r)); /* Reset coordinates to shade tabbar / main window. */ ry += rxvt_menubar_height (r); rh -= rxvt_menubar_height (r); } # endif if( rxvt_tabbar_visible( r ) ) { /* Shade tabbar */ if (ISSET_OPTION(r, Opt_transparent_tabbar)) xrenderShadeIntersect( r, pic, r->tabBar.ibg, r->TermWin.shade, nx, ny, nw, nh, 0, ry + (ISSET_OPTION(r, Opt2_bottomTabbar) ? VT_HEIGHT(r) : 0), rw, rxvt_tabbar_height( r )); /* Reset coordinates to shade main window. */ rh -= rxvt_tabbar_height( r ); if ( NOTSET_OPTION(r, Opt2_bottomTabbar) ) ry += rxvt_tabbar_height( r ); } # ifdef HAVE_SCROLLBARS if( rxvt_scrollbar_visible( r ) ) { /* Shade scrollbar */ if (ISSET_OPTION(r, Opt_transparent_scrollbar)) xrenderShadeIntersect( r, pic, rxvt_scrollbar_bg(r), r->TermWin.shade, nx, ny, nw, nh, ISSET_OPTION(r, Opt_scrollBar_right) ? VT_WIDTH(r) : 0, ry, rxvt_scrollbar_width(r), VT_HEIGHT(r)); /* Reset coordinates to shade main window. */ rw -= rxvt_scrollbar_width(r); if( NOTSET_OPTION(r, Opt_scrollBar_right) ) rx += rxvt_scrollbar_width(r); } # endif } /* Shade root background. */ xrenderShadeIntersect( r, pic, ISSET_PIXCOLOR( r->h, Color_tint ) ? r->pixColorsFocus[Color_tint] : VTBG(r, 0), r->TermWin.shade, nx, ny, nw, nh, rx, ry, rw, rh); /* * Free everything and get lost. */ XRenderFreePicture( r->Xdisplay, pic); } /* {{{3 xrenderShadeIntersect( r, pic, pixel, shade, (rect1), (rect2)) * Shade the intersection of two rectangles */ /* INTPROTO */ void xrenderShadeIntersect( rxvt_t *r, Picture pic, unsigned long pixel, int shade, int x1, int y1, unsigned w1, unsigned h1, int x2, int y2, unsigned w2, unsigned h2) { int x, y; unsigned w, h; XColor color; XRenderColor trans_color; if( x1 + w1 < x2 || x2 + w2 < x1 || y1 + h1 < y2 || y2 + h2 < y1) return; /* disjoint */ /* * Get intersection in (x, y, w, h) */ x = (x1 < x2) ? x2 : x1; y = (y1 < y2) ? y2 : y1; w = ((x1 + w1 < x2 + w2) ? x1 + w1 : x2 + w2) - x; h = ((y1 + h1 < y2 + h2) ? y1 + h1 : y2 + h2) - y; /* * Get XRenderColor from pixel and shade. */ color.pixel = pixel; XQueryColor (r->Xdisplay, XCMAP, &color); trans_color.red = color.red; trans_color.green = color.green; trans_color.blue = color.blue; trans_color.alpha = ( (100 - shade) * (0xffff / 100) ); /* * Fill translucent. Don't know if PictOpOver is the best operation to use * or not ... */ XRenderFillRectangle( r->Xdisplay, PictOpOver, pic, &trans_color, x, y, w, h); } /* {{{3 Unimplemented stuff */ #if 0 int xrenderCopyShadedPixmap( rxvt_t *r, Drawable src, Drawable dst, XRenderColor *color, int x, int y, unsigned width, unsigned height, int dx, dy) { } #endif /* }}}2 */ # else /* HAVE_LIBXRENDER */ /* {{{2 Fast tinting functions */ /* {{{3 rxvt_shade_pixmap(r, src, (rect)) */ /* EXTPROTO */ void rxvt_shade_pixmap (rxvt_t* r, Drawable src, int sx, int sy, unsigned nw, unsigned nh) { XImage* ximage; GC gc = XCreateGC (r->Xdisplay, src, 0UL, 0); ximage = XGetImage(r->Xdisplay, src, sx, sy, nw, nh, AllPlanes, ZPixmap); if (NULL != ximage) { shade_ximage (r, ximage); XPutImage(r->Xdisplay, src, gc, ximage, 0, 0, sx, sy, nw, nh); XDestroyImage (ximage); } XFreeGC( r->Xdisplay, gc); } /* {{{3 shade_ximage(r, image) * * Tint XImage with color / degree from options. */ /* INTPROTO */ static void shade_ximage (rxvt_t* r, XImage* srcImage) { int sh_r, sh_g, sh_b; uint32_t mask_r, mask_g, mask_b; uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; unsigned int lower_lim_r, lower_lim_g, lower_lim_b; unsigned int upper_lim_r, upper_lim_g, upper_lim_b; int i; Visual* visual = XVISUAL; XColor color; /* Former arguments */ int shade, rm, gm, bm; if (ISSET_PIXCOLOR (r->h, Color_tint) && r->h->rs[Rs_shade]) { color.pixel = r->pixColorsFocus[Color_tint]; XQueryColor (r->Xdisplay, XCMAP, &color); shade = r->TermWin.shade; } else return; /* No shading defined */ rm = color.red; gm = color.green; bm = color.blue; if (100 == shade) /* no need to shade */ return; if( visual->class != TrueColor || srcImage->format != ZPixmap ) return ; rxvt_dbgmsg ((DBG_DEBUG, DBG_TRANSPARENT, "shade background image\n")); /* for convenience */ mask_r = visual->red_mask; mask_g = visual->green_mask; mask_b = visual->blue_mask; /* boring lookup table pre-initialization */ switch (srcImage->bits_per_pixel) { case 15: if ((mask_r != 0x7c00) || (mask_g != 0x03e0) || (mask_b != 0x001f)) return; lookup = (uint32_t *) rxvt_malloc (sizeof (uint32_t)*(32+32+32)); lookup_r = lookup; lookup_g = lookup+32; lookup_b = lookup+32+32; sh_r = 10; sh_g = 5; sh_b = 0; break; case 16: if ((mask_r != 0xf800) || (mask_g != 0x07e0) || (mask_b != 0x001f)) return; lookup = (uint32_t *) rxvt_malloc (sizeof (uint32_t)*(32+64+32)); lookup_r = lookup; lookup_g = lookup+32; lookup_b = lookup+32+64; sh_r = 11; sh_g = 5; sh_b = 0; break; case 24: if ((mask_r != 0xff0000) || (mask_g != 0x00ff00) || (mask_b != 0x0000ff)) return; lookup = (uint32_t *) rxvt_malloc (sizeof (uint32_t)*(256+256+256)); lookup_r = lookup; lookup_g = lookup+256; lookup_b = lookup+256+256; sh_r = 16; sh_g = 8; sh_b = 0; break; case 32: if ((mask_r != 0xff0000) || (mask_g != 0x00ff00) || (mask_b != 0x0000ff)) return; lookup = (uint32_t *) rxvt_malloc (sizeof (uint32_t)*(256+256+256)); lookup_r = lookup; lookup_g = lookup+256; lookup_b = lookup+256+256; sh_r = 16; sh_g = 8; sh_b = 0; break; default: return; /* we do not support this color depth */ } /* prepare limits for color transformation (each channel is ** handled separately) */ if (shade < 0) { shade = -shade; if (shade < 0) shade = 0; if (shade > 100) shade = 100; lower_lim_r = 65535-rm; lower_lim_g = 65535-gm; lower_lim_b = 65535-bm; lower_lim_r = 65535-(unsigned int)(((uint32_t)lower_lim_r)*((uint32_t)shade)/100); lower_lim_g = 65535-(unsigned int)(((uint32_t)lower_lim_g)*((uint32_t)shade)/100); lower_lim_b = 65535-(unsigned int)(((uint32_t)lower_lim_b)*((uint32_t)shade)/100); upper_lim_r = upper_lim_g = upper_lim_b = 65535; } else { if (shade < 0) shade = 0; if (shade > 100) shade = 100; lower_lim_r = lower_lim_g = lower_lim_b = 0; upper_lim_r = (unsigned int)((((uint32_t)rm)*((uint32_t)shade))/100); upper_lim_g = (unsigned int)((((uint32_t)gm)*((uint32_t)shade))/100); upper_lim_b = (unsigned int)((((uint32_t)bm)*((uint32_t)shade))/100); } /* switch red and blue bytes if necessary, we need it for some ** weird XServers like XFree86 3.3.3.1 */ if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) { unsigned int tmp; tmp = lower_lim_r; lower_lim_r = lower_lim_b; lower_lim_b = tmp; tmp = upper_lim_r; upper_lim_r = upper_lim_b; upper_lim_b = tmp; } /* fill our lookup tables */ for (i = 0; i <= mask_r>>sh_r; i++) { uint32_t tmp; tmp = ((uint32_t)i)*((uint32_t)(upper_lim_r-lower_lim_r)); tmp += ((uint32_t)(mask_r>>sh_r))*((uint32_t)lower_lim_r); lookup_r[i] = (tmp/65535)<>sh_g; i++) { uint32_t tmp; tmp = ((uint32_t)i)*((uint32_t)(upper_lim_g-lower_lim_g)); tmp += ((uint32_t)(mask_g>>sh_g))*((uint32_t)lower_lim_g); lookup_g[i] = (tmp/65535)<>sh_b; i++) { uint32_t tmp; tmp = ((uint32_t)i)*((uint32_t)(upper_lim_b-lower_lim_b)); tmp += ((uint32_t)(mask_b>>sh_b))*((uint32_t)lower_lim_b); lookup_b[i] = (tmp/65535)<bits_per_pixel) { case 15: { unsigned short *p1, *pf, *p, *pl; p1 = (unsigned short *) srcImage->data; pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); while (p1 < pf) { p = p1; pl = p1 + srcImage->width; for (; p < pl; p++) { *p = lookup_r[(*p & 0x7c00)>>10] | lookup_g[(*p & 0x03e0)>> 5] | lookup_b[(*p & 0x001f)]; } p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); } break; } case 16: { unsigned short *p1, *pf, *p, *pl; p1 = (unsigned short *) srcImage->data; pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); while (p1 < pf) { p = p1; pl = p1 + srcImage->width; for (; p < pl; p++) { *p = lookup_r[(*p & 0xf800)>>11] | lookup_g[(*p & 0x07e0)>> 5] | lookup_b[(*p & 0x001f)]; } p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); } break; } case 24: { unsigned char *p1, *pf, *p, *pl; p1 = (unsigned char *) srcImage->data; pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); while (p1 < pf) { p = p1; pl = p1 + srcImage->width * 3; for (; p < pl; p += 3) { p[0] = lookup_r[(p[0] & 0xff0000)>>16]; p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; p[2] = lookup_r[(p[2] & 0x0000ff)]; } p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); } break; } case 32: { uint32_t *p1, *pf, *p, *pl; p1 = (uint32_t *) srcImage->data; pf = (uint32_t *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); while (p1 < pf) { p = p1; pl = p1 + srcImage->width; for (; p < pl; p++) { *p = lookup_r[(*p & 0xff0000)>>16] | lookup_g[(*p & 0x00ff00)>> 8] | lookup_b[(*p & 0x0000ff)] | (*p & ~0xffffff); } p1 = (uint32_t *) ((char *) p1 + srcImage->bytes_per_line); } break; } } rxvt_free (lookup); } /* }}}2 */ # endif /* HAVE_LIBXRENDER */ #endif /* TINTING_SUPPORT */ mrxvt-0.5.4/src/strings.c0000644000175000001440000003117010756127602012251 00000000000000/*--------------------------------*-C-*---------------------------------* * File: strings.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2003-2004 Marc Lehmann * Copyright (c) 2004-2005 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef HAVE_WCHAR_H # if !defined (OS_FREEBSD) || _FreeBSD_version >= 500000 /* EXTPROTO */ char* rxvt_wcstombs (const wchar_t* str, int len) { mbstate_t mbs; char* r; char* dst; if (len < 0) len = wcslen (str); memset (&mbs, 0, sizeof (mbs)); r = (char *)rxvt_malloc (len * MB_CUR_MAX + 1); dst = r; while (len--) { int l = wcrtomb (dst, *str++, &mbs); if (l < 0) *dst++ = '?'; else dst += l; } *dst++ = 0; return r; } /* EXTPROTO */ wchar_t* rxvt_mbstowcs (const char* str) { wchar_t* r; int len = STRLEN (str); r = (wchar_t *)rxvt_malloc ((len + 1) * sizeof (wchar_t)); if (mbstowcs (r, str, len + 1) < 0) *r = 0; return r; } /* EXTPROTO */ char* rxvt_wcstoutf8 (const wchar_t* str) { char* r; char* p; int len; len = wcslen (str); r = (char *)rxvt_malloc (len * 4 + 1); p = r; while (len--) { unicode_t w = *str++ & UNICODE_MASK; if (w < 0x000080) *p++ = w; else if (w < 0x000800) { *p++ = 0xc0 | ( w >> 6); *p++ = 0x80 | ( w & 0x3f); } else if (w < 0x010000) { *p++ = 0xe0 | ( w >> 12 ); *p++ = 0x80 | ((w >> 6) & 0x3f); *p++ = 0x80 | ( w & 0x3f); } else if (w < 0x110000) { *p++ = 0xf0 | ( w >> 18); *p++ = 0x80 | ((w >> 12) & 0x3f); *p++ = 0x80 | ((w >> 6) & 0x3f); *p++ = 0x80 | ( w & 0x3f); } else *p++ = '?'; } *p = 0; return r; } /* EXTPROTO */ wchar_t* rxvt_utf8towcs (const char* str) { wchar_t* r; wchar_t* p; unsigned char* s; unsigned char* e; int len = STRLEN(str); r = (wchar_t *)rxvt_malloc ((len + 1) * sizeof (wchar_t)), p = r; s = (unsigned char*)str, e = s + len; while (1) { len = e - s; if (len == 0) break; else if (s[0] < 0x80) *p++ = *s++; else if (len >= 2 && (s[0] >= 0xc2 && s[0] <= 0xdf) && (s[1] & 0xc0) == 0x80) { *p++ = ((s[0] & 0x1f) << 6) | (s[1] & 0x3f); s += 2; } else if (len >= 3 && ((s[0] == 0xe0 && s[1] >= 0xa0 && s[1] <= 0xbf) || (s[0] >= 0xe1 && s[0] <= 0xec && s[1] >= 0x80 && s[1] <= 0xbf) || (s[0] == 0xed && s[1] >= 0x80 && s[1] <= 0x9f) || (s[0] >= 0xee && s[0] <= 0xef && s[1] >= 0x80 && s[1] <= 0xbf) ) && (s[2] & 0xc0) == 0x80) { *p++ = ((s[0] & 0x0f) << 12) | ((s[1] & 0x3f) << 6) | (s[2] & 0x3f); s += 3; } else if (len >= 4 && ((s[0] == 0xf0 && s[1] >= 0x90 && s[1] <= 0xbf) || (s[0] >= 0xf1 && s[0] <= 0xf3 && s[1] >= 0x80 && s[1] <= 0xbf) || (s[0] == 0xf4 && s[1] >= 0x80 && s[1] <= 0x8f)) && (s[2] & 0xc0) == 0x80 && (s[3] & 0xc0) == 0x80) { *p++ = ((s[0] & 0x07) << 18) | ((s[1] & 0x3f) << 12) | ((s[2] & 0x3f) << 6) | (s[3] & 0x3f); s += 4; } else { *p++ = 0xfffd; s++; } } /* while (1) */ *p = 0; return r; } # endif /* !defined (OS_FREEBSD) ||... */ #endif /* HAVE_WCHAR_H */ /*----------------------------------------------------------------------*/ /* * a replacement for strcasecmp() to avoid linking an entire library. * Mark Olesen added this in 2.15 but for which OS & library? - Geoff Wing */ /* EXTPROTO */ int ma_strcasecmp(const char *s1, const char *s2) { for ( ; tolower((int) *s1) == tolower((int) *s2); s1++, s2++) if (!*s1) return 0; return (int)(tolower((int) *s1) - tolower((int) *s2)); } /* EXTPROTO */ int ma_strncasecmp(const char *s1, const char *s2, size_t n) { for ( ; n-- && (tolower((int) *s1) == tolower((int) *s2)); s1++, s2++) if (!*s1) return 0; if (n == 0) return 0; return (int)(tolower((int) *s1) - tolower((int) *s2)); } /* EXTPROTO */ char* ma_strcpy(char *d, const char *s) { char *r = d; for ( ; (*r++ = *s++) != '\0'; ) ; return d; } /* EXTPROTO */ char* ma_strncpy(char *d, const char* s, size_t len) { char *r = d; if (len) for ( ; len; len--) if ((*r++ = *s++) == '\0') { for ( ; --len; ) *r++ = '\0'; break; } return d; } /* EXTPROTO */ int ma_strcmp(const char *s1, const char *s2) { for ( ; (*s1 == *s2++); ) if (*s1++ == '\0') return 0; return (int) ((unsigned char) *s1 - (unsigned char) *--s2); } /* EXTPROTO */ int ma_strncmp(const char *s1, const char *s2, size_t len) { if (len) { for ( ; len-- && (*s1++ == *s2++); ) ; if (++len) return (int) ((unsigned char) *--s1 - (unsigned char) *--s2); } return 0; } /* EXTPROTO */ char* ma_strcat(char *s1, const char *s2) { char *r = s1; if (*r != '\0') for ( ; *++r != '\0'; ) ; for ( ; (*r++ = *s2++) != '\0'; ) ; return s1; } /* EXTPROTO */ char* ma_strncat(char *s1, const char *s2, size_t len) { char *r = s1; if (*r != '\0') for ( ; *++r != '\0'; ) ; for ( ; len-- && ((*r++ = *s2++) != '\0'); ) ; *r = '\0'; return s1; } /* EXTPROTO */ size_t ma_strlen(const char *s) { size_t len = 0; for ( ; *s++ != '\0'; len++) ; return len; } /* EXTPROTO */ char* ma_strdup(const char *s) { int len = STRLEN(s) + 1; char* c; assert (len > 0); /* possible integer overflow? */ if ((c = rxvt_malloc(len)) != NULL) MEMCPY(c, s, len); return c; } /* EXTPROTO */ char UNTAINTED * ma_strndup(const char TAINTED * s, size_t sz) { char* c; int len = sz + 1; assert (len > 0); /* possible integer overflow? */ if ((c = rxvt_malloc(len)) != NULL) STRNCPY(c, s, sz); c[sz] = '\0'; return c; } /* EXTPROTO */ char* ma_index(const char* s, int c) { return STRCHR(s, c); } /* EXTPROTO */ char* ma_strchr(const char* s, int c) { char *p = NULL; for (;;) { if (*s == (char)c) { p = (char *)s; break; } if (*s++ == '\0') break; } return p; } /* EXTPROTO */ char* ma_rindex(const char* s, int c) { return STRRCHR(s, c); } /* EXTPROTO */ char* ma_strrchr(const char* s, int c) { char *p = NULL; for (;;) { if (*s == (char)c) p = (char *)s; if (*s++ == '\0') break; } return p; } /* EXTPROTO */ void* ma_memcpy(void *s1, const void *s2, size_t len) { /* has extra stack and time but less code space */ return MEMMOVE(s1, s2, len); } /*--------------------------------------------------------------------------* * Possibly faster memmove() by Geoff Wing *--------------------------------------------------------------------------*/ /* EXTPROTO */ void* ma_memmove(void *d, const void *s, size_t len) { unsigned int i; unsigned int* pdst; unsigned int* psrc; unsigned char* dst = (unsigned char *)d; unsigned char* src = (unsigned char *)s; if (len && d != s) { if ((unsigned int)d < (unsigned int)s) { /* forwards */ i = (-(unsigned int)dst) & (sizeof (unsigned int*) - 1); if (len >= 16 && i == ((-(unsigned int)src) & (SIZEOF_INT_P - 1))) { /* speed up since src & dst are offset correctly */ len -= (size_t)i; for ( ; i--; ) *dst++ = *src++; /* assign the src/dst to psrc/pdst */ pdst = (unsigned int*) dst; psrc = (unsigned int*) src; for (i = (unsigned int)(len / sizeof (unsigned int*)); i--; ) *pdst++ = *psrc++; len &= (SIZEOF_INT_P - 1); /* assign back the src/dst */ dst = (unsigned char*) pdst; src = (unsigned char*) psrc; } /* the left bytes */ for ( ; len--; ) *dst++ = *src++; } else { /* backwards */ dst += len; src += len; i = ((unsigned int)dst) & (sizeof (unsigned int*) - 1); if (len >= 16 && i == (((unsigned int)src) & (SIZEOF_INT_P - 1))) { /* speed up since src & dst are offset correctly */ len -= (size_t)i; for ( ; i--; ) *--dst = *--src; /* assign the src/dst to psrc/pdst */ pdst = (unsigned int*) dst; psrc = (unsigned int*) src; for (i = (unsigned int)(len / sizeof (unsigned int*)); i--; ) *--pdst = *--psrc; len &= (SIZEOF_INT_P - 1); /* assign back the src/dst */ dst = (unsigned char*) pdst; src = (unsigned char*) psrc; } /* the left bytes */ for ( ; len--; ) *--dst = *--src; } } return d; } /*--------------------------------------------------------------------------* * Possibly faster memset() by Geoff Wing * presumptions: * 1) intp_t write the best * 2) SIZEOF_INT_P == power of 2 *--------------------------------------------------------------------------*/ /* EXTPROTO */ void ma_bzero(void* buf, size_t len) { MEMSET(buf, 0, len); } /* EXTPROTO */ void* ma_memset(void *p, int c1, size_t len) { unsigned int i, val; unsigned int* pdst; unsigned char c = (unsigned char) c1; unsigned char *lp = (unsigned char *) p; if (len) { if (len >= 16) { /* ** < 16 probably not worth all the calculations ** write out preceding characters so we align on an ** integer boundary */ if ((i = ((-(unsigned int)p) & (SIZEOF_INT_P - 1)))) { len -= (size_t)i; for (; i--;) *lp++ = c; } /* do the fast writing */ val = (c << 8) + c; #if SIZEOF_INT_P >= 4 val |= (val << 16); #endif #if SIZEOF_INT_P >= 8 val |= (val << 32); #endif #if SIZEOF_INT_P == 16 val |= (val << 64); #endif /* assign the lp to pdst */ pdst = (unsigned int*) lp; for (i = (unsigned int)(len / SIZEOF_INT_P); i--;) *pdst++ = val; len &= (SIZEOF_INT_P - 1); /* assign back the pdst to lp */ lp = (unsigned char*) pdst; } /* write trailing characters */ for (; len--;) *lp++ = c; } return p; } /* Stolen verbatim (and indented to ts=4) from glibc-2.3.5. Replacement for * cygwin's missing strcasestr function. */ typedef unsigned chartype; #define TOLOWER(c) tolower( (c) ) /* EXTPROTO */ char * ma_strcasestr (phaystack, pneedle) const char *phaystack; const char *pneedle; { register const unsigned char *haystack, *needle; register chartype b, c; haystack = (const unsigned char *) phaystack; needle = (const unsigned char *) pneedle; b = TOLOWER (*needle); if (b != '\0') { haystack--; /* possible ANSI violation */ do { c = *++haystack; if (c == '\0') goto ret0; } while (TOLOWER (c) != (int) b); c = TOLOWER (*++needle); if (c == '\0') goto foundneedle; ++needle; goto jin; for (;;) { register chartype a; register const unsigned char *rhaystack, *rneedle; do { a = *++haystack; if (a == '\0') goto ret0; if (TOLOWER (a) == (int) b) break; a = *++haystack; if (a == '\0') goto ret0; shloop: ; } while (TOLOWER (a) != (int) b); jin: a = *++haystack; if (a == '\0') goto ret0; if (TOLOWER (a) != (int) c) goto shloop; rhaystack = haystack-- + 1; rneedle = needle; a = TOLOWER (*rneedle); if (TOLOWER (*rhaystack) == (int) a) do { if (a == '\0') goto foundneedle; ++rhaystack; a = TOLOWER (*++needle); if (TOLOWER (*rhaystack) != (int) a) break; if (a == '\0') goto foundneedle; ++rhaystack; a = TOLOWER (*++needle); } while (TOLOWER (*rhaystack) == (int) a); needle = rneedle; /* took the register-poor approach */ if (a == '\0') break; } } foundneedle: return (char*) haystack; ret0: return 0; } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/command.c0000644000175000001440000054456611035227260012210 00000000000000/*--------------------------------*-C-*---------------------------------* * File: command.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey * Copyright (c) 1994 Robert Nation * Copyright (c) 1995 Garrett D'Amore * Copyright (c) 1995 Steven Hirsch * Copyright (c) 1995 Jakub Jelinek * Copyright (c) 1997 MJ Olesen * Copyright (c) 1997 Raul Garcia Garcia * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 1998-2001 Geoff Wing * Copyright (c) 1998 Alfredo K. Kojima * Copyright (c) 2001 Marius Gedminas * Copyright (c) 2003 Rob McMullen * Copyright (c) 2004 Terry Griffin * Copyright (c) 2005 Johann 'Mykraverk' Oskarsson * * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef USE_DEADKEY /* ** Deadkey sequences table. */ typedef struct _DeadKeyChar { KeySym ks; /* keysym */ KeySym dk; /* accent */ KeySym ach; /* accent keysym */ } DeadKeyChar; static DeadKeyChar dkc_tab[] = { {XK_A, XK_grave, XK_Agrave}, {XK_A, XK_acute, XK_Aacute}, {XK_A, XK_apostrophe, XK_Aacute}, {XK_A, XK_asciicircum, XK_Acircumflex}, {XK_A, XK_asciitilde, XK_Atilde}, {XK_A, XK_quotedbl, XK_Adiaeresis}, {XK_a, XK_grave, XK_agrave}, {XK_a, XK_acute, XK_aacute}, {XK_a, XK_apostrophe, XK_aacute}, {XK_a, XK_asciicircum, XK_acircumflex}, {XK_a, XK_asciitilde, XK_atilde}, {XK_a, XK_quotedbl, XK_adiaeresis}, {XK_C, XK_grave, XK_Ccedilla}, {XK_C, XK_acute, XK_Ccedilla}, {XK_c, XK_grave, XK_ccedilla}, {XK_c, XK_acute, XK_ccedilla}, {XK_E, XK_grave, XK_Egrave}, {XK_E, XK_acute, XK_Eacute}, {XK_E, XK_apostrophe, XK_Eacute}, {XK_E, XK_asciicircum, XK_Ecircumflex}, {XK_E, XK_quotedbl, XK_Ediaeresis}, {XK_e, XK_grave, XK_egrave}, {XK_e, XK_acute, XK_eacute}, {XK_e, XK_apostrophe, XK_eacute}, {XK_e, XK_asciicircum, XK_ecircumflex}, {XK_e, XK_quotedbl, XK_ediaeresis}, {XK_I, XK_grave, XK_Igrave}, {XK_I, XK_acute, XK_Iacute}, {XK_I, XK_apostrophe, XK_Iacute}, {XK_I, XK_asciicircum, XK_Icircumflex}, {XK_I, XK_quotedbl, XK_Idiaeresis}, {XK_i, XK_grave, XK_igrave}, {XK_i, XK_acute, XK_iacute}, {XK_i, XK_apostrophe, XK_iacute}, {XK_i, XK_asciicircum, XK_icircumflex}, {XK_i, XK_quotedbl, XK_idiaeresis}, {XK_N, XK_asciitilde, XK_Ntilde}, {XK_n, XK_asciitilde, XK_ntilde}, {XK_O, XK_grave, XK_Ograve}, {XK_O, XK_acute, XK_Oacute}, {XK_O, XK_apostrophe, XK_Oacute}, {XK_O, XK_asciicircum, XK_Ocircumflex}, {XK_O, XK_asciitilde, XK_Otilde}, {XK_O, XK_quotedbl, XK_Odiaeresis}, {XK_o, XK_grave, XK_ograve}, {XK_o, XK_acute, XK_oacute}, {XK_o, XK_apostrophe, XK_oacute}, {XK_o, XK_asciicircum, XK_ocircumflex}, {XK_o, XK_asciitilde, XK_otilde}, {XK_o, XK_quotedbl, XK_odiaeresis}, {XK_U, XK_grave, XK_Ugrave}, {XK_U, XK_acute, XK_Uacute}, {XK_U, XK_apostrophe, XK_Uacute}, {XK_U, XK_asciicircum, XK_Ucircumflex}, {XK_U, XK_quotedbl, XK_Udiaeresis}, {XK_u, XK_grave, XK_ugrave}, {XK_u, XK_acute, XK_uacute}, {XK_u, XK_apostrophe, XK_uacute}, {XK_u, XK_asciicircum, XK_ucircumflex}, {XK_u, XK_quotedbl, XK_udiaeresis}, {XK_Y, XK_acute, XK_Yacute}, {XK_Y, XK_apostrophe, XK_Yacute}, {XK_y, XK_acute, XK_yacute}, {XK_y, XK_apostrophe, XK_yacute}, {XK_y, XK_quotedbl, XK_ydiaeresis}, {0, 0, 0}, }; # define DEADKEY_CHAR_NUMBER (int)((sizeof(dkc_tab) / sizeof(DeadKeyChar))) #endif /* USE_DEADKEY */ /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ void rxvt_process_keypress (rxvt_t*, XKeyEvent*); void rxvt_clean_cmd_page (rxvt_t*); int static inline rxvt_cmdbuf_has_input ( rxvt_t *r, int page ); int rxvt_find_cmd_child (rxvt_t*); void rxvt_check_cmdbuf (rxvt_t*, int); int rxvt_read_child_cmdfd (rxvt_t*, int, unsigned int); void rxvt_process_children_cmdfd (rxvt_t*, fd_set*); int rxvt_check_quick_timeout (rxvt_t*); int rxvt_adjust_quick_timeout (rxvt_t*, int, struct timeval*); void rxvt_refresh_vtscr_if_needed (rxvt_t*); unsigned char rxvt_cmd_getc (rxvt_t*, int* page); #ifdef POINTER_BLANK void rxvt_pointer_blank (rxvt_t*, int); #endif void rxvt_mouse_report (rxvt_t*, const XButtonEvent*); void rxvt_set_bg_focused (rxvt_t*, int, Bool); #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) void rxvt_process_keyrelease (rxvt_t*, XKeyEvent*); #endif void rxvt_scrollbar_dispatcher (rxvt_t*, int, XButtonEvent*); void rxvt_process_buttonpress (rxvt_t*, int, XButtonEvent*); #ifdef MOUSE_WHEEL void rxvt_process_wheel_button (rxvt_t*, int, XButtonEvent*); #endif void rxvt_process_buttonrelease (rxvt_t*, int, XButtonEvent*); void rxvt_process_clientmessage (rxvt_t*, XClientMessageEvent*); void rxvt_process_visibilitynotify (rxvt_t*, XVisibilityEvent*); #ifdef MONITOR_ENTER_LEAVE void rxvt_process_enter (rxvt_t*, XCrossingEvent*); void rxvt_process_leave (rxvt_t*, XCrossingEvent*); #endif void rxvt_change_colors_on_focus (rxvt_t*); void rxvt_process_focusin (rxvt_t*, XFocusChangeEvent*); void rxvt_process_focusout (rxvt_t*, XFocusChangeEvent*); int rxvt_calc_colrow (rxvt_t* r, unsigned int width, unsigned int height); void rxvt_resize_sub_windows (rxvt_t* r); void rxvt_resize_on_configure (rxvt_t* r, unsigned int width, unsigned int height); #ifndef NO_FRILLS Bool getWMStruts (Display *dpy, Window w, CARD32 *left, CARD32 *right, CARD32 *top, CARD32 *bottom); #endif void rxvt_process_configurenotify (rxvt_t*, XConfigureEvent*); void rxvt_process_selectionnotify (rxvt_t*, XSelectionEvent*); void rxvt_process_propertynotify (rxvt_t*, XEvent*); void rxvt_process_expose (rxvt_t*, XEvent*); void rxvt_process_motionnotify (rxvt_t*, XEvent*); void rxvt_process_x_event (rxvt_t*, XEvent*); #ifdef PRINTPIPE void rxvt_process_print_pipe (rxvt_t*, int); #endif void rxvt_process_nonprinting (rxvt_t*, int, unsigned char); void rxvt_process_escape_vt52 (rxvt_t*, int, unsigned char); void rxvt_process_escape_seq (rxvt_t*, int); void rxvt_process_csi_seq (rxvt_t*, int); #ifndef NO_FRILLS void rxvt_process_window_ops (rxvt_t*, int, const int*, unsigned int); #endif unsigned char* rxvt_get_to_st (rxvt_t*, int, unsigned char*); void rxvt_process_dcs_seq (rxvt_t*, int); void rxvt_process_osc_seq (rxvt_t*, int); void rxvt_xwsh_seq (rxvt_t*, int, const char*); void rxvt_process_xwsh_seq (rxvt_t*, int); int rxvt_privcases (rxvt_t*, int, int, uint32_t); void rxvt_process_terminal_mode (rxvt_t*, int, int, int, unsigned int, const int*); void rxvt_process_sgr_mode (rxvt_t*, int, unsigned int, const int*); void rxvt_process_graphics (rxvt_t*, int); void rxvt_process_getc (rxvt_t*, int, unsigned char); /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /* {{{ Process keysyms between 0xff00 and 0xffff */ /* * SET_TILDE_KEY_SEQ( kbuf, str): Copies a escape sequences (ending with ~) into * kbuf. * * Rxvt style modifiers: The trailing tilde is replaced with $, ^, or @ * depending on the modifier pressed: * * No modifier ~ * Shift $ * Ctrl ^ * Ctrl+Shift @ * * The meta modifier is ignored. * * Xterm style modifiers (if XTERM_KEYS is defined): Adds a parameter ";%d" * before the trailing "~" if a modifier is pressed: * * None Nothing is added. * Shift 2 = 1(None)+1(Shift) * Alt 3 = 1(None)+2(Alt) * Alt+Shift 4 = 1(None)+1(Shift)+2(Alt) * Ctrl 5 = 1(None)+4(Ctrl) * Ctrl+Shift 6 = 1(None)+1(Shift)+4(Ctrl) * Ctrl+Alt 7 = 1(None)+2(Alt)+4(Ctrl) * Ctrl+Alt+Shift 8 = 1(None)+1(Shift)+2(Alt)+4(Ctrl) * * This is better because DEC sequences that don't end in a tilde can also * contain a modifier parameter / number. NOTE: Xterm also has a bunch of * sequences when Meta is pressed, which we don't implement. * */ #ifdef XTERM_KEYS # define SET_TILDE_KEY_SEQ( kbuf, str ) \ set_xterm_key_seq( (kbuf), str, str ";%d%c", '~', ctrl, meta, shft ) #else # define SET_TILDE_KEY_SEQ( kbuf, str ) \ sprintf( kbuf, str "%c", shft ? (ctrl ? '@' : '$') : (ctrl ? '^' : '~') ) #endif /* * Copies sequence into kbuf. * * If no modifiers (ctrl, meta, shft) are pressed, then the character suffix is * appended to umod_prefix, and copied into kbuf. * * Otherwise, mod_format is sprintf'ed into kbuf. The third arg to sprintf is * the modifier number (computed from which modifier is pressed in the same way * as xterm does). The fourth argument is the character suffix. */ /* NOPROTO */ void set_xterm_key_seq( unsigned char *kbuf, const char *umod_prefix, const char *mod_prefix_format, char suffix, int ctrl, int meta, int shft) { if( ctrl || meta || shft ) sprintf( (char*) kbuf, mod_prefix_format, 1 + (shft ? 1 : 0) + (meta ? 2 : 0) + (ctrl ? 4 : 0), suffix ); else sprintf( (char*) kbuf, "%s%c", umod_prefix, suffix ); } /* INTPRO */ int rxvt_0xffxx_keypress (rxvt_t* r, KeySym keysym, int ctrl, int meta, int shft, unsigned char* kbuf) { /* * 2006-04-08 gi1242: The KeyPad is treated as follows: * * 1. If NumLock is on: Unmodified keys send the regular char. Modified * keys send the DEC sequence in private mode, and the regular char * in normal model. * * 2. If NumLock is off: Keys always send the DEC private mode * sequence. */ /* * B: beginning of a {} body */ unsigned int newlen = 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "0xffxx_keypress: (C%d, M%d, S%d) %lx ...", ctrl, meta, shft, keysym)); switch (keysym) { #ifndef NO_BACKSPACE_KEY case XK_BackSpace: { unsigned char *bsKbuf = kbuf; if ( meta # ifdef META8_OPTION && (r->h->meta_char == C0_ESC) # endif ) { /* 7bit mode. Prefix with C0_ESC */ *(bsKbuf++) = C0_ESC; newlen++; meta = 0; } if (ISSET_PMODE(r, ATAB(r), PrivMode_HaveBackSpace)) { bsKbuf[0] = (!!(ISSET_PMODE(r, ATAB(r),PrivMode_BackSpace)) ^ !!ctrl) ? '\b' : '\177'; bsKbuf[1] = '\0'; } else /* * If PrivMode_HaveBackSpace is unset, then h->key_backspace * will be a one character string. */ STRCPY( bsKbuf, r->h->key_backspace); # ifdef META8_OPTION if( meta ) /* We must be in 8bit mode if meta is set here */ *bsKbuf |= r->h->meta_char; # endif # ifdef MULTICHAR_SET if (ISSET_OPTION(r, Opt_mc_hack) && AVTS(r)->screen.cur.col > 0) { int col, row; newlen = STRLEN(kbuf); col = AVTS(r)->screen.cur.col - 1; row = AVTS(r)->screen.cur.row + AVTS(r)->saveLines; if (IS_MULTI2(AVTS(r)->screen.rend[row][col])) MEMMOVE(kbuf + newlen, kbuf, newlen + 1); } # endif /* MULTICHAR_SET */ break; } #endif /* !NO_BACKSPACE_KEY */ case XK_Tab: /* * 2006-04-07 gi1242: Shift tab is sometimes sent as ISO_Left_Tab, * which has keysym 0xfe20 (outside the 0xff00 -- 0xffff range). So * we have to process shift tab elsewhere. */ if (shft) STRCPY(kbuf, "\033[Z"); else { #ifdef CTRL_TAB_MAKES_META if (ctrl) meta = 1; #endif /* CTRL_TAB_MAKES_META */ #ifdef MOD4_TAB_MAKES_META if (ev->state & Mod4Mask) meta = 1; #endif /* MOD4_TAB_MAKES_META */ newlen = 0; } break; case XK_Return: newlen = 0; #ifdef META8_OPTION if (r->h->meta_char == 0x80) /* * 2006-12-12 gi1242: In 8 bit mode, xterm sends 0x8d for * Alt+enter. Enter sends 0x0d. */ kbuf[newlen++] = meta ? (r->h->meta_char|C0_CR) : C0_CR; else #endif /* META8_OPTION */ { if( meta ) kbuf[newlen++] = C0_ESC; kbuf[newlen++] = C0_CR; } kbuf[newlen] = '\0'; break; #ifdef XK_KP_Left case XK_KP_Up: /* \033Ox or standard */ case XK_KP_Down: /* \033Or or standard */ case XK_KP_Right: /* \033Ov or standard */ case XK_KP_Left: /* \033Ot or standard */ /* * If numlock is on, we got here by pressing Shift + Keypad 8. * Cancel the Shift, and send the DEC terminal sequence. */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", "txvr"[keysym - XK_KP_Left], ctrl, meta, shft ); break; } /* translate to std. cursor key */ keysym = XK_Left + (keysym - XK_KP_Left); /* FALLTHROUGH */ #endif /* XK_KP_Left */ case XK_Up: /* "\033[A" */ case XK_Down: /* "\033[B" */ case XK_Right: /* "\033[C" */ case XK_Left: /* "\033[D" */ #ifdef XTERM_KEYS /* * Modified cursor keys are \e[1;%d%c, where %d is the modifier * number and %c is D, A, C or B for Up, Dn, Left / Right * resply. */ set_xterm_key_seq( kbuf, "\033[", "\033[1;%d%c", "DACB"[keysym - XK_Left], ctrl, meta, shft); if (ISSET_PMODE(r, ATAB(r), PrivMode_aplCUR) && !ctrl && !meta && !shft) /* * 2006-04-07 gi1242 XXX: Should we ignore the modifiers in * the private mode? */ kbuf[1] = 'O'; #else STRCPY(kbuf, "\033[Z"); kbuf[2] = ("DACB"[keysym - XK_Left]); /* do Shift first */ if (shft) kbuf[2] = ("dacb"[keysym - XK_Left]); else if (ctrl) { kbuf[1] = 'O'; kbuf[2] = ("dacb"[keysym - XK_Left]); } else if (ISSET_PMODE(r, ATAB(r), PrivMode_aplCUR)) kbuf[1] = 'O'; #endif #ifdef MULTICHAR_SET if (ISSET_OPTION(r, Opt_mc_hack)) { /* * If we're on a multibyte char, and we move left / right, then * duplicate the cursor key string. */ int col, row, m; col = AVTS(r)->screen.cur.col; row = AVTS(r)->screen.cur.row + AVTS(r)->saveLines; m = 0; if (keysym == XK_Right && IS_MULTI1(AVTS(r)->screen.rend[row][col])) m = 1; else if (keysym == XK_Left) { if (col > 0) { if (IS_MULTI2(AVTS(r)->screen.rend[row][col - 1])) m = 1; } else if (AVTS(r)->screen.cur.row > 0) { col = AVTS(r)->screen.tlen[--row]; if (col == -1) col = r->TermWin.ncol - 1; else col--; if (col > 0 && IS_MULTI2(AVTS(r)->screen.rend[row][col])) m = 1; } } if (m) { /* Duplicate the escape sequence in kbuf */ int len = STRLEN( kbuf ); MEMMOVE( kbuf + len, kbuf, len + 1); } } #endif /* MULTICHAR_SET */ break; # ifdef XK_KP_Prior case XK_KP_Prior: /* \033[Oy */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'y', ctrl, meta, shft ); break; } /* FALLTHROUGH */ # endif /* XK_KP_Prior */ case XK_Prior: SET_TILDE_KEY_SEQ( kbuf, "\033[5"); break; # ifdef XK_KP_Next case XK_KP_Next: /* \033Os */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 's', ctrl, meta, shft ); break; } /* FALLTHROUGH */ # endif /* XK_KP_Next */ case XK_Next: SET_TILDE_KEY_SEQ(kbuf, "\033[6"); break; case XK_KP_Enter: /* \033OM */ if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP) && (!r->numlock_state || ctrl || meta || shft)) { #ifdef NUMLOCK_ALWAYS_IGNORES_SHIFT if( r->numlock_state ) shft = 0; #endif set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'M', ctrl, meta, shft ); } else { kbuf[0] = '\r'; kbuf[1] = '\0'; } break; #ifdef XK_KP_Begin case XK_KP_Begin: /* \033Ou (This is keypad 5) */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'u', ctrl, meta, shft ); } else { kbuf[0] = '5'; kbuf[1] = '\0'; } break; #endif /* XK_KP_Begin */ #ifdef XK_KP_Insert case XK_KP_Insert: /* \033Op */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'p', ctrl, meta, shft ); break; } /* FALLTHROUGH */ #endif /* XK_KP_Insert */ case XK_Insert: SET_TILDE_KEY_SEQ( kbuf, "\033[2" ); break; #ifdef XK_KP_Delete case XK_KP_Delete: /* \033On */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'n', ctrl, meta, shft ); break; } /* FALLTHROUGH */ #endif case XK_Delete: #ifndef NO_DELETE_KEY STRCPY( kbuf, r->h->key_delete); #else SET_TILDE_KEY_SEQ( kbuf, "\033[3" ); #endif #ifdef MULTICHAR_SET if (ISSET_OPTION(r, Opt_mc_hack)) { int col, row; newlen = STRLEN(kbuf); col = AVTS(r)->screen.cur.col; row = AVTS(r)->screen.cur.row + AVTS(r)->saveLines; if (IS_MULTI1(AVTS(r)->screen.rend[row][col])) MEMMOVE(kbuf + newlen, kbuf, newlen + 1); } #endif /* MULTICHAR_SET */ break; case XK_KP_Multiply: /* "\033Oj" : "*" */ case XK_KP_Add: /* "\033Ok" : "+" */ case XK_KP_Separator: /* "\033Ol" : "," */ case XK_KP_Subtract: /* "\033Om" : "-" */ case XK_KP_Divide: /* "\033Oo" : "/" */ case XK_KP_Decimal: /* "\033On" : "." */ case XK_KP_0: /* "\033Op" : "0" */ case XK_KP_1: /* "\033Oq" : "1" */ case XK_KP_2: /* "\033Or" : "2" */ case XK_KP_3: /* "\033Os" : "3" */ case XK_KP_4: /* "\033Ot" : "4" */ case XK_KP_5: /* "\033Ou" : "5" */ case XK_KP_6: /* "\033Ov" : "6" */ case XK_KP_7: /* "\033Ow" : "7" */ case XK_KP_8: /* "\033Ox" : "8" */ case XK_KP_9: /* "\033Oy" : "9" */ /* * If numlock is on, and no modifiers are presed, then we should * send the actual number key. If modifiers are pressed, send the * DEC sequence (after canceling shift ofcourse). * * If numlock is off, then send the DEC terminal sequence. */ if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP) && (!r->numlock_state || ctrl || meta || shft)) { if( r->numlock_state #ifndef NUMLOCK_ALWAYS_IGNORES_SHIFT && keysym >= XK_KP_Decimal && keysym <= XK_KP_9 #endif ) /* * Cancel shift if numlock is pressed, but only cancel it * for keys where shift has some meaning: 0-9 and Decimal. * If NUMLOCK_ALWAYS_IGNORES_SHIFT is defined, then shift is * always cancelled when numlock is on. */ shft = 0; set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'j' + (keysym - XK_KP_Multiply), ctrl, meta, shft ); } else { kbuf[0] = ('*' + (keysym - XK_KP_Multiply)); kbuf[1] = '\0'; } break; case XK_Find: SET_TILDE_KEY_SEQ(kbuf, "\033[1"); break; #ifdef DXK_Remove /* support for DEC remove like key */ case DXK_Remove: /* FALLTHROUGH */ #endif /* DXK_Remove */ case XK_Execute: SET_TILDE_KEY_SEQ(kbuf, "\033[3"); break; case XK_Select: SET_TILDE_KEY_SEQ(kbuf, "\033[4"); break; #ifdef XK_KP_End case XK_KP_End: /* \033Oq */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'q', ctrl, meta, shft ); break; } /* FALLTHROUGH */ #endif /* XK_KP_End */ case XK_End: if (ISSET_OPTION(r, Opt2_linuxHomeEndKey)) SET_TILDE_KEY_SEQ( kbuf, KS_END_LINUX); else SET_TILDE_KEY_SEQ( kbuf, KS_END); break; #ifdef XK_KP_Home case XK_KP_Home: /* \033Ow */ if( r->numlock_state ) shft = 0; if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'w', ctrl, meta, shft ); break; } /* FALLTHROUGH */ #endif /* XK_KP_Home */ case XK_Home: if (ISSET_OPTION(r, Opt2_linuxHomeEndKey)) SET_TILDE_KEY_SEQ( kbuf, KS_HOME_LINUX); else SET_TILDE_KEY_SEQ( kbuf, KS_HOME); break; #define FKEY_SEQ_START( n, fkey) \ sprintf( (char*) kbuf, "\033[%2d", (n) + (int) (keysym - (fkey)) ); case XK_KP_F1: /* "\033OP" */ case XK_KP_F2: /* "\033OQ" */ case XK_KP_F3: /* "\033OR" */ case XK_KP_F4: /* "\033OS" */ /* XXX 2006-04-08 gi1242: Should we cancel shift here? */ if (ISSET_PMODE(r, ATAB(r), PrivMode_aplKP)) { set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'P' + (keysym - XK_KP_F1), ctrl, meta, shft); break; } else keysym = XK_F1 + (keysym - XK_KP_F1); /* FALLTHROUGH */ case XK_F1: /* "\033[11~" */ case XK_F2: /* "\033[12~" */ case XK_F3: /* "\033[13~" */ case XK_F4: /* "\033[14~" */ if (TERMENV_XTERM == AVTS(r)->termenv) { /* Xterm sends \eOP, \eOQ, \eOR, \eOS for f1 -- f4 */ set_xterm_key_seq( kbuf, "\033O", "\033O%d%c", 'P' + (keysym - XK_F1), ctrl, meta, shft); break; } /* else FALL THROUGH */ case XK_F5: /* "\033[15~" */ FKEY_SEQ_START( 11, XK_F1); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_F6: /* "\033[17~" */ case XK_F7: /* "\033[18~" */ case XK_F8: /* "\033[19~" */ case XK_F9: /* "\033[20~" */ case XK_F10: /* "\033[21~" */ FKEY_SEQ_START(17, XK_F6); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_F11: /* "\033[23~" */ case XK_F12: /* "\033[24~" */ case XK_F13: /* "\033[25~" */ case XK_F14: /* "\033[26~" */ FKEY_SEQ_START(23, XK_F11); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_F15: /* "\033[28~" */ case XK_F16: /* "\033[29~" */ FKEY_SEQ_START(28, XK_F15); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_Help: /* "\033[28~" */ FKEY_SEQ_START(28, XK_Help); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_Menu: /* "\033[29~" */ FKEY_SEQ_START(29, XK_Menu); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; case XK_F17: /* "\033[31~" */ case XK_F18: /* "\033[32~" */ case XK_F19: /* "\033[33~" */ case XK_F20: /* "\033[34~" */ case XK_F21: /* "\033[35~" */ case XK_F22: /* "\033[36~" */ case XK_F23: /* "\033[37~" */ case XK_F24: /* "\033[38~" */ case XK_F25: /* "\033[39~" */ case XK_F26: /* "\033[40~" */ case XK_F27: /* "\033[41~" */ case XK_F28: /* "\033[42~" */ case XK_F29: /* "\033[43~" */ case XK_F30: /* "\033[44~" */ case XK_F31: /* "\033[45~" */ case XK_F32: /* "\033[46~" */ case XK_F33: /* "\033[47~" */ case XK_F34: /* "\033[48~" */ case XK_F35: /* "\033[49~" */ FKEY_SEQ_START(31, XK_F17); SET_TILDE_KEY_SEQ( kbuf + 4, "" ); break; #undef FKEY_SEQ_START default: newlen = 0; break; } /* switch (keysym) */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Returning %d\n", newlen ? (int) STRLEN(kbuf) : -1 )); return newlen ? STRLEN(kbuf) : -1; /* * B: end of a {} body */ } /* }}} */ /*{{{ Convert the keypress event into a string */ /* INTPROTO */ void rxvt_process_keypress (rxvt_t* r, XKeyEvent *ev) { int ctrl, meta, shft, len; KeySym keysym; #ifdef USE_DEADKEY static KeySym accent = 0; #endif /* USE_DEADKEY */ #ifdef DEBUG static int debug_key = 1; /* accessible by a debugger only */ #endif /* DEBUG */ #ifdef USE_XIM int valid_keysym = 0; #endif /* USE_XIM */ /* ** kbuf should be static in order to avoid performance penalty ** on allocation in the stack. And we only define it inside this ** function to avoid potential abuse of this buffer at somewhere ** else. */ static unsigned char kbuf[KBUFSZ]; /* was r->h->kbuf */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "KeyPress event\n")); shft = (ev->state & ShiftMask); ctrl = (ev->state & ControlMask); meta = (ev->state & r->h->ModMetaMask); #if 0 /* {{{ Old numlock handling (conflicts with Xterm) */ /* * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, * allow an escape sequence to toggle the Keypad. Always permit * `shift' to override the current setting */ if (r->numlock_state || (ev->state & r->h->ModNumLockMask)) { r->numlock_state = (ev->state & r->h->ModNumLockMask); PrivMode((!r->numlock_state), PrivMode_aplKP, ATAB(r)); } #endif /*}}}*/ /* * 2006-04-07 gi1242: Don't toggle the Keypad on pressing num lock. Only * store the numlock state so that we can cancel shift if numlock is * pressed, and we get an un-shifted keypad key. */ r->numlock_state = ( ev->state & r->h->ModNumLockMask ); #ifdef USE_XIM if (NOT_NULL(r->h->Input_Context)) { Status status_return; kbuf[0] = '\0'; len = XmbLookupString(r->h->Input_Context, ev, (char *)kbuf, KBUFSZ, &keysym, &status_return); valid_keysym = ((status_return == XLookupKeySym) || (status_return == XLookupBoth)); } else { valid_keysym = 1; #endif /* USE_XIM */ /* ****************************************************** ** Begin of part that is used when XIM is disabled */ len = XLookupString(ev, (char *)kbuf, KBUFSZ, &keysym, NULL); /* ** map unmapped Latin[2-4]/Katakana/Arabic/Cyrillic/Greek ** entries -> Latin1. good for installations with correct ** fonts, but without XLOCALE */ if (!len) { if ((keysym >= 0x0100) && (keysym < 0x0800)) { kbuf[0] = (keysym & 0xFF); kbuf[1] = '\0'; len = 1; } else kbuf[0] = '\0'; } /* ** End of part that is used when XIM is disabled ****************************************************** */ #ifdef USE_XIM } #endif /* USE_XIM */ #ifdef USE_DEADKEY if (0 != accent) { if ( !ctrl && !meta /* NO ctrl or meta */ && ( XK_A == keysym || XK_a == keysym || XK_C == keysym || XK_c == keysym || XK_E == keysym || XK_e == keysym || XK_I == keysym || XK_i == keysym || XK_N == keysym || XK_n == keysym || XK_O == keysym || XK_o == keysym || XK_U == keysym || XK_u == keysym || XK_Y == keysym || XK_y == keysym ) ) { register int idx; KeySym dk = 0; /* dead key + space -> dead key itself */ switch (accent) { case XK_dead_grave: /* ` */ dk = XK_grave; break; case XK_dead_acute: /* ' */ dk = XK_acute; break; case XK_dead_circumflex: /* ^ */ dk = XK_asciicircum; break; case XK_dead_diaeresis: /* " */ dk = XK_quotedbl; break; case XK_dead_tilde: /* ~ */ dk = XK_asciitilde; break; default: assert(0); } /* switch(accent) */ for (idx = 0; idx < DEADKEY_CHAR_NUMBER; idx++) { if (keysym == dkc_tab[idx].ks && dk == dkc_tab[idx].dk) { kbuf[0] = (unsigned char) dkc_tab[idx].ach; break; } } assert (0 != kbuf[0]); /* impossible */ len = 1; accent = 0; /* clear accent anyway */ } /* if */ else if ( !ctrl && !meta /* NO ctrl or meta */ && (XK_space == keysym || accent == keysym) ) { KeySym dk = 0; /* * dead key + space -> dead key itself * dead key ^ 2 -> dead key itself * change the keysym so as to print out the dead key */ switch (accent) { case XK_dead_grave: /* ` */ keysym = dk = XK_grave; break; case XK_dead_acute: /* ' */ keysym = dk = XK_apostrophe; break; case XK_dead_circumflex: /* ^ */ keysym = dk = XK_asciicircum; break; case XK_dead_diaeresis: /* " */ keysym = dk = XK_quotedbl; break; case XK_dead_tilde: /* ~ */ keysym = dk = XK_asciitilde; break; default: assert(0); } /* switch(accent) */ kbuf[0] = (unsigned char) dk; len = 1; accent = 0; /* clear accent anyway */ } else if ( !ctrl && !meta && 0 == len && (XK_Shift_L == keysym || XK_Shift_R == keysym) ) { ; /* do NOT clear accent when only shft is pressed */ } else { accent = 0; /* clear accent anyway */ } } /* 0 != accent */ #endif /* USE_DEADKEY */ /* * V: beginning of valid_keysym (1) */ #ifdef USE_XIM if (valid_keysym) #endif /* USE_XIM */ { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ctrl-meta-shft-keysym: %d-%d-%d-%x\n", ctrl, meta, shft, (int) keysym)); /* * 2006-02-24 gi1242: Allow macros with no modifier pressed so that the * macro functionality will also generalize the keysym functionality. * * Since we use a binary search to look up macros, even if the user has * a very large list of macros the price we pay for looking them up will * be quite small. Thus using UNSHIFTED_MACROS does not hurt performance * much. */ #ifndef UNSHIFTED_MACROS if (ctrl || meta || shft) #endif if( rxvt_process_macros( r, keysym, ev ) ) return; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "bypass rxvt_process_macros\n")); /* * 2006-02-24 gi1242: If you want to "hard code" a few macros into * mrxvt, do them here. The code for unshifted-scrollkeys etc used to be * here, and has now been removed. * * Rather than hardcode macros in, it is better to use the macro feature * and define your macros in the system wide config file. */ #ifdef GREEK_SUPPORT if (keysym == r->h->ks_greekmodeswith) { r->h->greek_mode = !r->h->greek_mode; if (r->h->greek_mode) { rxvt_xterm_seq(r, ATAB(r), XTerm_title, (greek_getmode() == GREEK_ELOT928 ? "[Greek: iso]" : "[Greek: ibm]"), CHAR_ST); greek_reset(); } else rxvt_xterm_seq(r, ATAB(r), XTerm_title, APL_NAME "-" VERSION, CHAR_ST); return; } #endif /* GREEK_SUPPORT */ /* * At this point, all the keystrokes that have special meaning to us * have been handled. If we are in the hold mode, this is the keystroke * to exit. Otherwise, return here. */ if (AVTS(r)->hold > 1) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "exit after hold\n")); if (keysym && len) rxvt_remove_page (r, ATAB(r)); return; } /* * A: begin 0xFFxx keysym */ if (keysym >= 0xff00 && keysym <= 0xffff) { int newlen = rxvt_0xffxx_keypress (r, keysym, ctrl, meta, shft, kbuf); if (-1 != newlen) len = newlen; #if 0 /* was ifdef META8_OPTION. */ /* 2006-05-23 gi1242 Better to use modifier instead */ /* * Pass meta for all function keys, if 'meta' option set */ if (meta && (r->h->meta_char == 0x80) && len > 0) kbuf[len - 1] |= 0x80; #endif /* META8_OPTION */ } /* * A: end of 0xFFxx keysym */ else if (ctrl && keysym == XK_minus) { len = 1; kbuf[0] = '\037'; /* Ctrl-Minus generates ^_ (31) */ } else if ( shft && keysym == XK_ISO_Left_Tab ) { /* Most keyboards send this keysym pressing Shift+Tab. */ STRCPY( kbuf, "\033[Z"); len = 3; } #if defined(XK_dead_grave) && defined(XK_dead_horn) /* ** ======================================================== ** C: beginning of 0xFE50 - 0xFE62, dead keys */ else if (!ctrl && !meta && /* NO ctrl or meta */ keysym >= XK_dead_grave && keysym <= XK_dead_horn) { # ifdef USE_DEADKEY if ( XK_dead_grave == keysym || /* ` */ XK_dead_acute == keysym || /* ' */ XK_dead_circumflex == keysym || /* ^ */ XK_dead_diaeresis == keysym || /* " */ XK_dead_tilde == keysym /* ~ */ ) { len = 0; accent = keysym; } # endif /* USE_DEADKEY */ } /* ** C: end of 0xFE50 - 0xFE62, dead keys ** ======================================================== */ #endif /* XK_dead_grave || XK_dead_horn */ else { if ( meta ) { /* * If meta is pressed, then either set the 8th bit for all chars * in kbuf, or prefix it with C0_ESC, depending on the meta8 * option. * * NOTE: This is not done for 0xffxx keys. Those should be * indicated with a modifier parameter, as Xterm does. */ #ifdef META8_OPTION if (r->h->meta_char == 0x80) /* Set 8th bit */ { unsigned char *ch; for (ch = kbuf; ch < kbuf + len; ch++) *ch |= 0x80; meta = 0; } else /* Prefix with C0_ESC */ #endif /* META8_OPTION */ { const unsigned char ch = C0_ESC; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Sending meta for keysym %lx\n", keysym)); rxvt_tt_write(r, ATAB(r), &ch, 1); } } /* if(meta) */ #ifdef GREEK_SUPPORT if (r->h->greek_mode) len = greek_xlat( (char*) kbuf, len); #endif /* GREEK_SUPPORT */ } /* else */ } /* * V: End of valid_keysym (1) */ if (len <= 0) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Returning on unmpapped keysym %lx\n", keysym)); return; /* not mapped */ } if (ISSET_OPTION(r, Opt_scrollTtyKeypress)) { if (AVTS(r)->view_start) { AVTS(r)->view_start = 0; AVTS(r)->want_refresh = 1; } } #ifdef DEBUG if (debug_key) /* Display keyboard buffer contents */ { unsigned char* p; int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "key 0x%04X [%d]: `", (unsigned int) keysym, len)); for (i = 0, p = kbuf; i < len; i++, p++) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, (*p >= ' ' && *p < '\177' ? "%c" : "\\%03o"), *p)); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "'\n")); } #endif /* DEBUG */ if (0 == STRCMP ("UTF-8", r->h->locale)) { rxvt_msg (DBG_INFO, DBG_COMMAND, "UTF-8 string?"); } rxvt_tt_write(r, ATAB(r), kbuf, (unsigned int)len); } /*}}} */ /*{{{ rxvt_cmd_write(), rxvt_cmd_getc() */ /* attempt to `write' count to the input buffer */ /* EXTPROTO */ void rxvt_cmd_write( rxvt_t* r, int page, const unsigned char *str, unsigned int count) { unsigned int n, s; unsigned char *cmdbuf_base = PVTS(r, page)->cmdbuf_base, *cmdbuf_endp = PVTS(r, page)->cmdbuf_endp, *cmdbuf_ptr = PVTS(r, page)->cmdbuf_escstart ? PVTS(r, page)->cmdbuf_escstart : PVTS(r, page)->cmdbuf_ptr; n = cmdbuf_ptr - cmdbuf_base; s = cmdbuf_base + (BUFSIZ - 1) - cmdbuf_endp; /* * If there is not enough space to write our data, try using the unused * space in the beginning. */ if (n > 0 && s < count) { MEMMOVE(cmdbuf_base, cmdbuf_ptr, (unsigned int)(cmdbuf_endp - cmdbuf_ptr)); cmdbuf_ptr -= n; cmdbuf_endp -= n; s += n; if( PVTS(r, page)->cmdbuf_escstart ) PVTS(r, page)->cmdbuf_escstart -= n; if( PVTS(r, page)->cmdbuf_escfail ) PVTS(r, page)->cmdbuf_escfail -= n; PVTS(r, page)->cmdbuf_ptr = cmdbuf_ptr; } if (count > s) { rxvt_msg (DBG_ERROR, DBG_COMMAND, "data loss: cmd_write too large"); count = s; } for (; count--;) *cmdbuf_endp++ = *str++; PVTS(r, page)->cmdbuf_endp = cmdbuf_endp; assert (PVTS(r, page)->cmdbuf_base <= PVTS(r, page)->cmdbuf_endp); } /* * Does a waitpid() on each child, and marks it as dead if it's dead. This * function is safe to call from anywhere. */ void rxvt_mark_dead_childs( rxvt_t *r ) { int i, j; short ndead_childs = r->ndead_childs; rxvt_dbgmsg ((DBG_VERBOSE, DBG_COMMAND, "rxvt_mark_dead_childs(): %d children are dead\n", r->ndead_childs)); /* * Check processes running in each tab. */ for (i = LTAB(r); i >= 0 ; i--) { int status, pid; errno = 0; /* Clear errno */ if( !PVTS(r, i)->dead && (pid = waitpid( PVTS(r, i)->cmd_pid, &status, WNOHANG)) != 0 ) { if( pid == -1 && errno == ECHILD ) { /* * Command in ith tab is not our child. The only way this can * happen is if we lost an SIGCHLD signal (e.g. if we receive a * SIGCHLD when it is blocked, say by our own SIGCHLD handler). */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ECHILD error on waitpid(%d)\n", i )); /* We have no way of getting the child's exit status now */ PVTS( r, i )->status = 0; } else { /* Process in tab i is dead. */ r->ndead_childs--; /* Reduce number of unprocessed dead vt's by one */ ndead_childs--; /* This variable is safe from being modified in a signal */ PVTS( r, i )->status = status; /* Save exit status */ } /* * Regardless of losing SIGCHLD, we mark this tab as dead. */ PVTS( r, i )->dead = 1; /* Mark it as dead */ PVTS( r, i )->hold = 1; /* Hold it until it is cleaned up */ r->cleanDeadChilds = 1; /* Child has been marked as dead, but not cleaned out. */ } } /* * Check processes we launched via rxvt_async_exec(). We don't care about * status info here, so this is much simpler. */ for( i=0, j=0; i < r->nAsyncChilds; ) { if( waitpid( r->asyncChilds[i], NULL, WNOHANG ) != 0 ) { r->ndead_childs--; ndead_childs--; i++; } else r->asyncChilds[j++] = r->asyncChilds[i++]; } r->nAsyncChilds -= (i-j); if( r->ndead_childs < 0 ) { /* * Oops. Some child died, but we never got a dead child signal on it. As * long as we got here, we're fine. * * NOTE: It is OK for ndead_childs < 0. r->ndead_childs is updated for * processes that die when we are in this function. ndead_childs is not. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Lost child signal." )); r->ndead_childs = 0; } else if ( ndead_childs > 0 ) { /* * This is problematic. The number of processes that were promised as * "dead" on entry to this function is not actually the number of * processes that are dead! * * NOTE: It is OK for r->ndead_childs > 0, as r->ndead_childs could be * externally modified while we are in this function. * * We should only get here when one of our child processes that is NOT * running in a tab dies. For instance, when we print something with our * "PrintPipe" macro. If we get here for any other reason, we're in deep * trouble. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Spurious dead child signal received\n")); /* * We should reset r->ndead_childs to 0. But there is a possible race * condition with doing that. Suppose we received a dead child signal * *after* looping over all childs, but just before getting here! * * To avoid this we only reduce r->ndead_childs by the number of * processes we failed to catch as dead. Further, when we get EIO errors * reading from a child, we call this function to see if the child is * dead or not. */ r->ndead_childs -= ndead_childs; } rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Exit rxvt_mark_dead_childs(): %d children are dead\n", r->ndead_childs)); } /* * Cleans out tabs which have died but have not been cleaned up. (i.e. dead && * hold == 1) * * NOTE: This function MUST NOT be called from rxvt_cmd_getc(), because it could * redirect command buffer input of the tabs. */ /* INTPROTO */ void rxvt_clean_cmd_page (rxvt_t* r) { int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_clean_cmd_page()\n" )); if( r->ndead_childs ) rxvt_mark_dead_childs( r ); /* * We had better not get here unless we need to clean up dead children. Make * sure we don't proceed when we receive spurious dead child messages (e.g. * from when the print pipe dies). */ if( !r->cleanDeadChilds ) return; /* * We start from the last child because we need to move ahead after * removing dead child. This makes it much safer. * * Why do we need to restart dead value from LTAB(r) again? Because a * child may have died when we do something following and changed the * value of r->ndead_childs! This child may be later than any dead children * we have examined. */ for (i = LTAB(r); i >= 0; i--) { if( PVTS(r, i)->dead && PVTS(r, i)->hold == 1 ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Tab %d exit %s (status %d). holdOption: %d\n", i, WIFEXITED(PVTS(r,i)->status) ? "success" : "failure", PVTS(r,i)->status, PVTS(r,i)->holdOption)); /* * Process in tab i has died, and needs to be cleaned up. */ if( SHOULD_HOLD( r, i ) ) { const int maxLen = 1024; const char *msg; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Hold child %d after it died\n", i)); /* increase hold number, so next iteration will skip it */ PVTS(r, i)->hold++; /* * Process any pending data from the child. */ do { unsigned char *last_escfail = NULL; /* * Process information in the child's output buffer. */ while( PVTS(r, i)->cmdbuf_ptr < PVTS(r, i)->cmdbuf_endp ) { rxvt_process_getc( r, i, *(PVTS(r,i)->cmdbuf_ptr++) ); /* Incomplete escape sequence. */ if( PVTS(r, i)->cmdbuf_escfail ) { /* * See if reading from the child's fd will complete * this escape seqeunce. */ if( IS_NULL( last_escfail ) ) last_escfail = PVTS(r, i)->cmdbuf_escfail; else { /* Really incomplete escape sequence */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Incomplete escape sequence '%.*s'\n", PVTS(r, i)->cmdbuf_escfail - PVTS(r, i)->cmdbuf_escstart + 1, PVTS(r, i)->cmdbuf_escstart+1)); SET_NULL( last_escfail ); SET_NULL( PVTS(r, i)->cmdbuf_escstart ); SET_NULL( PVTS(r, i)->cmdbuf_escfail ); /* Skip the escape char */ PVTS(r, i)->cmdbuf_ptr++; } } /* if( PVTS(r, i)->cmdbuf_escfail ) */ } /* * Write out pending data in the child's input buffer. */ if (PVTS(r, i)->v_bufstr < PVTS(r, i)->v_bufptr) rxvt_cmd_write(r, i, NULL, 0); /* Make place for new data */ rxvt_check_cmdbuf( r, i ); /* Read any remaining data from childs fd */ rxvt_read_child_cmdfd( r, i, BUFSIZ - 1 - (PVTS(r, i)->cmdbuf_endp - PVTS(r, i)->cmdbuf_base) ); } while( rxvt_cmdbuf_has_input( r, i) ); /* * print holdExitText on screen if defined. */ msg = getProfileOption( r, PVTS(r,i)->profileNum, Rs_holdExitTxt ); if( NOT_NULL( msg ) && *msg ) { unsigned char buffer[maxLen]; int len; rxvt_percent_interpolate( r, i, msg, STRLEN(msg), (char*) buffer, maxLen ); len = rxvt_str_escaped( (char*) buffer ); rxvt_cmd_write(r, i, buffer, len ); if( PVTS(r, i)->cmdbuf_ptr < PVTS(r, i)->cmdbuf_endp ) rxvt_process_getc( r, i, *(PVTS(r,i)->cmdbuf_ptr++) ); } /* * Update title to show tab has finished. */ msg = getProfileOption( r, PVTS(r,i)->profileNum, Rs_holdExitTtl ); if( NOT_NULL( msg ) && *msg ) { unsigned char tabTitle[maxLen]; rxvt_percent_interpolate( r, i, msg, STRLEN(msg), (char*) tabTitle, maxLen ); rxvt_str_escaped( (char*) tabTitle ); rxvt_tabbar_set_title( r, i, tabTitle ); } } /* if( SHOULD_HOLD( r, i ) ) */ else rxvt_remove_page( r, i ); } } /* for(i) */ r->cleanDeadChilds = 0; /* Dead child cleanup complete. */ } /* Returns true if there is input pending in PVTS(r, page)->cmdbuf */ /* INTPROTO */ int static inline rxvt_cmdbuf_has_input( rxvt_t *r, int page ) { return PVTS(r, page)->cmdbuf_escfail ? PVTS(r, page)->cmdbuf_escfail < PVTS(r, page)->cmdbuf_endp : PVTS(r, page)->cmdbuf_ptr < PVTS(r, page)->cmdbuf_endp; } /* * Find a tab with some output, and return it. * * Bug #1102791 (Carsten Menke): A really busy tab could starve all others. So * use a round robin to go through all tabs. */ /* INTPROTO */ int rxvt_find_cmd_child (rxvt_t* r) { register int k; static int lastProcessed = 0; /* tab we processed last time */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_find_cmd_child()\n" )); /* * See if the active tab has input before anything else. */ if( rxvt_cmdbuf_has_input( r, ATAB(r) ) ) return ATAB(r); /* * Now look for data from other tabs. Remember the tab we found data from so * that we can start from the next tab on the next call to this function. */ if( lastProcessed > LTAB(r) ) /* Sanity check */ lastProcessed = LTAB(r); /* start from the next tab of last processed tab */ k = lastProcessed + 1; do { if( k > LTAB(r) ) /* round-robin */ k = 0; assert( PVTS(r, k)->cmdbuf_base <= PVTS(r, k)->cmdbuf_endp ); /* already have something in some page's buffer */ if( rxvt_cmdbuf_has_input(r, k) ) { lastProcessed = k; return k; } } while (k++ != lastProcessed); /* until we hit the last child again */ return -1; /* not found */ } /* INTPROTO */ void rxvt_check_cmdbuf (rxvt_t* r, int page) { assert( PVTS(r, page)->cmdbuf_base <= PVTS(r, page)->cmdbuf_endp ); if( IS_NULL( PVTS(r, page)->cmdbuf_escstart ) && PVTS(r, page)->cmdbuf_ptr == PVTS(r, page)->cmdbuf_endp ) { /* * If there is no data in the buffer, reset it to the beginning * of the buffer. */ PVTS(r, page)->cmdbuf_ptr = PVTS(r, page)->cmdbuf_endp = PVTS(r, page)->cmdbuf_base; } else if( (PVTS(r, page)->cmdbuf_endp - PVTS(r, page)->cmdbuf_base) == (BUFSIZ-1) && ( PVTS(r, page)->cmdbuf_escstart ? (PVTS(r, page)->cmdbuf_escstart > PVTS(r,page)->cmdbuf_base) : (PVTS(r, page)->cmdbuf_ptr > PVTS(r, page)->cmdbuf_base) ) ) { /* * If there is space at beginning of the buffer, but not space at the * end of the buffer, move the content of buffer forward to free space */ unsigned char *start; unsigned int n, len; start = PVTS(r, page)->cmdbuf_escstart ? PVTS(r, page)->cmdbuf_escstart : PVTS(r, page)->cmdbuf_ptr; n = start - PVTS(r, page)->cmdbuf_base; len = PVTS(r, page)->cmdbuf_endp - start; assert( n == BUFSIZ - 1 - len ); assert( start < PVTS(r, page)->cmdbuf_endp ); MEMMOVE( PVTS(r, page)->cmdbuf_base, start, len ); PVTS(r, page)->cmdbuf_ptr -= n; PVTS(r, page)->cmdbuf_endp -= n; if( PVTS(r, page)->cmdbuf_escstart ) PVTS(r, page)->cmdbuf_escstart -= n; if( PVTS(r, page)->cmdbuf_escfail ) PVTS(r, page)->cmdbuf_escfail -= n; } } /* * This function returns the number of bytes being read from a child */ /* INTPROTO */ int rxvt_read_child_cmdfd (rxvt_t* r, int page, unsigned int count) { int n = 0, bread = 0; struct timeval tp; while( count ) { int readErrno; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "read maximal %u bytes\n", count)); /* * 2006-08-23 gi1242: O_NDELAY is set here, so we need not worry about * calls to read() blocking. */ errno = PVTS(r, page)->gotEIO = 0; n = read( PVTS(r, page)->cmd_fd, PVTS(r, page)->cmdbuf_endp, count ); readErrno = errno; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "read %d bytes\n", n)); if (n > 0) { /* Update count and buffer pointer */ count -= n; bread += n; PVTS(r, page)->cmdbuf_endp += n; } else if (0 == n) { /* rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Should not happen?\n")); */ /* 2006-08-23 gi1242: Could happen if we have no more data. */ break; } else /* if (n < 0) */ { /* * We do not update count and buffer pointer and continue * trying read more data in the next loop iteration. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%s\n", strerror(readErrno))); assert( readErrno != EBADF && readErrno != EFAULT && readErrno != EISDIR ); /* See if this process is dead */ switch (readErrno) { case EIO: r->gotEIO = PVTS(r, page)->gotEIO = 1; case EINTR: rxvt_mark_dead_childs(r); break; } /* * 2006-08-31 gi1242: Old code would only break out on EAGAIN or * EINVAL. */ break; } } /* while (count) */ if (bread != 0) { gettimeofday( &tp, NULL); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "output produced on epoch %i\n", tp.tv_sec)); } PVTS(r, page)->monitor_nbytes_read += bread; PVTS(r, page)->nbytes_last_read = bread; return bread; } /* INTPROTO */ void rxvt_monitor_tab(rxvt_t* r,int i) { struct timeval tp; struct timeval monitor_timeout_time; short execute_action = 0; int monitor_timeout = 2000; /* return, if no monitoring is activated */ if ((IS_NULL(&PVTS(r, i)->monitor_tab)) || (PVTS(r, i)->monitor_tab == TAB_MON_OFF) || (PVTS(r, i)->monitor_tab == TAB_MON_NOTIFICATION)) return; monitor_timeout_time = PVTS(r, i)->monitor_start; /* set configured monitor_timeout milliseconds , if configured */ if( r->h->rs[Rs_monitorTimeout] ) monitor_timeout = atoi( r->h->rs[Rs_monitorTimeout] ); monitor_timeout_time.tv_sec += (int) monitor_timeout/1000; monitor_timeout_time.tv_usec += (monitor_timeout - (((int) monitor_timeout/1000) * 1000)) * 1000; /* get current epoch time */ gettimeofday( &tp, NULL); /* monitor-type "AUTO" : determine which type of monitoring is needed */ if ((PVTS(r, i)->monitor_tab == TAB_MON_AUTO) && (timercmp(&monitor_timeout_time,&tp, <))) { if(PVTS(r, i)->monitor_nbytes_read > 0) { PVTS(r, i)->monitor_tab = TAB_MON_INACTIVITY; rxvt_msg (DBG_INFO, DBG_MACROS, "Macro MonitorTab: decided to monitor inactivity on tab %i", i); } else { PVTS(r, i)->monitor_tab = TAB_MON_ACTIVITY; rxvt_msg (DBG_INFO, DBG_MACROS, "Macro MonitorTab: decided to monitor activity on tab %i", i); } PVTS(r, i)->monitor_nbytes_read = 0 ; PVTS(r, i)->monitor_start = tp; } /* monitor-type "INACTIVITY" : detect inactivity */ else if ((PVTS(r, i)->monitor_tab == TAB_MON_INACTIVITY) && (timercmp(&monitor_timeout_time,&tp, <))) { /* inactivity detected */ if (PVTS( r, i)->monitor_nbytes_read == 0) { rxvt_msg (DBG_INFO, DBG_MACROS, "Macro MonitorTab: detected inactivity on tab %i", i); execute_action = 1; } /* activity detected, restarting monitoring */ else { rxvt_msg (DBG_DEBUG, DBG_MACROS, "Macro MonitorTab: NOT detected inactivity on tab %i / %i ", i, PVTS(r,i)->monitor_nbytes_read); PVTS(r, i)->monitor_start = tp; PVTS(r, i)->monitor_nbytes_read = 0; } } /* monitor-type "ACTIVITY" : detect activity */ else if ((PVTS(r, i)->monitor_tab == TAB_MON_ACTIVITY) && (PVTS( r, i)->monitor_nbytes_read != 0)) { rxvt_msg (DBG_INFO, DBG_MACROS, "Macro MonitorTab: detected activity on tab %i", i); execute_action = 1; } /* stop execution of this function if no activity/inactivity * needs to be notified */ if (execute_action == 0) return; const int maxLen = 1024; char expstr[maxLen]; /* execute a command if configured */ if( r->h->rs[Rs_monitorCommand] && *r->h->rs[Rs_monitorCommand] ) { /* interpolate percent arguments */ rxvt_percent_interpolate( r, i, (char *) r->h->rs[Rs_monitorCommand], STRLEN(r->h->rs[Rs_monitorCommand]), (char*) expstr, maxLen ); rxvt_async_exec( r, expstr ); } /* ding - ring the system bell */ rxvt_scr_bell(r,i); /* highlight the tabbar */ rxvt_tabbar_highlight_tab (r, i, False); /* mark tab as active, if it is not the active tab */ if (ATAB(r) != i) { PVTS(r, i)->monitor_tab = TAB_MON_NOTIFICATION; } else { PVTS(r, i)->monitor_tab = TAB_MON_OFF; } #ifdef BACKGROUND_IMAGE if( r->tabBar.hasPixmap && ISSET_OPTION(r, Opt_tabPixmap)) { PVTS(r, i)->monitor_tab = TAB_MON_OFF; rxvt_dbgmsg ((DBG_INFO, DBG_TABBAR, "Disabling background filling, background image is " "activated")); } #endif #ifdef TRANSPARENT if ( ( r->h->am_transparent || r->h->am_pixmap_trans ) && ISSET_OPTION(r, Opt_transparent_tabbar)) { PVTS(r, i)->monitor_tab = TAB_MON_OFF; rxvt_dbgmsg ((DBG_INFO, DBG_TABBAR, "Disabling background filling, option 'transparentTabbar'" "is enabled")); } #endif rxvt_tabbar_expose (r, NULL); } /* INTPROTO */ void rxvt_process_children_cmdfd( rxvt_t* r, fd_set* p_readfds ) { /* * Handle the children that have generate input. Notice in this loop we only * process input, but do NOT determine the child we want to return. */ register int i; for (i = 0; i <= LTAB(r); i++) { unsigned int count, bufsiz; /* check for activity */ rxvt_monitor_tab(r,i); /* check next file descriptor if this one has nothing to read in. */ if (!FD_ISSET(PVTS(r, i)->cmd_fd, p_readfds)) { PVTS(r, i)->nbytes_last_read = 0; PVTS(r, i)->scrolled_lines = 0; continue; } rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "reading from shell %d\n", i)); /* check our command buffer before reading data */ rxvt_check_cmdbuf( r, i ); /* The buffer size is the buffer length - used length */ count = bufsiz = (BUFSIZ - 1) - (PVTS(r, i)->cmdbuf_endp - PVTS(r, i)->cmdbuf_base); /* read data from the command fd into buffer */ count -= rxvt_read_child_cmdfd (r, i, count); #if 0 /* check if a child died */ if( PVTS(r, i)->dead && errno == EIO ) *PVTS(r, i)->cmdbuf_endp = (char) 0; #endif /* highlight inactive tab if there is some input */ if( NOTSET_OPTION(r, Opt2_hlTabOnBell) && bufsiz != count && i != ATAB(r) ) { rxvt_tabbar_highlight_tab (r, i, False); } } /* for loop */ } /* Check quick_timeout before select */ /* INTPROTO */ int rxvt_check_quick_timeout (rxvt_t* r) { struct rxvt_hidden* h = r->h; int quick_timeout = 0; #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) if (h->mouse_slip_wheel_speed) { quick_timeout = 1; /* Only work for current active tab */ if (!h->mouse_slip_wheel_delay-- && rxvt_scr_page( r, ATAB(r), h->mouse_slip_wheel_speed >0 ? UP : DN, abs(h->mouse_slip_wheel_speed) )) { h->mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; h->refresh_type |= SMOOTH_REFRESH; AVTS(r)->want_refresh = 1; } } #endif /* MOUSE_WHEEL && MOUSE_SLIP_WHEELING */ #ifdef SELECTION_SCROLLING if (h->pending_scroll_selection) { quick_timeout = 1; /* Only work for current active tab */ if (!h->scroll_selection_delay-- && rxvt_scr_page(r, ATAB(r), h->scroll_selection_dir, h->scroll_selection_lines)) { rxvt_selection_extend(r, ATAB(r), h->selection_save_x, h->selection_save_y, h->selection_save_state); h->scroll_selection_delay = SCROLLBAR_CONTINUOUS_DELAY; h->refresh_type |= SMOOTH_REFRESH; AVTS(r)->want_refresh = 1; } } #endif /* SELECTION_SCROLLING */ #ifdef HAVE_SCROLLBARS # ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING if (scrollbar_isUp() || scrollbar_isDn()) { quick_timeout = 1; /* Only work for current active tab */ if (!h->scroll_arrow_delay-- && rxvt_scr_page(r, ATAB(r), scrollbar_isUp()?UP:DN, 1)) { h->scroll_arrow_delay = SCROLLBAR_CONTINUOUS_DELAY; h->refresh_type |= SMOOTH_REFRESH; AVTS(r)->want_refresh = 1; } } # endif /* NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING */ #endif return quick_timeout; } /* Adjust quick_timeout after select */ /* INTPROTO */ int rxvt_adjust_quick_timeout (rxvt_t* r, int quick_timeout, struct timeval* value) { struct rxvt_hidden* h = r->h; struct timeval tp; int set_quick_timeout = 0; int32_t fsdiff = 60000000l; /* or say LONG_MAX */ assert (NOT_NULL(value)); value->tv_usec = TIMEOUT_USEC; value->tv_sec = 0; if( !r->TermWin.mapped || r->h->refresh_type == NO_REFRESH ) quick_timeout = 0; else { quick_timeout |= (AVTS(r)->want_refresh || h->want_clip_refresh); #ifdef TRANSPARENT quick_timeout |= h->want_full_refresh; #endif /* TRANSPARENT */ } #if defined(POINTER_BLANK) || defined(CURSOR_BLINK) || defined(TRANSPARENT) { int32_t csdiff, psdiff, bsdiff; csdiff = psdiff = bsdiff = 60000000L; /* or, say, LONG_MAX */ # ifdef TRANSPARENT /* Check if we should refresh our background */ if( h->lastCNotify.tv_sec ) { gettimeofday( &tp, NULL); bsdiff = (tp.tv_sec - h->lastCNotify.tv_sec) * 1000000L + tp.tv_usec - h->lastCNotify.tv_usec; if( bsdiff > h->bgRefreshInterval) { bsdiff = 0; h->lastCNotify.tv_sec = 0; /* Only refresh bg image if we've moved. */ if ((!r->h->bgGrabbed || r->h->prevPos.x != r->szHint.x || r->h->prevPos.y != r->szHint.y || r->h->prevPos.width != r->szHint.width || r->h->prevPos.height != r->szHint.height) && rxvt_check_our_parents( r )) { h->want_full_refresh = 1; } } else bsdiff = h->bgRefreshInterval - bsdiff; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Waiting %ld.%06ld seconds longer for bg refresh\n", bsdiff / 1000000L, bsdiff % 1000000L)); set_quick_timeout = 1; } # endif /* TRANSPARENT */ # if defined(CURSOR_BLINK) /* * Cursor only blinks when terminal window is focused. */ if (ISSET_OPTION(r, Opt_cursorBlink) && r->TermWin.focus) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "** get cursor time on select\n")); (void)gettimeofday(&tp, NULL); csdiff = (tp.tv_sec - h->lastcursorchange.tv_sec) * 1000000L + tp.tv_usec - h->lastcursorchange.tv_usec; if (csdiff > h->blinkInterval) { /* XXX: settable blink times */ h->lastcursorchange.tv_sec = tp.tv_sec; h->lastcursorchange.tv_usec = tp.tv_usec; h->hidden_cursor = !h->hidden_cursor; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%s\n", h->hidden_cursor ? "** hide cursor" : "** show cursor")); AVTS(r)->want_refresh = 1; csdiff = 0; } else csdiff = h->blinkInterval - csdiff; set_quick_timeout = 1; } # endif /* CURSOR_BLINK */ # if defined(POINTER_BLANK) /* * If we haven't moved the pointer for a while */ if (ISSET_OPTION(r, Opt_pointerBlank) && (h->pointerBlankDelay > 0) && (0 == AVTS(r)->hidden_pointer)) { int32_t pdelay; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "** get pointer time on select\n")); (void) gettimeofday(&tp, NULL); psdiff = (tp.tv_sec - h->lastmotion.tv_sec) * 1000000L + tp.tv_usec - h->lastmotion.tv_usec; pdelay = h->pointerBlankDelay * 1000000L; /* only work for current active tab */ if (psdiff >= pdelay) rxvt_pointer_blank(r, ATAB(r)); else { set_quick_timeout = 1; psdiff = pdelay - psdiff; } } # endif /* POINTER_BLANK */ if (!quick_timeout && set_quick_timeout) { MIN_IT(csdiff, fsdiff); MIN_IT(csdiff, bsdiff); MIN_IT(csdiff, psdiff); value->tv_sec = csdiff / 1000000L; value->tv_usec = csdiff % 1000000L; quick_timeout = 1; } } #endif /* POINTER_BLANK || CURSOR_BLINK || TRANSPARENT */ quick_timeout |= r->gotEIO; r->gotEIO = 0; return quick_timeout; } /* Refresh the VT screen and scrollbar if needed */ /* INTPROTO */ void rxvt_refresh_vtscr_if_needed( rxvt_t *r ) { #ifdef TRANSPARENT if( r->h->want_full_refresh ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "full refresh\n")); r->h->want_full_refresh = 0; /* only work for active tab */ rxvt_scr_clear(r, ATAB(r)); rxvt_scr_touch(r, ATAB(r), False); AVTS(r)->want_refresh = 1; } #endif /* TRANSPARENT */ /* * If parts of the screen have changed, we should not honor the GC clipping. */ if( AVTS(r)->want_refresh ) r->h->refresh_type &= ~CLIPPED_REFRESH; if( (AVTS(r)->want_refresh || r->h->want_clip_refresh) && AVTS(r)->mapped && r->h->refresh_type != NO_REFRESH ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%lu: ATAB(%d) produced %d bytes (%d in buffer)\n", time(NULL), ATAB(r), AVTS(r)->nbytes_last_read, AVTS(r)->cmdbuf_endp - AVTS(r)->cmdbuf_base )); rxvt_scr_refresh(r, ATAB(r), r->h->refresh_type); #ifdef HAVE_SCROLLBARS rxvt_scrollbar_update(r, 1); #endif #ifdef USE_XIM rxvt_IM_send_spot (r); #endif /* USE_XIM */ } /* if (AVTS(r)->want_refresh) */ } /* * rxvt_cmd_getc() - Return next input character. * * If *p_page == -1, then *p_page is set to a tab which returned input, and the * character is returned. Calling rxvt_cmd_getc() with *p_page = -1 is a good * thing, and should be done when possible. * * If *p_page != -1, we will either return a character from the tab *p_page, or * fail by setting *p_page to -1 and return 0. If the tab *p_page is dead on * entry, we will fail only when there is no data available. If the tab *p_page * is alive on entry, then we will fail for whatever reason we like (e.g. X * events are pending). */ /* INTPROTO */ unsigned char rxvt_cmd_getc(rxvt_t *r, int* p_page) { int selpage = *p_page, retpage; fd_set readfds; int quick_timeout, select_res; #ifdef POINTER_BLANK int want_motion_time = 0; #endif #ifdef CURSOR_BLINK int want_keypress_time = 0; #endif #if defined(POINTER_BLANK) || defined(CURSOR_BLINK) || defined(TRANSPARENT) struct timeval tp; #endif struct timeval value; struct rxvt_hidden *h = r->h; register int i; rxvt_dbgmsg ((DBG_VERBOSE, DBG_COMMAND, "Entering rxvt_cmd_getc on page %d\n", *p_page)); /* loop until we can return something */ for(;;) { /* check for inactivity */ for (i = 0; i <= LTAB(r); i ++) rxvt_monitor_tab(r,i); #if defined(POINTER_BLANK) || defined(CURSOR_BLINK) || defined(TRANSPARENT) /* presume == 0 implies time not yet retrieved */ tp.tv_sec = tp.tv_usec = 0; #endif /* POINTER_BLANK || CURSOR_BLINK || TRANSPARENT*/ #ifdef CURSOR_BLINK want_keypress_time = 0; #endif /* CURSOR_BLINK */ #ifdef POINTER_BLANK if (ISSET_OPTION(r, Opt_pointerBlank)) want_motion_time = 0; #endif /* POINTER_BLANK */ if( selpage == -1 ) { /* Process all pending X events */ while( XPending(r->Xdisplay) ) { XEvent xev; XNextEvent(r->Xdisplay, &xev); #ifdef CURSOR_BLINK if (ISSET_OPTION(r, Opt_cursorBlink) && KeyPress == xev.type) { if (h->hidden_cursor) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "** hide cursor on keypress\n")); h->hidden_cursor = 0; AVTS(r)->want_refresh = 1; } want_keypress_time = 1; } #endif /* CURSOR_BLINK */ #ifdef POINTER_BLANK if (ISSET_OPTION(r, Opt_pointerBlank) && (h->pointerBlankDelay > 0)) { if (MotionNotify == xev.type || ButtonPress == xev.type || ButtonRelease == xev.type ) { /* only work for current active tab */ if (AVTS(r)->hidden_pointer) rxvt_pointer_unblank(r, ATAB(r)); want_motion_time = 1; } /* only work for current active tab */ if (KeyPress == xev.type && !AVTS(r)->hidden_pointer) rxvt_pointer_blank(r, ATAB(r)); } #endif /* POINTER_BLANK */ #ifdef USE_XIM if (NOT_NULL(r->h->Input_Context)) { if (!XFilterEvent(&xev, xev.xany.window)) rxvt_process_x_event(r, &xev); h->event_type = xev.type; } else #endif /* USE_XIM */ { rxvt_process_x_event(r, &xev); } } /* while ((XPending(r->Xdisplay)) */ } /* if( selpage == -1 ) */ else if( !PVTS(r, selpage)->dead && XPending( r->Xdisplay ) ) { /* * selpage != -1 on an alive tab, and X events are pending. If this * tab produces lots of output, it could potentially choke * everything else. Thus we return a failure, so the caller will * rxvt_set_escfail() and fall back to rxvt_main_loop(). We will be * called again with selpage == -1, when we can process X events. */ *p_page = -1; return 0; } /* * We are done processing our X events. Check to see if we have any data * pending in our input buffer. */ if( selpage != -1 && rxvt_cmdbuf_has_input(r, selpage) ) return *(PVTS(r, selpage)->cmdbuf_ptr)++; if( selpage == -1 && -1 != (retpage = rxvt_find_cmd_child (r)) ) { /* * In case -1 == selpage we are free to return data from any tab we * choose. Note, that rxvt_find_cmd_child() will favor returning the * active tab. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_find_cmd_child: find %d\n", retpage)); *p_page = retpage; return *(PVTS(r, *p_page)->cmdbuf_ptr)++; } /* * The command input buffer is empty and we have no pending X events. * We call select() to wait until some data is available. */ #ifdef CURSOR_BLINK if (want_keypress_time) { /* reset last cursor change time on keypress event */ (void) gettimeofday (&tp, NULL); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "** init cursor time on keypress\n")); h->lastcursorchange.tv_sec = tp.tv_sec; h->lastcursorchange.tv_usec = tp.tv_usec; } #endif /* CURSOR_BLINK */ #ifdef POINTER_BLANK if (ISSET_OPTION(r, Opt_pointerBlank) && want_motion_time) { (void) gettimeofday (&tp, NULL); h->lastmotion.tv_sec = tp.tv_sec; h->lastmotion.tv_usec = tp.tv_usec; } #endif /* POINTER_BLANK */ quick_timeout = rxvt_check_quick_timeout (r); quick_timeout = rxvt_adjust_quick_timeout (r, quick_timeout, &value); /* Now begin to read in from children's file descriptors */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Waiting for %lumu for child\n", quick_timeout ? value.tv_sec * 1000000LU + value.tv_usec : ULONG_MAX)); /* Prepare to read in from children's file descriptors */ FD_ZERO(&readfds); FD_SET(r->Xfd, &readfds); for (i = 0; i <= LTAB(r); i ++) { /* remember to skip held childrens */ if ( PVTS(r, i)->hold > 1 ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, " not listening on vt[%d].cmd_fd (dead)\n", i)); continue; } else if ( PVTS(r, i)->gotEIO ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, " not listening on vt[%d].cmd_fd (EIO)\n", i)); PVTS(r, i)->gotEIO = 0; continue; } rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, " listening on vt[%d].cmd_fd = %d\n", i, PVTS(r, i)->cmd_fd)); FD_SET(PVTS(r, i)->cmd_fd, &readfds); /* Write out any pending output to child */ if( PVTS(r, i)->v_bufstr < PVTS(r, i)->v_bufptr ) rxvt_tt_write(r, i, NULL, 0); } #ifdef HAVE_X11_SM_SMLIB_H if (-1 != r->TermWin.ice_fd) FD_SET(r->TermWin.ice_fd, &readfds); #endif #ifdef USE_FIFO if( r->fifo_fd != -1 ) FD_SET( r->fifo_fd, &readfds ); #endif rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "Calling select( num_fds=%d, timeout=%06du, &readfds)", r->num_fds, quick_timeout ? value.tv_sec * 1000000 + value.tv_usec : -1 )); select_res = select( r->num_fds, &readfds, NULL, NULL, (quick_timeout ? &value : NULL) ); rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "done (timeout %06du). Return %d\n", quick_timeout ? value.tv_sec * 1000000 + value.tv_usec : -1, select_res )); if( select_res > 0 ) { /* Select succeeded. Check if we have new Xevents first. */ if( 0 && selpage == -1 && XPending( r->Xdisplay ) > 25) { rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "%d xevents to processes. Continuing\n", XPending( r->Xdisplay ) )); continue; } /* Read whatever input we can from child fd's*/ rxvt_process_children_cmdfd (r, &readfds); #ifdef HAVE_X11_SM_SMLIB_H /* * ICE file descriptor must be processed after we process all file * descriptors of children. Otherwise, if a child exit, * IceProcessMessages may hang and make the entire terminal * unresponsive. */ if( -1 != r->TermWin.ice_fd && FD_ISSET (r->TermWin.ice_fd, &readfds) ) rxvt_process_ice_msgs (r); #endif #ifdef USE_FIFO /* {{{ Execute macros read from the fifo */ if( -1 != r->fifo_fd && FD_ISSET(r->fifo_fd, &readfds)) { ssize_t len; int nbytes; nbytes = sizeof(r->fifo_buf) - (r->fbuf_ptr - r->fifo_buf) - 1; assert( nbytes > 0 ); errno = 0; len = read( r->fifo_fd, r->fbuf_ptr, nbytes ); if( errno ) { rxvt_msg (DBG_ERROR, DBG_COMMAND, "Error: reading fifo %s", strerror (errno)); } if( len == 0 ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Reopening fifo %s\n", r->fifo_name )); close( r->fifo_fd ); r->fifo_fd = open( r->fifo_name, O_RDONLY|O_NDELAY ); rxvt_adjust_fd_number( r ); /* Flush the fifo buffer */ r->fbuf_ptr = r->fifo_buf; } else if( len > 0 ) { char astr[FIFO_BUF_SIZE]; char *fptr = r->fifo_buf, *aptr; action_t action; SET_NULL( action.str ); r->fbuf_ptr += len; /* Point to end of fifo_buf */ for(;;) { aptr = astr; while( fptr < r->fbuf_ptr && *fptr && *fptr != '\n' ) *(aptr++) = *(fptr++); if( fptr < r->fbuf_ptr && *fptr == '\n' ) { /* Got complete action. Execute it */ *aptr = 0; if( rxvt_set_action( &action, astr ) ) rxvt_dispatch_action( r, &action, NULL ); fptr++; /* Advance to next char */ } else { /* * Incomplete action. Copy it to the fifo buffer and * break out */ MEMCPY( r->fifo_buf, astr, aptr - astr ); r->fbuf_ptr = r->fifo_buf + (aptr - astr); break; } } rxvt_free( action.str ); } } #endif/*USE_FIFO}}}*/ /* * Now figure out if we have something to return. */ if( selpage != -1 && rxvt_cmdbuf_has_input(r, selpage) ) return *(PVTS(r, selpage)->cmdbuf_ptr)++; /* No input from specified child. Try others. */ else if( (retpage = rxvt_find_cmd_child (r)) != -1 ) { if( selpage != -1 && selpage != retpage ) { /* * Specified child has nothing to return, but some other * child has data to return. We set retpage = -1, and return * 0. */ *p_page = -1; return '\0'; } else { /* No child specified, and we have input from some child */ *p_page = retpage; return *(PVTS(r, retpage)->cmdbuf_ptr)++; } } /* else if( (retpage = rxvt_find_cmd_child (r)) != -1 ) */ } /* if( select_res >= 0 ) */ /* * If we get here, we either have a select() error, or no tabs had any * input. Check to see if something died. */ if( r->ndead_childs || select_res == -1 ) rxvt_mark_dead_childs( r ); if( r->cleanDeadChilds ) { /* Ok. Something died. */ *p_page = -1; return '\0'; } /* if( r->cleanDeadChilds ) */ /* * Nothing to return. Screen refresh, and call select() again. */ rxvt_refresh_vtscr_if_needed( r ); } /* for(;;) */ /* NOT REACHED */ } /*}}} */ /* EXTPROTO */ void rxvt_pointer_unblank(rxvt_t* r, int page) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%s(r, page=%d)\n", __func__, page )); XDefineCursor(r->Xdisplay, PVTS(r, page)->vt, r->term_pointer); rxvt_recolour_cursor(r); #ifdef POINTER_BLANK if (NOTSET_OPTION(r, Opt_pointerBlank)) return; /* no need to do anything */ PVTS(r, page)->hidden_pointer = 0; if (r->h->pointerBlankDelay > 0) { struct timeval tp; (void)gettimeofday(&tp, NULL); r->h->lastmotion.tv_sec = tp.tv_sec; r->h->lastmotion.tv_usec = tp.tv_usec; } #endif } #ifdef POINTER_BLANK /* INTPROTO */ void rxvt_pointer_blank(rxvt_t* r, int page) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Blanking pointer\n")); if (ISSET_OPTION(r, Opt_pointerBlank) && IS_CURSOR(r->h->blank_pointer)) { XDefineCursor(r->Xdisplay, PVTS(r, page)->vt, r->h->blank_pointer); XFlush(r->Xdisplay); PVTS(r, page)->hidden_pointer = 1; } } #endif /* INTPROTO */ void rxvt_mouse_report(rxvt_t* r, const XButtonEvent *ev) { int button_number, key_state = 0; int x, y; x = ev->x; y = ev->y; rxvt_pixel_position(r, &x, &y); if (r->h->MEvent.button == AnyButton) { button_number = 3; } else { button_number = r->h->MEvent.button - Button1; /* add 0x3D for wheel events, like xterm does */ if (button_number >= 3) button_number += (64 - 3); } if (ISSET_PMODE(r, ATAB(r), PrivMode_MouseX10)) { /* * do not report ButtonRelease * no state info allowed */ key_state = 0; if (button_number == 3) return; } else { /* XTerm mouse reporting needs these values: * 4 = Shift * 8 = Meta * 16 = Control * plus will add in our own Double-Click reporting * 32 = Double Click */ key_state = ((r->h->MEvent.state & ShiftMask) ? 4 : 0) + ((r->h->MEvent.state & r->h->ModMetaMask) ? 8 : 0) + ((r->h->MEvent.state & ControlMask) ? 16 : 0); #ifdef MOUSE_REPORT_DOUBLECLICK key_state += ((r->h->MEvent.clicks > 1) ? 32 : 0); #endif } #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Mouse [")); if (key_state & 16) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%c", 'C')); if (key_state & 4) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%c", 'S')); if (key_state & 8) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%c", 'A')); if (key_state & 32) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%c", '2')); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "]: <%d>, %d/%d\n", button_number, x + 1, y + 1)); #else rxvt_tt_printf(r, ATAB(r), "\033[M%c%c%c", (32 + button_number + key_state), (32 + x + 1), (32 + y + 1)); #endif } /* ** Individual X Event handlers */ #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) /* INTPROTO */ void rxvt_process_keyrelease(rxvt_t* r, XKeyEvent *ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "KeyRelease event\n")); if (!(ev->state & ControlMask)) r->h->mouse_slip_wheel_speed = 0; else { KeySym ks; ks = XKeycodeToKeysym(r->Xdisplay, ev->keycode, 0); if (ks == XK_Control_L || ks == XK_Control_R) r->h->mouse_slip_wheel_speed = 0; } } #endif #ifdef HAVE_SCROLLBARS /* INTPROTO */ void rxvt_scrollbar_dispatcher (rxvt_t* r, int page, XButtonEvent* ev) { int reportmode = 0; struct rxvt_hidden* h = r->h; if (!h->bypass_keystate) reportmode = !!ISSET_PMODE(r, page, PrivMode_mouse_report); scrollbar_setIdle(); /* * Rxvt-style scrollbar: * move up if mouse is above slider * move dn if mouse is below slider * * XTerm-style scrollbar: * Move display proportional to pointer location * pointer near top -> scroll one line * pointer near bot -> scroll full page */ # ifndef NO_SCROLLBAR_REPORT if (reportmode) { /* * Mouse report disabled scrollbar: * arrow buttons - send up/down * click on scrollbar - send pageup/down */ if( (r->scrollBar.style == R_SB_NEXT && scrollbarnext_upButton(ev->y)) || ( r->scrollBar.style == R_SB_RXVT && scrollbarrxvt_upButton(ev->y) ) || ( r->scrollBar.style == R_SB_SGI && scrollbarsgi_upButton(ev->y) ) ) { rxvt_tt_printf(r, page, "\033[A"); } else if ( (r->scrollBar.style == R_SB_NEXT && scrollbarnext_dnButton(ev->y)) || (r->scrollBar.style == R_SB_RXVT && scrollbarrxvt_dnButton(ev->y)) || (r->scrollBar.style == R_SB_SGI && scrollbarsgi_dnButton(ev->y)) ) { rxvt_tt_printf(r, page, "\033[B"); } else { switch (ev->button) { case Button2: rxvt_tt_printf(r, page, "\014"); break; case Button1: rxvt_tt_printf(r, page, "\033[6~"); break; case Button3: rxvt_tt_printf(r, page, "\033[5~"); break; } } } else # endif /* NO_SCROLLBAR_REPORT */ { int upordown = 0; if (r->scrollBar.style == R_SB_NEXT) { if (scrollbarnext_upButton(ev->y)) upordown = -1; /* up */ else if (scrollbarnext_dnButton(ev->y)) upordown = 1; /* down */ } else if (r->scrollBar.style == R_SB_RXVT) { if (scrollbarrxvt_upButton(ev->y)) upordown = -1; /* up */ else if (scrollbarrxvt_dnButton(ev->y)) upordown = 1; /* down */ } else if (r->scrollBar.style == R_SB_SGI) { if (scrollbarsgi_upButton(ev->y)) upordown = -1; /* up */ else if (scrollbarsgi_dnButton(ev->y)) upordown = 1; /* down */ } if (upordown) { #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING h->scroll_arrow_delay = SCROLLBAR_INITIAL_DELAY; #endif if (rxvt_scr_page(r, ATAB(r), upordown < 0?UP:DN,1)) { if (upordown < 0) scrollbar_setUp(); else scrollbar_setDn(); } } else { switch (ev->button) { case Button2: switch (h->scrollbar_align) { case R_SB_ALIGN_TOP: h->csrO = 0; break; case R_SB_ALIGN_CENTRE: h->csrO = (r->scrollBar.bot-r->scrollBar.top)/2; break; case R_SB_ALIGN_BOTTOM: h->csrO = r->scrollBar.bot - r->scrollBar.top; break; } if ( r->scrollBar.style == R_SB_XTERM || scrollbar_above_slider(ev->y) || scrollbar_below_slider(ev->y) ) { rxvt_scr_move_to(r, page, scrollbar_position(ev->y) - h->csrO, scrollbar_size()); } scrollbar_setMotion(); break; case Button1: if (h->scrollbar_align == R_SB_ALIGN_CENTRE) h->csrO = ev->y - r->scrollBar.top; /* FALLTHROUGH */ case Button3: if (r->scrollBar.style != R_SB_XTERM) { if (scrollbar_above_slider(ev->y)) # ifdef RXVT_SCROLL_FULL rxvt_scr_page(r, ATAB(r), UP, r->TermWin.nrow-1); # else rxvt_scr_page(r, ATAB(r), UP, r->TermWin.nrow/4); # endif else if (scrollbar_below_slider(ev->y)) # ifdef RXVT_SCROLL_FULL rxvt_scr_page(r, ATAB(r), DN, r->TermWin.nrow - 1); # else rxvt_scr_page(r, ATAB(r), DN, r->TermWin.nrow / 4); # endif else scrollbar_setMotion(); } else { rxvt_scr_page(r, ATAB(r), (ev->button == Button1 ? DN : UP), (r->TermWin.nrow * scrollbar_position(ev->y) / scrollbar_size())); } break; } /* switch( ev->button ) */ } /* else */ } return; } #endif /* HAVE_SCROLLBARS */ /* INTPROTO */ void rxvt_process_buttonpress(rxvt_t* r, int page, XButtonEvent *ev) { int reportmode = 0, clickintime; struct rxvt_hidden* h = r->h; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ButtonPress event\n")); h->bypass_keystate = ev->state & (h->ModMetaMask | ShiftMask); if (!h->bypass_keystate) reportmode = !!ISSET_PMODE(r, page, PrivMode_mouse_report); /* * VT window processing of button press */ if (ev->window == PVTS(r, page)->vt) { #ifdef HAVE_MENUBAR /* Popup menu on Control click on terminal window. */ if( (ev->state & ControlMask) && !r->h->ActiveMenu) { int button; /* In some bizaro world, Button1,2,3 might not be 1,2,3 */ switch( ev->button ) { case Button1: button = 0; break; case Button2: button = 1; break; case Button3: button = 2; break; default: button = -1; } if( button >=0 && r->h->popupMenu[button] ) { int x, y; Window unused_cr; r->h->showingMenu |= POPUP_MENU; XTranslateCoordinates( r->Xdisplay, ev->window, r->TermWin.parent, ev->x, ev->y, &x, &y, &unused_cr); r->h->ActiveMenu = r->h->popupMenu[button]; r->h->ActiveMenu->x = x; r->h->ActiveMenu->y = y; XDefineCursor(r->Xdisplay, AVTS(r)->vt, r->h->bar_pointer); rxvt_menu_show(r); return; } } #endif clickintime = ev->time - h->MEvent.time < MULTICLICK_TIME; if (reportmode) { /* mouse report from vt window */ /* save the xbutton state (for ButtonRelease) */ h->MEvent.state = ev->state; #ifdef MOUSE_REPORT_DOUBLECLICK if (ev->button == h->MEvent.button && clickintime) { /* same button, within alloted time */ h->MEvent.clicks++; if (h->MEvent.clicks > 1) { /* only report double clicks */ h->MEvent.clicks = 2; rxvt_mouse_report(r, ev); /* don't report the release */ h->MEvent.clicks = 0; h->MEvent.button = AnyButton; } } else { /* different button, or time expired */ h->MEvent.clicks = 1; h->MEvent.button = ev->button; rxvt_mouse_report(r, ev); } #else h->MEvent.button = ev->button; rxvt_mouse_report(r, ev); #endif /* MOUSE_REPORT_DOUBLECLICK */ } else { if (ev->button != h->MEvent.button) h->MEvent.clicks = 0; switch (ev->button) { case Button1: if (h->MEvent.button == Button1 && clickintime) h->MEvent.clicks++; else h->MEvent.clicks = 1; rxvt_selection_click(r, page, h->MEvent.clicks, ev->x, ev->y); h->MEvent.button = Button1; break; case Button3: if (h->MEvent.button == Button3 && clickintime) rxvt_selection_rotate(r, page, ev->x, ev->y); else rxvt_selection_extend(r, page, ev->x, ev->y, 1); h->MEvent.button = Button3; break; } } h->MEvent.time = ev->time; return; } /* * Tabbar window processing of button press */ if (rxvt_is_tabbar_win (r, ev->window)) rxvt_tabbar_dispatcher (r, ev); #ifdef HAVE_SCROLLBARS /* * Scrollbar window processing of button press */ if (rxvt_is_scrollbar_win (r, ev->window)) rxvt_scrollbar_dispatcher (r, page, ev); #endif #ifdef HAVE_MENUBAR /* * Menubar window processing of button press */ if (rxvt_is_menubar_win(r, ev->window)) rxvt_menubar_control(r, ev); #endif } #ifdef MOUSE_WHEEL /* INTPROTO */ void rxvt_process_wheel_button(rxvt_t* r, int page, XButtonEvent *ev) { int i, v; v = (ev->button == Button4) ? UP : DN; if (ev->state & ShiftMask) i = 1; else if (ISSET_OPTION(r, Opt_mouseWheelScrollPage)) i = r->TermWin.nrow - 1; else i = 5; # ifdef MOUSE_SLIP_WHEELING if (ev->state & ControlMask) { r->h->mouse_slip_wheel_speed += (v ? -1 : 1); r->h->mouse_slip_wheel_delay = SCROLLBAR_CONTINUOUS_DELAY; } # endif # ifdef JUMP_MOUSE_WHEEL rxvt_scr_page(r, ATAB(r), v, i); # ifdef HAVE_SCROLLBARS rxvt_scrollbar_update(r, 1); # endif /* HAVE_SCROLLBARS */ # else /* !JUMP_MOUSE_WHEEL */ for (; i--;) { rxvt_scr_page(r, ATAB(r), v, 1); # ifdef XFT_SUPPORT /* disable screen refresh if XFT antialias is used to improve * performance */ if (!(ISSET_OPTION(r, Opt_xft) && ISSET_OPTION(r, Opt2_xftAntialias))) # endif /* XFT_SUPPORT */ rxvt_scr_refresh(r, page, SMOOTH_REFRESH); # ifdef HAVE_SCROLLBARS rxvt_scrollbar_update(r, 1); # endif /* HAVE_SCROLLBARS */ } # endif /* JUMP_MOUSE_WHEEL */ } #endif /* MOUSE_WHEEL */ /* INTPROTO */ void rxvt_process_buttonrelease(rxvt_t* r, int page, XButtonEvent *ev) { int reportmode = 0; if ( r->tabClicked != -1 ) { if ( rxvt_is_tabbar_win( r, ev->window ) ) { rxvt_tabbar_button_release( r, ev ); return; } else /* User dropped a tab somewhere other than the tabbar */ r->tabClicked = -1; } rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ButtonRelease event\n")); r->h->csrO = 0; /* reset csr Offset */ if (!r->h->bypass_keystate) reportmode = !!ISSET_PMODE(r, page, PrivMode_mouse_report); #ifdef HAVE_SCROLLBARS if (scrollbar_isUpDn()) { scrollbar_setIdle(); rxvt_scrollbar_update(r, 0); # ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING r->h->refresh_type &= ~SMOOTH_REFRESH; # endif } #endif /* HAVE_SCROLLBARS */ #ifdef HAVE_MENUBAR if( r->h->showingMenu ) { r->h->showingMenu &= ~POPUP_MENU; XDefineCursor( r->Xdisplay, AVTS(r)->vt, r->term_pointer); rxvt_menu_select(r, ev); return; } #endif #ifdef SELECTION_SCROLLING r->h->pending_scroll_selection=0; #endif /* SELECTION_SCROLLING */ if (ev->window == PVTS(r, page)->vt) { if (NOT_WIN(ev->subwindow)) { if (reportmode) { /* mouse report from vt window */ /* don't report release of wheel "buttons" */ if (ev->button >= 4) return; #ifdef MOUSE_REPORT_DOUBLECLICK /* only report the release of 'slow' single clicks */ if ( r->h->MEvent.button != AnyButton && ( ev->button != r->h->MEvent.button || (ev->time - r->h->MEvent.time > MULTICLICK_TIME / 2) ) ) { r->h->MEvent.clicks = 0; r->h->MEvent.button = AnyButton; rxvt_mouse_report(r, ev); } #else /* MOUSE_REPORT_DOUBLECLICK */ r->h->MEvent.button = AnyButton; rxvt_mouse_report(r, ev); #endif /* MOUSE_REPORT_DOUBLECLICK */ return; } /* * dumb hack to compensate for the failure of click-and-drag * when overriding mouse reporting */ if (ISSET_PMODE(r, page, PrivMode_mouse_report) && r->h->bypass_keystate && Button1 == ev->button && r->h->MEvent.clicks <= 1) rxvt_selection_extend(r, page, ev->x, ev->y, 0); switch (ev->button) { case Button1: case Button3: rxvt_selection_make(r, page, ev->time); break; case Button2: rxvt_selection_request(r, page, ev->time, ev->x, ev->y); break; #ifdef MOUSE_WHEEL case Button4: case Button5: rxvt_process_wheel_button (r, page, ev); break; #endif /* MOUSE_WHEEL */ } } } #ifdef HAVE_MENUBAR else if (rxvt_is_menubar_win(r, ev->window)) rxvt_menubar_control(r, ev); #endif /* HAVE_MENUBAR */ } /* INTPROTO */ void rxvt_process_clientmessage(rxvt_t* r, XClientMessageEvent* ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ClientMessage event\n")); if ( ev->format == 32 && (Atom) ev->data.l[0] == r->h->xa[XA_WMDELETEWINDOW] ) rxvt_exit_request (r); #ifdef OFFIX_DND /* OffiX Dnd (drag 'n' drop) protocol */ if ( ev->xclient.message_type == h->xa[XA_DNDPROTOCOL] && ( ev->xclient.data.l[0] == DndFile || ev->xclient.data.l[0] == DndDir || ev->xclient.data.l[0] == DndLink ) ) { /* Get Dnd data */ Atom ActualType; int ActualFormat; unsigned char* data; uint32_t Size, RemainingBytes; XGetWindowProperty(r->Xdisplay, XROOT, r->h->xa[XA_DNDSELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); XChangeProperty(r->Xdisplay, XROOT, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, STRLEN(data)); rxvt_selection_paste(r, ATAB(r), XROOT, XA_CUT_BUFFER0, True); XSetInputFocus(r->Xdisplay, XROOT, RevertToNone, CurrentTime); } #endif /* OFFIX_DND */ } /* INTPROTO */ void rxvt_process_visibilitynotify(rxvt_t* r, XVisibilityEvent* ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "VisibilityNotify event\n")); switch (ev->state) { case VisibilityUnobscured: r->h->refresh_type = FAST_REFRESH; break; case VisibilityPartiallyObscured: r->h->refresh_type = SLOW_REFRESH; break; default: r->h->refresh_type = NO_REFRESH; break; } } #ifdef MONITOR_ENTER_LEAVE /* INTPROTO */ void rxvt_process_enter (rxvt_t* r, XCrossingEvent* ev) { if (ev->window == r->TermWin.parent) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Enter event\n")); r->TermWin.enter = 1; } } /* INTPROTO */ void rxvt_process_leave (rxvt_t* r, XCrossingEvent* ev) { if (ev->window == r->TermWin.parent) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Leave event\n")); r->TermWin.enter = 0; } } #endif /* MONITOR_ENTER_LEAVE */ /* * Change the bg / faded colors because of a focus change */ /* INTPROTO */ void rxvt_change_colors_on_focus( rxvt_t *r ) { rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "%s(r)\n", __func__ )); if( rxvt_set_vt_colors( r, ATAB(r) ) ) { rxvt_scr_clear(r, ATAB(r) ); rxvt_scr_touch(r, ATAB(r), True); } } /* INTPROTO */ void rxvt_process_focusin (rxvt_t* r, XFocusChangeEvent* ev) { if( ev->mode == NotifyGrab || ev->mode == NotifyUngrab ) return; if (ev->window == r->TermWin.parent) { rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "%s( r, ev). ev->mode=%d\n", __func__, ev->mode )); r->TermWin.focus = 1; AVTS(r)->want_refresh = 1; /* Cursor needs to be refreshed */ #ifdef USE_XIM if (NOT_NULL(r->h->Input_Context)) XSetICFocus(r->h->Input_Context); #endif rxvt_change_colors_on_focus (r); } } /* INTPROTO */ void rxvt_process_focusout (rxvt_t* r, XFocusChangeEvent* ev) { if( ev->mode == NotifyGrab || ev->mode == NotifyUngrab ) return; if (ev->window == r->TermWin.parent) { rxvt_dbgmsg(( DBG_DEBUG, DBG_COMMAND, "%s( r, ev). ev->mode=%d\n", __func__, ev->mode )); r->TermWin.focus = 0; AVTS(r)->want_refresh = 1; /* Cursor needs to be refreshed */ #ifdef CURSOR_BLINK r->h->hidden_cursor = 0; #endif #ifdef USE_XIM if (NOT_NULL(r->h->Input_Context)) XUnsetICFocus(r->h->Input_Context); #endif rxvt_change_colors_on_focus (r); } } /* * Recalculate and set the szHint upon changes of menubar/scrollbar/tabbar or * font. szHint.width and height are not modified, but the XResizeWindow is * called. The szHint.width and height will be correctly updated on * ConfigureNotify events. * * reason: reason we want to resize the window. */ /* INTPROTO */ void rxvt_resize_on_subwin (rxvt_t* r, resize_reason_t reason) { /* * Store the old width and height */ unsigned oldWidth = r->szHint.width; unsigned oldHeight = r->szHint.height; switch (reason) { #ifdef HAVE_MENUBAR case HIDE_MENUBAR: r->szHint.base_height -= rxvt_menubar_rheight (r); r->szHint.min_height -= rxvt_menubar_rheight (r); r->szHint.height -= rxvt_menubar_rheight (r); break; case SHOW_MENUBAR: r->szHint.base_height += rxvt_menubar_rheight (r); r->szHint.min_height += rxvt_menubar_rheight (r); r->szHint.height += rxvt_menubar_rheight (r); break; #endif /* HAVE_MENUBAR */ case HIDE_TABBAR: r->szHint.base_height -= rxvt_tabbar_rheight (r); r->szHint.min_height -= rxvt_tabbar_rheight (r); r->szHint.height -= rxvt_tabbar_rheight (r); break; case SHOW_TABBAR: r->szHint.base_height += rxvt_tabbar_rheight (r); r->szHint.min_height += rxvt_tabbar_rheight (r); r->szHint.height += rxvt_tabbar_rheight (r); break; #ifdef HAVE_SCROLLBARS case HIDE_SCROLLBAR: r->szHint.base_width -= rxvt_scrollbar_rwidth (r); r->szHint.min_width -= rxvt_scrollbar_rwidth (r); r->szHint.width -= rxvt_scrollbar_rwidth (r); break; case SHOW_SCROLLBAR: r->szHint.base_width += rxvt_scrollbar_rwidth (r); r->szHint.min_width += rxvt_scrollbar_rwidth (r); r->szHint.width += rxvt_scrollbar_rwidth (r); break; #endif /* HAVE_SCROLLBARS */ case RESIZE_FONT: /* Calculate the base width and height */ r->szHint.base_width = 2 * r->TermWin.int_bwidth; r->szHint.base_height = 2 * r->TermWin.int_bwidth; #ifdef HAVE_SCROLLBARS if( rxvt_scrollbar_visible( r) ) r->szHint.base_width += rxvt_scrollbar_width (r); #endif #ifdef HAVE_MENUBAR if( rxvt_menubar_visible(r) ) r->szHint.base_height += rxvt_menubar_height (r); #endif if( rxvt_tabbar_visible( r ) ) r->szHint.base_height += rxvt_tabbar_height (r); /* Set the terminal incremental width and height */ #ifndef NO_FRILLS if(ISSET_OPTION(r, Opt2_smoothResize)) { r->szHint.width_inc = 1; r->szHint.height_inc = 1; } else #endif { r->szHint.width_inc = r->TermWin.fwidth; r->szHint.height_inc = r->TermWin.fheight; } /* Set the terminal minimal width and height */ r->szHint.min_width = r->szHint.base_width + r->TermWin.fwidth; r->szHint.min_height = r->szHint.base_height + r->TermWin.fheight; /* Calculate new height and width */ r->szHint.width = r->szHint.base_width + Width2Pixel(r->TermWin.ncol); r->szHint.height = r->szHint.base_height + Height2Pixel(r->TermWin.nrow); /* * Just incase the window is not resized by the WM, then we still need * to refresh the screen. */ r->h->want_resize |= FORCE_REFRESH; break; default: assert (0); /* should not reach here */ return ; } /* Reset WMNormal Hints. We need not worry about r->szHint.flags */ XSetWMNormalHints (r->Xdisplay, r->TermWin.parent, &(r->szHint)); /* Set the terminal window starting position */ if (NOTSET_OPTION(r, Opt_scrollBar_right)) r->h->window_vt_x = ISSET_OPTION(r, Opt_scrollBar_right) ? 0 : r->szHint.base_width - 2*r->TermWin.int_bwidth; r->h->window_vt_y = r->szHint.base_height - 2*r->TermWin.int_bwidth; if (ISSET_OPTION(r, Opt2_bottomTabbar)) r->h->window_vt_y -= rxvt_tabbar_height (r); /* * Now we can resize the window The resize request might not always succeed. * If the window is already maximized, then (most?) WMs do nothing on the * below call. So when we recieve a ConfigureNotify event, we'll think we've * not moved or resized, and will erroriously not update our TermWin.ncols * etc. */ XResizeWindow(r->Xdisplay, r->TermWin.parent, r->szHint.width, r->szHint.height); /* * We get around this error by setting want_resize. In configure notify * events, if this variable is set, we resize the window regardless of * wether it apears to be in the same position or not. */ r->h->want_resize |= FORCE_RESIZE; #ifndef NO_FRILLS while(ISSET_OPTION(r, Opt2_smartResize)) { /* * Let's attempt to move the window so we don't push part of it off * screen. */ CARD32 left, right, top, bottom; int wx, wy; /* pos of window with decorations */ unsigned wwidth, wheight; /* dim of window with decorations */ int newx = r->szHint.x, /* new location to move to */ newy = r->szHint.y; unsigned dspw = DisplayWidth( r->Xdisplay, XSCREEN), dsph = DisplayHeight( r->Xdisplay, XSCREEN); int dx = (int) r->szHint.width - (int) oldWidth, dy = (int) r->szHint.height- (int) oldHeight; if( !getWMStruts( r->Xdisplay, r->TermWin.parent, &left, &right, &top, &bottom)) break; wx = r->szHint.x - left; wy = r->szHint.y - top; wwidth = r->szHint.width + left + right; wheight = r->szHint.height + top + bottom; /* * Now the position of the window with decorations is in wx, wy, * wwidth, wheight. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Strut: (%lu, %lu %lu, %lu), " "Geometry: %ux%u+%d+%d, Change: (%d, %d)\n", left, right, top, bottom, wwidth, wheight, wx, wy, dx, dy )); /* * Try and move us back on screen, if we resized off it. */ if( wwidth >= dspw || wheight >= dsph ) break; if( wx < 0 && wx + dx >= 0) newx = left; else if( wx + (int) wwidth > (int) dspw && wx + (int) wwidth - dx <= (int) dspw ) newx = dspw - wwidth + left; if( wy < 0 && wy + dy >= 0) newy = top; else if( wy + (int) wheight > (int) dsph && wy + (int) wheight - dy <= (int) dsph) newy = dsph - wheight + top; if( (newx != r->szHint.x || newy != r->szHint.y) /* moved */ && newx - (int) left >=0 /* onscreen */ && newx - (int) left + (int) wwidth <= dspw && newy - (int) top >=0 && newy - (int) top + (int) wheight <= dsph ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Smart move to %ux%u+%d+%d\n", r->szHint.width, r->szHint.height, newx, newy)); XMoveWindow( r->Xdisplay, r->TermWin.parent, newx, newy); } break; } #endif /* * According to X Reference, we should only trust the size of a Window * through ConfigureNotify event, or through XGet... functions. So here we * must not change the window size till we receive a ConfigureNotify event. */ r->szHint.width = oldWidth; r->szHint.height = oldHeight; } /* Resize windows on changing fonts */ /* INTPROTO */ void rxvt_resize_on_font (rxvt_t* r, char* fontname) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_resize_on_font\n")); #ifdef XFT_SUPPORT /* if use freetype font, disallow resize by now ;-) */ if (ISSET_OPTION(r, Opt_xft) && r->TermWin.xftfont) if (!rxvt_change_font_xft (r, fontname)) return ; if (NOTSET_OPTION(r, Opt_xft)) #endif /* XFT_SUPPORT */ /* X11 font resize */ if (!rxvt_change_font_x11 (r, fontname)) return ; rxvt_resize_on_subwin (r, RESIZE_FONT); } /* ** Recalculate the window col/row upon window resizing */ /* INTPROTO */ int rxvt_calc_colrow (rxvt_t* r, unsigned int width, unsigned int height) { unsigned int ncol, nrow; assert (0 != r->TermWin.fwidth); assert (0 != r->TermWin.fheight); /* Do nothing if size does not change, unless we requested the resize. */ if ( !r->h->want_resize && r->szHint.width == width && r->szHint.height == height) return 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Recalc row/col of (%d, %d)\n", width, height)); ncol = Pixel2Width (width - r->szHint.base_width); nrow = Pixel2Height (height - r->szHint.base_height); MAX_IT(ncol, 1); MAX_IT(nrow, 1); r->h->prev_ncol = r->TermWin.ncol; r->h->prev_nrow = r->TermWin.nrow; r->TermWin.ncol = ncol; r->TermWin.nrow = nrow; /* * According to X Reference, we should only trust the size of a Window * through ConfigureNotify event, or through XGet... functions. This * function should only be called from ConfigureNotify event handler */ r->szHint.width = width; r->szHint.height = height; return ((r->h->prev_ncol != r->TermWin.ncol) || (r->h->prev_nrow != r->TermWin.nrow)); } /* INTPROTO */ void rxvt_resize_sub_windows (rxvt_t* r) { register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_resize_sub_windows\n")); #ifdef HAVE_SCROLLBARS rxvt_scrollbar_resize(r); #endif #ifdef HAVE_MENUBAR rxvt_menubar_resize(r); #endif rxvt_tabbar_resize (r); for (i = 0; i <= LTAB(r); i ++) { XMoveResizeWindow (r->Xdisplay, PVTS(r, i)->vt, r->h->window_vt_x, r->h->window_vt_y, VT_WIDTH(r), VT_HEIGHT(r)); } } /* Resize windows on configurenotify event */ /* INTPROTO */ void rxvt_resize_on_configure (rxvt_t* r, unsigned int width, unsigned int height) { register int i = 0; unsigned int old_width = r->szHint.width, old_height = r->szHint.height; int fix_screen; rxvt_dbgmsg ((DBG_VERBOSE, DBG_COMMAND, "%s(r, width=%u, height=%u)\n", __func__, width, height)); /* update ncol/nrow of new window */ fix_screen = rxvt_calc_colrow (r, width, height); /* * Check for refresh. If called XResizeWindow, and the WM politely refused * to resize window, then we should still process the resize event. */ if (r->h->want_resize || old_width != r->szHint.width || old_height != r->szHint.height) rxvt_resize_sub_windows (r); if (fix_screen) { for (i = 0; i <= LTAB(r); i ++) { int curr_screen = -1; uint16_t old_ncol; /* * Update previous columns and rows for each VT. We need these * copies so that rxvt_scr_reset can work for each VT. If all VT * only share one copy, the first VT that calls rxvt_scr_reset will * update it, thus other VT will not correctly adjust their * column/row. */ PVTS(r, i)->prev_nrow = r->h->prev_nrow; PVTS(r, i)->prev_ncol = r->h->prev_ncol; old_ncol = PVTS(r, i)->prev_ncol; rxvt_scr_clear(r, i); #ifdef BACKGROUND_IMAGE rxvt_resize_pixmap(r, i); #endif curr_screen = rxvt_scr_change_screen(r, i, PRIMARY); /* scr_reset only works on the primary screen */ rxvt_scr_reset(r, i); if (curr_screen >= 0) { /* this is not the first time through */ rxvt_scr_change_screen(r, i, curr_screen); rxvt_selection_check(r, i, (old_ncol != r->TermWin.ncol ? 4 : 0)); } } } #ifdef USE_XIM rxvt_IM_resize(r); #endif } /* * Get the size of the borders the Window Manager might have put around the * window. Returns true if it succeeded reading the struts. Else returns false, * and puts 0 in left / right / top / bottom. */ #ifndef NO_FRILLS Bool getWMStruts( Display *dpy, Window w, CARD32 *left, CARD32 *right, CARD32 *top, CARD32 *bottom) { Atom atom; static const int natoms = 2; static const char *atomName[2] = { "_KDE_NET_WM_FRAME_STRUT", "_NET_FRAME_EXTENTS"}; int i; Atom type; int format; unsigned long nitems, bytes_after; unsigned char *prop; /* left, right, top and bottom borders */ /* * Initialize return values to 0, just incase we can't read the window * property. */ *left = *right = *top = *bottom = 0; /* Now try and read the property */ for( i=0; i < natoms; i++) { atom = XInternAtom( dpy, atomName[i], False); if (NOT_ATOM(atom)) continue; if( XGetWindowProperty( dpy, w, atom, 0, /* offset */ 4, /* length */ False, /* Delete? */ XA_CARDINAL, /* Type */ &type, &format, &nitems, &bytes_after, /* return values */ &prop) != Success ) continue; if( type == XA_CARDINAL && bytes_after == 0 && format == 32 && nitems == 4 ) { CARD32 *struts = (CARD32*) prop; *left = struts[0]; *right = struts[1]; *top = struts[2]; *bottom = struts[3]; rxvt_dbgmsg((DBG_DEBUG, DBG_COMMAND, "%s: %lu, %lu, %lu, %lu (format=%d, nitems=%lu)\n", atomName[i], *left, *right, *top, *bottom, format, nitems )); /* * Don't check future atomName's */ i = natoms; } XFree( prop); } return i == natoms + 1; } #endif /* INTPROTO */ void rxvt_process_configurenotify (rxvt_t* r, XConfigureEvent* ev) { unsigned int height, width; if (ev->window != r->TermWin.parent) return; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "ConfigureNotify event\n")); do /* Wrap lots of configures into one */ { width = ev->width; height = ev->height; } while ( XCheckTypedWindowEvent(r->Xdisplay, ev->window, ConfigureNotify, (XEvent*) ev)); /* * Remember the position of the window. Make sure that we remember the * position relative to the root window (for root transparency). Notice this * position will be offset by the Window manager. */ XTranslateCoordinates(r->Xdisplay, r->TermWin.parent, XROOT, 0, 0, &r->szHint.x, &r->szHint.y, &ev->window); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Geometry: %ux%u+%d+%d\n", width, height, r->szHint.x, r->szHint.y)); if ( r->h->want_resize || r->szHint.width != width || r->szHint.height != height ) { rxvt_resize_on_configure (r, width, height); } #ifdef DEBUG else { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Size: Not resizing\n")); } #endif if( (r->h->want_resize & ~FORCE_REFRESH) ) { r->h->want_resize = 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Forcing refresh (from want_resize)\n")); #if defined(HAVE_LIBXRENDER) && (defined(BACKGROUND_IMAGE) || defined(TRANSPARENT)) /* * Background images tinted with XRender need to be refreshed on hide / * show of sub windows. */ rxvt_refresh_bg_image( r, ATAB(r), False ); #else /* * Otherwise we should refresh the screen. A lazy refresh is enough, as * we will recieve expose events shortly. */ /* rxvt_src_clear required? */ rxvt_scr_touch( r, ATAB(r), False); #endif } #ifdef TRANSPARENT /* * Check to see if the previous position we grabbed the background is * different from the current window position. If yes, then update * everything. */ if (ISSET_OPTION(r, Opt_transparent)) { if( !r->h->bgGrabbed || r->h->prevPos.x != r->szHint.x || r->h->prevPos.y != r->szHint.y || r->h->prevPos.width != width || r->h->prevPos.height != height ) { /* * Rather than refresh our background pixmap now (which is laggy as * hell), generate a timeout. So if the user is dragging this * window, we won't refresh our background unless he stops for a * certain ammount of time. */ if( !r->h->bgRefreshInterval) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "refreshing parents...\n")); if( rxvt_check_our_parents(r) ) { r->h->want_resize = 0; r->h->want_full_refresh = 1; } } else { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Setting timeout for parent refresh.\n")); gettimeofday( &r->h->lastCNotify, NULL); } } } #endif } /* INTPROTO */ void rxvt_process_selectionnotify (rxvt_t* r, XSelectionEvent* ev) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "SelectionNotify event\n")); if (r->h->selection_wait == Sel_normal) rxvt_selection_paste(r, ev->requestor, ev->property, True); } /* INTPROTO */ void rxvt_process_propertynotify (rxvt_t* r, XEvent* ev) { #ifdef TRANSPARENT int wantRefresh = 0; /* Want transparency refresh */ #endif #ifdef DEBUG char *name; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Property notify event:")); #endif assert( ev->type == PropertyNotify ); /* * Wrap all property notify events in one loop. This is *required* so that * we don't run the transparency updates too often (or worse still, with a * bad pixmap). */ do { #ifdef DEBUG name = XGetAtomName( r->Xdisplay, ev->xproperty.atom); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%s(%08lx) ", name, ev->xproperty.atom )); XFree( name); #endif if ( ev->xproperty.atom == r->h->xa[XA_VT_SELECTION] && ev->xproperty.state == PropertyNewValue ) { rxvt_selection_property(r, ev->xproperty.window, ev->xproperty.atom); } #ifdef TRANSPARENT else if (IS_ATOM(r->h->xa[XA_XROOTPMAPID]) && IS_ATOM(r->h->xa[XA_XSETROOTID]) && (ev->xproperty.atom == r->h->xa[XA_XROOTPMAPID] || ev->xproperty.atom == r->h->xa[XA_XSETROOTID] ) ) { /* * If user used some Esetroot compatible prog to set the root bg, * use the property to determine the pixmap. We use it later on. */ if( !wantRefresh) { /* * A few programs (fvwm-root for instance) use the XSETROOTID * property to indicate changes in transparency (they set it to * none when the background is a solid color). So we have to * listen for both properties. * * fvwm-root (and some other badly behaved programs) do NOT grab * the server when setting the above atoms. Thus while our event * queue might be empty now, we might get a PropertyNotify event * setting one of the above atoms shortly. Thus we introduce a * delay here (eliminates flicker). Notice that this will NOT * introduce a delay when listening for other properties. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "(sleeping ... ")); #ifdef HAVE_NANOSLEEP struct timespec rqt; rqt.tv_sec = 0; rqt.tv_nsec = 10000000; /* 10 ms */ nanosleep(&rqt, NULL); #else sleep( 1); #endif rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "done) ")); } wantRefresh = 1; } #endif /* TRANSPARENT */ } while( XCheckTypedEvent( r->Xdisplay, PropertyNotify, ev) ); #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "\n")); #endif #ifdef TRANSPARENT if( wantRefresh) { /* * Refresh bg vars EVEN if we're not transparent. Thus if we toggle * transparency later on we don't have to worry about it */ refreshRootBGVars( r ); if (ISSET_OPTION(r, Opt_transparent)) { /* * Let rxvt_check_our_parents worry about refreshRootBGVars failing. */ rxvt_check_our_parents(r); r->h->want_full_refresh = 1; } } #endif /* TRANSPARENT */ } /* * ev must either be Expose or GraphicsExpose. */ /* INTPROTO */ void rxvt_process_expose (rxvt_t* r, XEvent* ev) { int page = ATAB(r); Window win = (ev->type == Expose ? ev->xexpose.window : ev->xgraphicsexpose.drawable ); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Got %s event.\n", ev->type == Expose ? "Expose" : "GraphicsExpose")); if (win == PVTS(r, page)->vt) { /* * We need to be clever about exposes (especially under oober slow Xft). * We group exposes, and clip to the appropriate locations. */ if (NOT_REGION(r->h->refreshRegion)) { r->h->refreshRegion = XCreateRegion(); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Created clip region %p\n", r->h->refreshRegion)); /* Will be freed when rxvt_scr_refresh completes */ } do { XRectangle rect; if( ev->type == Expose) { rect.x = ev->xexpose.x; rect.y = ev->xexpose.y; rect.width = ev->xexpose.width; rect.height = ev->xexpose.height; } else { rect.x = ev->xgraphicsexpose.x; rect.y = ev->xgraphicsexpose.y; rect.width = ev->xgraphicsexpose.width; rect.height = ev->xgraphicsexpose.height; } /* * BUG# 1473987: We sometimes receive expose events when the window * contents are not completely cleared. * * If this does not fix the bug, then we will have to issue an * XClearArea() regardless of weather send_event is true or false. */ #if 0 /* * 2006-05-20 gi1242: This did not fix the bug, so we comment out * the test for send_event. */ if( ev->xexpose.send_event ) #endif XClearArea( r->Xdisplay, win, rect.x, rect.y, rect.width, rect.height, False ); XUnionRectWithRegion( &rect, r->h->refreshRegion, r->h->refreshRegion); rxvt_scr_expose(r, page, rect.x, rect.y, rect.width, rect.height, False); /* Don't generate a screen refresh */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Adding [%ux%u+%d+%d] to expose region\n", rect.width, rect.height, rect.x, rect.y)); } while( XCheckTypedWindowEvent( r->Xdisplay, win, Expose, ev) || XCheckTypedWindowEvent( r->Xdisplay, win, GraphicsExpose, ev) ); r->h->refresh_type |= CLIPPED_REFRESH; r->h->want_clip_refresh = 1; } else { XEvent unused_xevent; #ifdef DEBUG /* Debug message */ if (rxvt_is_tabbar_win (r, win)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Expose event on tabbar\n")); } # ifdef HAVE_SCROLLBARS else if (rxvt_is_scrollbar_win (r, win)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Expose event on scrollbar\n")); } # endif # ifdef HAVE_MENUBAR else if (rxvt_is_menubar_win (r, win)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Expose event on menubar\n")); } # endif #endif /* DEBUG */ if (rxvt_is_tabbar_win(r, win) && rxvt_tabbar_visible (r)) { rxvt_tabbar_expose(r, ev); return; } /* fetch all expose events if possible */ while( XCheckTypedWindowEvent(r->Xdisplay, win, Expose, &unused_xevent) || XCheckTypedWindowEvent( r->Xdisplay, win, GraphicsExpose, &unused_xevent) ); #ifdef HAVE_SCROLLBARS if ( rxvt_is_scrollbar_win (r, win) && rxvt_scrollbar_visible (r)) { scrollbar_setIdle(); rxvt_scrollbar_update(r, 0); return; } #endif #ifdef HAVE_MENUBAR if (rxvt_is_menubar_win(r, win) && rxvt_menubar_visible (r)) { rxvt_menubar_expose(r); return; } #endif /* Not reached */ } } /* INTPROTO */ void rxvt_process_motionnotify (rxvt_t* r, XEvent* ev) { int page = ATAB(r); Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "MotionNotify event\n")); #ifdef POINTER_BLANK if (ISSET_OPTION(r, Opt_pointerBlank) && PVTS(r, page)->hidden_pointer) rxvt_pointer_unblank (r, page); #endif #ifdef HAVE_MENUBAR if (rxvt_is_menubar_win(r, ev->xmotion.window)) { rxvt_menubar_control(r, &(ev->xbutton)); return; } if (r->h->showingMenu ) { rxvt_menu_select( r, &(ev->xbutton)); return; } #endif if (ISSET_PMODE(r, page, PrivMode_mouse_report) && !(r->h->bypass_keystate)) return; if (ev->xany.window == PVTS(r, page)->vt) { if ((ev->xbutton.state & (Button1Mask | Button3Mask))) { while (XCheckTypedWindowEvent(r->Xdisplay, PVTS(r, page)->vt, MotionNotify, ev)) ; XQueryPointer(r->Xdisplay, PVTS(r, page)->vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - r->h->MEvent.time) > MOUSE_THRESHOLD) { #endif rxvt_selection_extend(r, page, (ev->xbutton.x), (ev->xbutton.y), (ev->xbutton.state & Button3Mask) ? 2 : 0); #ifdef SELECTION_SCROLLING if ( ev->xbutton.yTermWin.int_bwidth || Pixel2Row(ev->xbutton.y)>(r->TermWin.nrow-1) ) { int dist; r->h->pending_scroll_selection=1; /* ** don't clobber the current delay if we are ** already in the middle of scrolling. */ if (r->h->scroll_selection_delay<=0) r->h->scroll_selection_delay = SCROLLBAR_CONTINUOUS_DELAY; /* ** save the event params so we can highlight ** the selection in the pending-scroll loop */ r->h->selection_save_x = ev->xbutton.x; r->h->selection_save_y = ev->xbutton.y; r->h->selection_save_state = (ev->xbutton.state & Button3Mask) ? 2 : 0; /* calc number of lines to scroll */ if (ev->xbutton.yTermWin.int_bwidth) { r->h->scroll_selection_dir = UP; dist = r->TermWin.int_bwidth - ev->xbutton.y; } else { r->h->scroll_selection_dir = DN; dist = ev->xbutton.y - (r->TermWin.int_bwidth + VT_HEIGHT(r)); } r->h->scroll_selection_lines=(Pixel2Height(dist)/ SELECTION_SCROLL_LINE_SPEEDUP)+1; MIN_IT(r->h->scroll_selection_lines, SELECTION_SCROLL_MAX_LINES); } else { /* ** we are within the text window, so we ** shouldn't be scrolling */ r->h->pending_scroll_selection = 0; } #endif #ifdef MOUSE_THRESHOLD } #endif } } #ifdef HAVE_SCROLLBARS else if ( rxvt_is_scrollbar_win (r, ev->xany.window) && scrollbar_isMotion() ) { while ( XCheckTypedWindowEvent(r->Xdisplay, r->scrollBar.win, MotionNotify, ev) ) ; XQueryPointer(r->Xdisplay, r->scrollBar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); rxvt_scr_move_to(r, page, scrollbar_position(ev->xbutton.y) - r->h->csrO, scrollbar_size()); rxvt_scr_refresh(r, page, r->h->refresh_type & ~CLIPPED_REFRESH); rxvt_scrollbar_update(r, 1); } #endif } /*{{{ process an X event */ /* INTPROTO */ void rxvt_process_x_event(rxvt_t* r, XEvent *ev) { int page = ATAB(r); int i, want_timeout = 0; struct timeval tp; struct rxvt_hidden *h = r->h; #ifdef DEBUG_X const char *const eventnames[] = { /* mason - this matches my system */ "", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", "NoExpose", "VisibilityNotify", "CreateNotify", "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify", "ConfigureNotify", "ConfigureRequest", "GravityNotify", "ResizeRequest", "CirculateNotify", "CirculateRequest", "PropertyNotify", "SelectionClear", "SelectionRequest", "SelectionNotify", "ColormapNotify", "ClientMessage", "MappingNotify" }; struct tm *ltt; #endif /* * check if we need to get the time for any timeouts */ for (i = NUM_TIMEOUTS; i--; ) if (h->timeout[i].tv_sec) { want_timeout = 1; break; } #ifndef DEBUG_X if (want_timeout) #endif (void)gettimeofday(&tp, NULL); #ifdef DEBUG_X ltt = localtime(&(tp.tv_sec)); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Event: %-16s %-7s %08lx (%4d-%02d-%02d %02d:%02d:%02d.%.6ld) %s %lu\n", eventnames[ev->type], (ev->xany.window == r->TermWin.parent ? "parent" : (ev->xany.window == PVTS(r, page)->vt ? "vt" : (ev->xany.window == r->scrollBar.win ? "scroll" : (ev->xany.window == r->menuBar.win ? "menubar" : "UNKNOWN")))), (ev->xany.window == r->TermWin.parent ? r->TermWin.parent : (ev->xany.window == PVTS(r, page)->vt ? PVTS(r, page)->vt : (ev->xany.window == r->scrollBar.win ? r->scrollBar.win : (ev->xany.window == r->menuBar.win ? r->menuBar.win : 0)))), ltt->tm_year + 1900, ltt->tm_mon + 1, ltt->tm_mday, ltt->tm_hour, ltt->tm_min, ltt->tm_sec, tp.tv_usec, ev->xany.send_event ? "S" : " ", ev->xany.serial)); #endif /* X event timeouts */ if (want_timeout) { for (i = NUM_TIMEOUTS; i--; ) { if ( h->timeout[i].tv_sec == 0 || tp.tv_sec < h->timeout[i].tv_sec || ( tp.tv_sec == h->timeout[i].tv_sec && tp.tv_usec < h->timeout[i].tv_usec ) ) continue; /* We timed out on the "i"th timeout */ h->timeout[i].tv_sec = 0; switch(i) { case TIMEOUT_INCR: rxvt_msg (DBG_ERROR, DBG_COMMAND, "data loss: timeout on INCR selection paste"); h->selection_wait = Sel_none; break; default: break; } } } switch (ev->type) { case KeyPress: rxvt_process_keypress (r, (XKeyEvent *) ev); break; #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) case KeyRelease: rxvt_process_keyrelease (r, (XKeyEvent*) ev); break; #endif case ButtonPress: rxvt_process_buttonpress(r, page, (XButtonEvent *) ev); break; case ButtonRelease: rxvt_process_buttonrelease(r, page, (XButtonEvent *) ev); break; case ClientMessage: rxvt_process_clientmessage(r, (XClientMessageEvent*) ev); break; case MappingNotify: XRefreshKeyboardMapping(&(ev->xmapping)); break; /* * XXX: this is not the _current_ arrangement * Here's my conclusion: * If the window is completely unobscured, use bitblt's * to scroll. Even then, they're only used when doing partial * screen scrolling. When partially obscured, we have to fill * in the GraphicsExpose parts, which means that after each refresh, * we need to wait for the graphics expose or Noexpose events, * which ought to make things real slow! */ case VisibilityNotify: rxvt_process_visibilitynotify (r, (XVisibilityEvent*) ev); break; #ifdef MONITOR_ENTER_LEAVE case EnterNotify: rxvt_process_enter (r, (XCrossingEvent*) ev); break; case LeaveNotify: rxvt_process_leave (r, (XCrossingEvent*) ev); break; #endif /* MONITOR_ENTER_LEAVE */ case FocusIn: rxvt_process_focusin (r, (XFocusChangeEvent*) ev); break; case FocusOut: rxvt_process_focusout (r, (XFocusChangeEvent*) ev); break; case ConfigureNotify: rxvt_process_configurenotify (r, (XConfigureEvent*) ev); break; case SelectionClear: rxvt_process_selectionclear(r, page); break; case SelectionNotify: rxvt_process_selectionnotify (r, (XSelectionEvent*) ev); break; case SelectionRequest: rxvt_process_selectionrequest (r, page, (XSelectionRequestEvent*) ev); break; case UnmapNotify: r->TermWin.mapped = 0; break; case MapNotify: r->TermWin.mapped = 1; break; case PropertyNotify: rxvt_process_propertynotify (r, ev); break; case ReparentNotify: rxvt_process_reparentnotify (r, ev); break; case GraphicsExpose: case Expose: rxvt_process_expose (r, ev); break; case MotionNotify: rxvt_process_motionnotify (r, ev); break; } } /*}}} */ /*{{{ print pipe */ /*----------------------------------------------------------------------*/ #ifdef PRINTPIPE /* EXTPROTO */ FILE* rxvt_popen_printer( rxvt_t *r, const char *pipeName ) { FILE* stream = popen( pipeName ? pipeName : r->h->rs[Rs_print_pipe], "w" ); assert( pipeName || r->h->rs[Rs_print_pipe] ); if (IS_NULL(stream)) rxvt_msg (DBG_ERROR, DBG_COMMAND, "Can't open printer pipe %s", r->h->rs[Rs_print_pipe] ? r->h->rs[Rs_print_pipe] : pipeName ); return stream; } /* EXTPROTO */ int rxvt_pclose_printer(FILE *stream) { fflush(stream); /* pclose() reported not to work on SunOS 4.1.3. * pclose works provided SIGCHLD handler uses waitpid */ return pclose(stream); } /* * simulate attached vt100 printer */ /* INTPROTO */ void rxvt_process_print_pipe( rxvt_t* r, int page ) { rxvt_msg (DBG_ERROR, DBG_COMMAND, "Print pipe not implemented in this version" ); #if 0 /* {{{ Disabled because failures of rxvt_cmd_getc() can't be handled */ int readpage = page; int done; FILE* fd; if (IS_NULL(fd = rxvt_popen_printer(r, NULL))) return; /* ** Send all input to the printer until either ESC[4i or ESC[?4i ** is received. */ for (done = 0; !done;) { unsigned char buf[8]; unsigned char ch; unsigned int i, len; if ((ch = rxvt_cmd_getc(r, &readpage)) != C0_ESC) { assert (readpage == page); assert (checksum == PVTS(r, page)->checksum); if (putc(ch, fd) == EOF) break; /* done = 1 */ } else { len = 0; buf[len++] = ch; if ((buf[len++] = rxvt_cmd_getc(r, &readpage)) == '[') { assert (page == readpage); assert (checksum == PVTS(r, page)->checksum); if ((ch = rxvt_cmd_getc(r, &readpage)) == '?') { assert (page == readpage); assert (checksum == PVTS(r, page)->checksum); buf[len++] = '?'; ch = rxvt_cmd_getc(r, &readpage); assert (page == readpage); assert (checksum == PVTS(r, page)->checksum); } if ((buf[len++] = ch) == '4') { if ((buf[len++]=rxvt_cmd_getc(r, &readpage))=='i') { assert (page == readpage); assert (checksum == PVTS(r, page)->checksum); break; /* done = 1 */ } } } for (i = 0; i < len; i++) { if (putc(buf[i], fd) == EOF) { done = 1; break; } } } } rxvt_pclose_printer(fd); #endif /*}}}*/ } #endif /* PRINTPIPE */ /*}}} */ /* *INDENT-OFF* */ enum { C1_40 = 0x40, C1_41 , C1_BPH, C1_NBH, C1_44 , C1_NEL, C1_SSA, C1_ESA, C1_HTS, C1_HTJ, C1_VTS, C1_PLD, C1_PLU, C1_RI , C1_SS2, C1_SS3, C1_DCS, C1_PU1, C1_PU2, C1_STS, C1_CCH, C1_MW , C1_SPA, C1_EPA, C1_SOS, C1_59 , C1_SCI, C1_CSI, CS_ST , C1_OSC, C1_PM , C1_APC }; /* *INDENT-ON* */ /* * Set cmdbuf_escfail to the place where processing an escape sequence failed. * nchars is the minimum number of chars needed to be read */ /* INTPROTO */ void rxvt_set_escfail( rxvt_t *r, int page, int nchars ) { assert( PVTS(r, page)->cmdbuf_escstart ); rxvt_check_cmdbuf( r, page ); PVTS(r, page)->cmdbuf_escfail = PVTS(r, page)->cmdbuf_ptr + nchars - 1; if( PVTS(r, page)->cmdbuf_escfail > PVTS(r, page)->cmdbuf_base + BUFSIZ-3 ) { /* * Escape sequence was longer than BUFSIZ. Just skip the escape * character and go on like normal */ PVTS(r, page)->cmdbuf_ptr = PVTS(r, page)->cmdbuf_escstart + 1; SET_NULL( PVTS(r, page)->cmdbuf_escstart ); SET_NULL( PVTS(r, page)->cmdbuf_escfail ); } else /* Fall back to start of escape sequence */ PVTS(r, page)->cmdbuf_ptr = PVTS(r, page)->cmdbuf_escstart; } /*{{{ process non-printing single characters */ /* INTPROTO */ void rxvt_process_nonprinting(rxvt_t* r, int page, unsigned char ch) { switch (ch) { case C0_ENQ: /* terminal Status */ if (r->h->rs[Rs_answerbackstring]) rxvt_tt_write(r, page, (const unsigned char *)r->h->rs[Rs_answerbackstring], (unsigned int)STRLEN(r->h->rs[Rs_answerbackstring])); else rxvt_tt_write(r, page, (unsigned char *)VT100_ANS, (unsigned int)STRLEN(VT100_ANS)); break; case C0_BEL: /* bell */ rxvt_scr_bell(r, page); if (page != ATAB(r)) rxvt_tabbar_highlight_tab(r, page, False); break; case C0_BS: /* backspace */ rxvt_scr_backspace(r, page); break; case C0_HT: /* tab */ rxvt_scr_tab(r, page, 1); break; case C0_CR: /* carriage return */ rxvt_scr_gotorc(r, page, 0, 0, R_RELATIVE); break; case C0_VT: /* vertical tab, form feed */ case C0_FF: case C0_LF: /* line feed */ rxvt_scr_index(r, page, UP); break; case C0_SO: /* shift out - acs */ rxvt_scr_charset_choose(r, page, 1); break; case C0_SI: /* shift in - acs */ rxvt_scr_charset_choose(r, page, 0); break; } } /*}}} */ /*{{{ process VT52 escape sequences */ /* INTPROTO */ void rxvt_process_escape_vt52(rxvt_t* r, int page, unsigned char ch) { int row, col; int readpage = page; switch (ch) { case 'A': /* cursor up */ rxvt_scr_gotorc(r, page, -1, 0, R_RELATIVE | C_RELATIVE); break; case 'B': /* cursor down */ rxvt_scr_gotorc(r, page, 1, 0, R_RELATIVE | C_RELATIVE); break; case 'C': /* cursor right */ rxvt_scr_gotorc(r, page, 0, 1, R_RELATIVE | C_RELATIVE); break; case 'D': /* cursor left */ rxvt_scr_gotorc(r, page, 0, -1, R_RELATIVE | C_RELATIVE); break; case 'H': /* cursor home */ rxvt_scr_gotorc(r, page, 0, 0, 0); break; case 'I': /* cursor up and scroll down if needed */ rxvt_scr_index(r, page, DN); break; case 'J': /* erase to end of screen */ rxvt_scr_erase_screen(r, page, 0); break; case 'K': /* erase to end of line */ rxvt_scr_erase_line(r, page, 0); break; case 'Y': /* move to specified row and col */ /* full command is 'ESC Y row col' where row and col ** are encoded by adding 32 and sending the ascii ** character. eg. SPACE = 0, '+' = 13, '0' = 18, ** etc. */ row = rxvt_cmd_getc(r, &readpage) - ' '; if( readpage == -1 ) { rxvt_set_escfail( r, page, 2 ); break; } col = rxvt_cmd_getc(r, &readpage) - ' '; if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); break; } rxvt_scr_gotorc(r, page, row, col, 0); break; case 'Z': /* identify the terminal type */ /* I am a VT100 emulating a VT52 */ rxvt_tt_printf(r, page, "\033/Z"); break; case '<': /* turn off VT52 mode */ PrivMode(0, PrivMode_vt52, page); break; case 'F': /* use special graphics character set */ case 'G': /* use regular character set */ /* unimplemented */ break; case '=': /* use alternate keypad mode */ case '>': /* use regular keypad mode */ /* unimplemented */ break; } } /*}}} */ /*{{{ process escape sequences */ /* INTPROTO */ void rxvt_process_escape_seq(rxvt_t* r, int page) { int readpage = page; unsigned char c, ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if (ISSET_PMODE(r, page, PrivMode_vt52)) { rxvt_process_escape_vt52(r, page, ch); return; } switch (ch) { /* case 1: do_tek_mode (); break; */ case '#': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else if( c == 8 ) rxvt_scr_E(r, readpage); break; case '(': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else rxvt_scr_charset_set(r, page, 0, (unsigned int) c ); break; case ')': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else rxvt_scr_charset_set(r, page, 1, (unsigned int) c); break; case '*': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else rxvt_scr_charset_set(r, page, 2, (unsigned int) c); break; case '+': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else rxvt_scr_charset_set(r, page, 3, (unsigned int) c); break; #ifdef MULTICHAR_SET case '$': c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); else rxvt_scr_charset_set(r, page, -2, (unsigned int) c); break; #endif #ifndef NO_FRILLS case '6': rxvt_scr_backindex(r, page); break; #endif case '7': rxvt_scr_cursor(r, page, SAVE); break; case '8': rxvt_scr_cursor(r, page, RESTORE); break; #ifndef NO_FRILLS case '9': rxvt_scr_forwardindex(r, page); break; #endif case '=': case '>': PrivMode((ch == '='), PrivMode_aplKP, page); break; case C1_40: c = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) rxvt_set_escfail( r, page, 1 ); /* 2006-08-31 gi1242 XXX Why is there no code here? */ break; case C1_44: rxvt_scr_index(r, page, UP); break; /* 8.3.87: NEXT LINE */ case C1_NEL: /* ESC E */ rxvt_scr_add_lines(r, page, (const unsigned char *)"\n\r", 1, 2); break; /* kidnapped escape sequence: Should be 8.3.48 */ case C1_ESA: /* ESC G */ rxvt_process_graphics(r, page); break; /* 8.3.63: CHARACTER TABULATION SET */ case C1_HTS: /* ESC H */ rxvt_scr_set_tab(r, page, 1); break; /* 8.3.105: REVERSE LINE FEED */ case C1_RI: /* ESC M */ rxvt_scr_index(r, page, DN); break; /* 8.3.142: SINGLE-SHIFT TWO */ /*case C1_SS2: scr_single_shift (2); break; */ /* 8.3.143: SINGLE-SHIFT THREE */ /*case C1_SS3: scr_single_shift (3); break; */ /* 8.3.27: DEVICE CONTROL STRING */ case C1_DCS: /* ESC P */ /* rxvt_process_dcs_seq(r, page); */ rxvt_process_xwsh_seq (r, page); break; /* 8.3.110: SINGLE CHARACTER INTRODUCER */ case C1_SCI: /* ESC Z */ rxvt_tt_write(r, page, (const unsigned char *)ESCZ_ANSWER, (unsigned int)(sizeof(ESCZ_ANSWER) - 1)); break; /* steal obsolete ESC [ c */ /* 8.3.16: CONTROL SEQUENCE INTRODUCER */ case C1_CSI: /* ESC [ */ rxvt_process_csi_seq(r, page); break; /* 8.3.90: OPERATING SYSTEM COMMAND */ case C1_OSC: /* ESC ] */ rxvt_process_osc_seq(r, page); break; /* 8.3.106: RESET TO INITIAL STATE */ case 'c': rxvt_scr_poweron(r, page); #ifdef HAVE_SCROLLBARS rxvt_scrollbar_update(r, 1); #endif break; /* 8.3.79: LOCKING-SHIFT TWO (see ISO2022) */ case 'n': rxvt_scr_charset_choose(r, page, 2); break; /* 8.3.81: LOCKING-SHIFT THREE (see ISO2022) */ case 'o': rxvt_scr_charset_choose(r, page, 3); break; } } /*}}} */ /*{{{ process CONTROL SEQUENCE INTRODUCER (CSI) sequences `ESC[' */ /* *INDENT-OFF* */ enum { CSI_ICH = 0x40, CSI_CUU, CSI_CUD, CSI_CUF, CSI_CUB, CSI_CNL, CSI_CPL, CSI_CHA, CSI_CUP, CSI_CHT, CSI_ED , CSI_EL , CSI_IL , CSI_DL , CSI_EF , CSI_EA , CSI_DCH, CSI_SEE, CSI_CPR, CSI_SU , CSI_SD , CSI_NP , CSI_PP , CSI_CTC, CSI_ECH, CSI_CVT, CSI_CBT, CSI_SRS, CSI_PTX, CSI_SDS, CSI_SIMD, CSI_5F, CSI_HPA, CSI_HPR, CSI_REP, CSI_DA , CSI_VPA, CSI_VPR, CSI_HVP, CSI_TBC, CSI_SM , CSI_MC , CSI_HPB, CSI_VPB, CSI_RM , CSI_SGR, CSI_DSR, CSI_DAQ, CSI_70 , CSI_71 , CSI_72 , CSI_73 , CSI_74 , CSI_75 , CSI_76 , CSI_77 , CSI_78 , CSI_79 , CSI_7A , CSI_7B , CSI_7C , CSI_7D , CSI_7E , CSI_7F }; #define make_byte(b7,b6,b5,b4,b3,b2,b1,b0) \ (((b7) << 7) | ((b6) << 6) | ((b5) << 5) | ((b4) << 4) \ | ((b3) << 3) | ((b2) << 2) | ((b1) << 1) | (b0)) #define get_byte_array_bit(array, bit) \ (!!((array)[(bit) / 8] & (128 >> ((bit) & 7)))) const unsigned char csi_defaults[] = { make_byte(1,1,1,1,1,1,1,1), /* @, A, B, C, D, E, F, G, */ make_byte(1,1,0,0,1,1,0,0), /* H, I, J, K, L, M, N, O, */ make_byte(1,0,1,1,1,1,1,0), /* P, Q, R, S, T, U, V, W, */ make_byte(1,1,1,0,0,0,1,0), /* X, Y, Z, [, \, ], ^, _, */ make_byte(1,1,1,0,1,1,1,0), /* `, a, b, c, d, e, f, g, */ make_byte(0,0,1,1,0,0,0,0), /* h, i, j, k, l, m, n, o, */ make_byte(0,0,0,0,0,0,0,0), /* p, q, r, s, t, u, v, w, */ make_byte(0,0,0,0,0,0,0,0) /* x, y, z, {, |, }, ~, */ }; /* *INDENT-ON* */ /* INTPROTO */ void rxvt_process_csi_seq(rxvt_t* r, int page) { int readpage = page; unsigned char ch, priv, i; unsigned int nargs, p; int n, ndef; int arg[ESC_ARGS]; for (nargs = ESC_ARGS; nargs > 0;) arg[--nargs] = 0; priv = 0; ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if (ch >= '<' && ch <= '?') /* '<' '=' '>' '?' */ { priv = ch; ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } } /* read any numerical arguments */ for (n = -1; ch < CSI_ICH; ) { if (isdigit(ch)) { if (n < 0) n = ch - '0'; else n = n * 10 + ch - '0'; } else if (ch == ';') { if (nargs < ESC_ARGS) arg[nargs++] = n; n = -1; } else if (ch == '\b') { rxvt_scr_backspace(r, page); } else if (ch == C0_ESC) { rxvt_process_escape_seq(r, page); return; } else if (ch < ' ') { rxvt_process_nonprinting(r, page, ch); } ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } } if (ch > CSI_7F) return; if (nargs < ESC_ARGS) arg[nargs++] = n; i = ch - CSI_ICH; ndef = get_byte_array_bit(csi_defaults, i); for (p = 0; p < nargs; p++) if (arg[p] == -1) arg[p] = ndef; #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "CSI ")); for (p = 0; p < nargs; p++) rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%d%s", arg[p], p < nargs - 1 ? ";" : "")); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "%c\n", ch)); #endif /* private mode handling */ if (priv) { switch (priv) { case '>': if (ch == CSI_DA) /* secondary device attributes */ rxvt_tt_printf(r, page, "\033[>%d;%-.8s;0c", 'R', VERSION); break; case '?': if (ch == 'h' || ch == 'l' || ch == 'r' || ch == 's' || ch == 't') { rxvt_process_terminal_mode(r, page, ch, priv, nargs, arg); } break; } return; } switch (ch) { /* ISO/IEC 6429:1992(E) CSI sequences (defaults in parentheses) */ #ifdef PRINTPIPE case CSI_MC: /* 8.3.83: (0) MEDIA COPY */ switch (arg[0]) { case 0: /* initiate transfer to primary aux device */ rxvt_scr_printscreen( r, page, 0, 0, 0, NULL ); break; case 5: /* start relay to primary aux device */ rxvt_process_print_pipe( r, page ); break; } break; #endif case CSI_CUU: /* 8.3.22: (1) CURSOR UP */ case CSI_VPR: /* 8.3.161: (1) LINE POSITION FORWARD */ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_CUD: /* 8.3.19: (1) CURSOR DOWN */ case CSI_VPB: /* 8.3.160: (1) LINE POSITION BACKWARD */ rxvt_scr_gotorc(r, page, arg[0], 0, RELATIVE); break; case CSI_CUB: /* 8.3.18: (1) CURSOR LEFT */ case CSI_HPB: /* 8.3.59: (1) CHARACTER POSITION BACKWARD */ #ifdef ISO6429 arg[0] = -arg[0]; #else /* emulate common DEC VTs */ arg[0] = arg[0] ? -arg[0] : -1; #endif /* FALLTHROUGH */ case CSI_CUF: /* 8.3.20: (1) CURSOR RIGHT */ case CSI_HPR: /* 8.3.60: (1) CHARACTER POSITION FORWARD */ #ifdef ISO6429 rxvt_scr_gotorc(r, page, 0, arg[0], RELATIVE); #else /* emulate common DEC VTs */ rxvt_scr_gotorc(r, page, 0, arg[0] ? arg[0] : 1, RELATIVE); #endif break; case CSI_CPL: /* 8.3.13: (1) CURSOR PRECEDING LINE */ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_CNL: /* 8.3.12: (1) CURSOR NEXT LINE */ rxvt_scr_gotorc(r, page, arg[0], 0, R_RELATIVE); break; case CSI_CHA: /* 8.3.9: (1) CURSOR CHARACTER ABSOLUTE */ case CSI_HPA: /* 8.3.58: (1) CURSOR POSITION ABSOLUTE */ rxvt_scr_gotorc(r, page, 0, arg[0] - 1, R_RELATIVE); break; case CSI_VPA: /* 8.3.159: (1) LINE POSITION ABSOLUTE */ rxvt_scr_gotorc(r, page, arg[0] - 1, 0, C_RELATIVE); break; case CSI_CUP: /* 8.3.21: (1,1) CURSOR POSITION */ case CSI_HVP: /* 8.3.64: (1,1) CHARACTER AND LINE POSITION */ rxvt_scr_gotorc(r, page, arg[0] - 1, nargs < 2 ? 0 : (arg[1] - 1), 0); break; case CSI_CBT: /* 8.3.7: (1) CURSOR BACKWARD TABULATION */ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_CHT: /* 8.3.10: (1) CURSOR FORWARD TABULATION */ rxvt_scr_tab(r, page, arg[0]); break; case CSI_ED: /* 8.3.40: (0) ERASE IN PAGE */ rxvt_scr_erase_screen(r, page, arg[0]); break; case CSI_EL: /* 8.3.42: (0) ERASE IN LINE */ rxvt_scr_erase_line(r, page, arg[0]); break; case CSI_ICH: /* 8.3.65: (1) INSERT CHARACTER */ rxvt_scr_insdel_chars(r, page, arg[0], INSERT); break; case CSI_IL: /* 8.3.68: (1) INSERT LINE */ rxvt_scr_insdel_lines(r, page, arg[0], INSERT); break; case CSI_DL: /* 8.3.33: (1) DELETE LINE */ rxvt_scr_insdel_lines(r, page, arg[0], DELETE); break; case CSI_ECH: /* 8.3.39: (1) ERASE CHARACTER */ rxvt_scr_insdel_chars(r, page, arg[0], ERASE); break; case CSI_DCH: /* 8.3.26: (1) DELETE CHARACTER */ rxvt_scr_insdel_chars(r, page, arg[0], DELETE); break; case CSI_SD: /* 8.3.114: (1) SCROLL DOWN */ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_SU: /* 8.3.148: (1) SCROLL UP */ rxvt_scroll_text(r, page, PVTS(r, page)->screen.tscroll, PVTS(r, page)->screen.bscroll, arg[0], 0); break; case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ rxvt_tt_write(r, page, (const unsigned char *)VT100_ANS, (unsigned int)(sizeof(VT100_ANS) - 1)); break; case CSI_SGR: /* 8.3.118: (0) SELECT GRAPHIC RENDITION */ rxvt_process_sgr_mode(r, page, nargs, arg); break; case CSI_DSR: /* 8.3.36: (0) DEVICE STATUS REPORT */ switch (arg[0]) { case 5: /* DSR requested */ rxvt_tt_printf(r, page, "\033[0n"); break; case 6: /* CPR requested */ rxvt_scr_report_position(r, page); break; #if defined (ENABLE_DISPLAY_ANSWER) case 7: /* unofficial extension */ rxvt_tt_printf(r, page, "%-.250s\n", r->h->rs[Rs_display_name]); break; #endif case 8: /* unofficial extension */ rxvt_xterm_seq(r, page, XTerm_title, APL_NAME "-" VERSION, CHAR_ST); break; } /* switch (arg[0]) */ break; case CSI_TBC: /* 8.3.155: (0) TABULATION CLEAR */ switch (arg[0]) { case 0: /* char tab stop cleared at active position */ rxvt_scr_set_tab(r, page, 0); break; /* case 1: */ /* line tab stop cleared in active line */ /* case 2: */ /* char tab stops cleared in active line */ case 3: /* all char tab stops are cleared */ /* case 4: */ /* all line tab stops are cleared */ case 5: /* all tab stops are cleared */ rxvt_scr_set_tab(r, page, -1); break; } /* switch (arg[0]) */ break; case CSI_CTC: /* 8.3.17: (0) CURSOR TABULATION CONTROL */ switch (arg[0]) { case 0: /* char tab stop set at active position */ rxvt_scr_set_tab(r, page, 1); break; /* = ESC H */ /* case 1: */ /* line tab stop set at active line */ case 2: /* char tab stop cleared at active position */ rxvt_scr_set_tab(r, page, 0); break; /* = ESC [ 0 g */ /* case 3: */ /* line tab stop cleared at active line */ /* case 4: */ /* char tab stops cleared at active line */ case 5: /* all char tab stops are cleared */ rxvt_scr_set_tab(r, page, -1); break; /* = ESC [ 3 g */ /* case 6: */ /* all line tab stops are cleared */ } /* switch (arg[0]) */ break; case CSI_RM: /* 8.3.107: RESET MODE */ if (arg[0] == 4) rxvt_scr_insert_mode(r, page, 0); break; case CSI_SM: /* 8.3.126: SET MODE */ if (arg[0] == 4) rxvt_scr_insert_mode(r, page, 1); break; /* PRIVATE USE beyond this point. All CSI_7? seqeunces here */ case CSI_72: /* DECSTBM: set top and bottom margins */ if (nargs == 1) rxvt_scr_scroll_region(r, page, arg[0] - 1, MAX_ROWS - 1); else if (nargs == 0 || arg[0] >= arg[1]) rxvt_scr_scroll_region(r, page, 0, MAX_ROWS - 1); else rxvt_scr_scroll_region(r, page, arg[0] - 1, arg[1] - 1); break; case CSI_73: rxvt_scr_cursor(r, page, SAVE); break; case CSI_75: rxvt_scr_cursor(r, page, RESTORE); break; #ifndef NO_FRILLS case CSI_74: rxvt_process_window_ops(r, page, arg, nargs); break; #endif case CSI_78: /* DECREQTPARM */ if (arg[0] == 0 || arg[0] == 1) rxvt_tt_printf(r, page, "\033[%d;1;1;112;112;1;0x", arg[0] + 2); /* FALLTHROUGH */ default: break; } } /*}}} */ #ifndef NO_FRILLS /* ARGSUSED */ /* INTPROTO */ void rxvt_process_window_ops(rxvt_t* r, int page, const int *args, unsigned int nargs) { int x, y; unsigned int w, h; XWindowAttributes wattr; Window wdummy; if (nargs == 0) return; switch (args[0]) { /* commands */ case 1: /* deiconify window */ XMapWindow (r->Xdisplay, r->TermWin.parent); break; case 2: /* iconify window */ XIconifyWindow (r->Xdisplay, r->TermWin.parent, DefaultScreen(r->Xdisplay)); break; case 3: /* set position (pixels) */ XMoveWindow (r->Xdisplay, r->TermWin.parent, args[1], args[2]); break; case 4: /* set size (pixels) */ w = (unsigned int) args[2]; h = (unsigned int) args[1]; XResizeWindow (r->Xdisplay, r->TermWin.parent, w, h); r->h->want_resize = 1; break; case 5: /* raise window */ XRaiseWindow (r->Xdisplay, r->TermWin.parent); break; case 6: /* lower window */ XLowerWindow (r->Xdisplay, r->TermWin.parent); break; case 7: /* refresh window */ rxvt_scr_touch (r, page, True); break; case 8: /* set size (chars) */ w = (unsigned int) (Width2Pixel(args[2]) + r->szHint.base_width); h = (unsigned int) (Height2Pixel(args[1]) + r->szHint.base_height); XResizeWindow (r->Xdisplay, r->TermWin.parent, w, h); r->h->want_resize = 1; break; default: if (args[0] >= 24) { /* set height (chars) */ w = (unsigned int) r->szHint.width; h = (unsigned int) (args[1] * r->TermWin.fheight + r->szHint.base_height); XResizeWindow (r->Xdisplay, r->TermWin.parent, w, h); r->h->want_resize = 1; } break; /* reports - some output format copied from XTerm */ case 11: /* report window state */ XGetWindowAttributes(r->Xdisplay, r->TermWin.parent, &wattr); rxvt_tt_printf(r, page, "\033[%dt", wattr.map_state == IsViewable ? 1 : 2); break; case 13: /* report window position */ XGetWindowAttributes(r->Xdisplay, r->TermWin.parent, &wattr); XTranslateCoordinates(r->Xdisplay, r->TermWin.parent, wattr.root, -wattr.border_width, -wattr.border_width, &x, &y, &wdummy); rxvt_tt_printf(r, page, "\033[3;%d;%dt", x, y); break; case 14: /* report window size (pixels) */ XGetWindowAttributes(r->Xdisplay, r->TermWin.parent, &wattr); rxvt_tt_printf(r, page, "\033[4;%d;%dt", wattr.height, wattr.width); break; case 18: /* report window size (chars) */ rxvt_tt_printf(r, page, "\033[8;%d;%dt", r->TermWin.nrow, r->TermWin.ncol); break; } } #endif /* NO_FRILLS */ /*----------------------------------------------------------------------*/ /* * get input up until STRING TERMINATOR (or BEL) * ends_how is terminator used. returned input must be free()d */ /* INTPROTO */ unsigned char * rxvt_get_to_st(rxvt_t* r, int page, unsigned char *ends_how) { int readpage = page; int seen_esc = 0; /* seen escape? */ unsigned int n = 0; unsigned char* s; unsigned char ch, string[STRING_MAX]; for(;;) { ch = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return NULL; } if( !ch ) break; if( ch == C0_BEL || ch == CHAR_ST || (ch == 0x5c && seen_esc) /* 7bit ST */ ) break; if( ch == C0_ESC ) { seen_esc = 1; continue; } else if (ch == '\t') ch = ' '; /* translate '\t' to space */ else if (ch < 0x08 || (ch > 0x0d && ch < 0x20)) { #if 0 /* * NO! See http://vt100.net/emu/dec_ansi_parser for reason. I am not * sure what to do with CAN or SUB, but the rest should be *ignored* * - I will try to find out what to do with CAN and SUB. - Johann * 'Mykraverk' Oskarsson */ return NULL; /* other control character - exit */ #endif continue; /* do nothing */ } if (n < sizeof(string) - 1) string[n++] = ch; seen_esc = 0; } /* for(;;) */ string[n++] = '\0'; if (IS_NULL(s = (unsigned char UNTAINTED *) STRNDUP (string, n))) return NULL; *ends_how = (ch == 0x5c ? C0_ESC : ch); return s; } /*----------------------------------------------------------------------*/ /* * process DEVICE CONTROL STRING `ESC P ... (ST|BEL)' or `0x90 ... (ST|BEL)' */ /* INTPROTO */ void rxvt_process_dcs_seq(rxvt_t* r, int page) { unsigned char eh, *s; /* Not handled yet */ s = rxvt_get_to_st (r, page, &eh); if (s) rxvt_free(s); return; } /*----------------------------------------------------------------------*/ /* * process OPERATING SYSTEM COMMAND sequence `ESC ] Ps ; Pt (ST|BEL)' */ /* INTPROTO */ void rxvt_process_osc_seq (rxvt_t* r, int page) { int readpage = page; unsigned char ch, eh, *s; int arg; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_process_osc_seq( r, %d). Active page %d\n", page, ATAB(r))); arg = 0; for(;;) { ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if( isdigit(ch) ) arg = arg * 10 + (ch - '0'); else break; } if (ch == ';') { s = rxvt_get_to_st(r, page, &eh); if (s) { /* * rxvt_menubar_dispatch() violates the constness of the string, so * do it here. */ if (arg == XTerm_Menu) { /* XXX: currently disabled due to security concerns */ #if 0 rxvt_menubar_dispatch(r, (char*) s); #endif } else rxvt_xterm_seq(r, page, arg, (char*) s, eh); rxvt_free(s); } } } /* * Xwsh escape sequences: ESC P Ps.y;Pt ESC \ * 1 = change title * 3 = change iconName * 4 = set text color by string * 5 = set page color by string * 6 = set selection text color by string * 7 = set selection page color by string * 8 = set cursor text color by string * 9 = set cursor page color by string * 10 = set half intensity by string * 11 = set bold intensity by string * 101 = bind string to key Ps+1 and pass as value * 103 = bind string to key Ps+1 and pass s function */ /* INTPROTO */ void rxvt_xwsh_seq(rxvt_t* r, int op, const char *str) { assert(NOT_NULL(str)); switch (op) { case Xwsh_title: rxvt_set_term_title (r, (const unsigned char*) str); break; case Xwsh_iconName: rxvt_set_icon_name (r, (const unsigned char*) str); break; case Xwsh_textColor: break; case Xwsh_pageColor: break; case Xwsh_selTextColor: break; case Xwsh_selPageColor: break; case Xwsh_cursorTextColor: break; case Xwsh_cursorPageColor: break; case Xwsh_halfIntColor: break; case Xwsh_boldIntColor: break; case Xwsh_bindStrKeyVal: break; case Xwsh_bindStrKeyFunc: break; } } /* INTPROTO */ void rxvt_process_xwsh_seq (rxvt_t* r, int page) { int readpage = page; unsigned char ch, string[STRING_MAX]; int arg; arg = 0; for(;;) { ch = rxvt_cmd_getc (r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if( isdigit(ch) ) arg = arg * 10 + (ch - '0'); else break; } if (ch == '.') { ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if ( ch == 'y') { int n = 0; for(;;) { ch = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if( ch == '\033' ) break; if (ch) { if (ch == '\t') ch = ' '; /* translate '\t' to space */ else if (ch < ' ') return; /* control character - exit */ if (n < sizeof(string) - 1) string[n++] = ch; } } ch = rxvt_cmd_getc( r, &readpage ); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if( ch == '\\' ) { string[n] = '\0'; rxvt_xwsh_seq(r, arg, (char*) string); } } /* if( ch == 'y' ) */ } /* if( ch == '.' ) */ } /* * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) * 0 = change iconName/title * 1 = change iconName * 2 = change title * 4 = change color * 12 = change text color * 13 = change mouse foreground color * 17 = change highlight character colour * 18 = change bold character color * 19 = change underlined character color * 46 = change logfile (not implemented) * 50 = change font * * rxvt extensions: * 10 = menu (may change in future) (DISABLED) * 20 = bg pixmap * 39 = change default fg color * 49 = change default bg color * 55 = dump scrollback buffer and all of screen */ /* EXTPROTO */ void rxvt_xterm_seq(rxvt_t* r, int page, int op, const char *str, unsigned char resp __attribute__((unused))) { int color; char *buf, *name; #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) int changed = 0; # ifdef TINTING_SUPPORT int shade; # endif #endif assert(NOT_NULL(str)); switch (op) { case XTerm_title: /* Set tab / term title */ case XTerm_name: /* also set icon title */ #ifdef SET_TAB_TITLE_ON_XTERM_SEQUENCE rxvt_tabbar_set_title (r, page, (const unsigned char TAINTED*) str); #ifndef SET_TAB_TITLE_NOT_WIN_TITLE /* * Set both the tab title and win title. However if -stt is used, * then the window title will already be set by * rxvt_tabbar_set_title(), so we only have to set it here if +stt. */ if( NOTSET_OPTION(r, Opt2_syncTabTitle ) ) rxvt_set_term_title(r, (const unsigned char*) str); #endif #else rxvt_set_term_title(r, (const unsigned char*) str); #endif if( op == XTerm_title ) break; /* Don't set the icon name */ /* else FALL THROUGH */ case XTerm_iconName: rxvt_set_icon_name(r, (const unsigned char*) str); /* * 2006-05-30 gi1242: -sti means sync the icon name to the tab * title, and NOT the other way around. */ #if 0 if (ISSET_OPTION(r, Opt2_syncTabIcon)) rxvt_tabbar_set_title (r, ATAB(r), (const unsigned char TAINTED*) str); #endif break; case XTerm_Color: for (buf = (char *)str; buf && *buf;) { if (IS_NULL(name = STRCHR(buf, ';'))) break; *name++ = '\0'; color = atoi(buf); if (color < 0 || color >= TOTAL_COLORS) break; if (NOT_NULL(buf = STRCHR(name, ';'))) *buf++ = '\0'; rxvt_set_window_color(r, page, color + minCOLOR, name); } break; #ifndef NO_CURSORCOLOR case XTerm_Color_cursor: rxvt_set_window_color(r, page, Color_cursor, str); break; #endif case XTerm_Color_pointer: rxvt_set_window_color(r, page, Color_pointer, str); break; #ifndef NO_BOLD_UNDERLINE_REVERSE case XTerm_Color_BD: rxvt_set_window_color(r, page, Color_BD, str); break; case XTerm_Color_UL: rxvt_set_window_color(r, page, Color_UL, str); break; case XTerm_Color_RV: rxvt_set_window_color(r, page, Color_RV, str); break; #endif case XTerm_Menu: /* * rxvt_menubar_dispatch() violates the constness of the string, * so DON'T do it here. * * 2006-03-13 gi1242: Plus it's a security risk. Only interactive * users should control menus. */ break; #ifdef BACKGROUND_IMAGE case XTerm_Pixmap: if (*str != ';') { /* reset to default scaling */ rxvt_scale_pixmap(r, page, ""); /* change pixmap */ rxvt_load_bg_pixmap(r, page, str); rxvt_scr_touch(r, page, True); } while (NOT_NULL(str = STRCHR(str, ';'))) { str++; changed += rxvt_scale_pixmap(r, page, str); } if (changed) { rxvt_resize_pixmap(r, page); rxvt_scr_touch(r, page, True); } break; #endif case XTerm_restoreFG: rxvt_set_window_color(r, page, Color_fg, str); break; case XTerm_restoreBG: rxvt_set_window_color(r, page, Color_bg, str); break; case XTerm_logfile: /* TODO Write code */ break; case XTerm_font: rxvt_resize_on_font (r, (char*) str); break; /* 2006-03-14 gi1242 XXX: Why is this commented again? */ #if 0 case XTerm_dumpscreen: { int fd; if ((fd=open(str, O_RDWR | O_CREAT | O_EXCL, 0600))>=0) { rxvt_scr_dump(r, page, fd); close(fd); } } break; #endif case MRxvt_tabterm: /* Set window and tab title */ rxvt_tabbar_set_title (r, page, (const unsigned char TAINTED*) str); if( ISSET_OPTION(r, Opt2_syncTabTitle)) /* * Window title will automatically be synced, so setting it * again is wasteful. */ break; /* else FALL THROUGH */ case MRxvt_term: /* Set window title */ rxvt_set_term_title(r, (const unsigned char*) str); break; case MRxvt_tab: rxvt_tabbar_set_title (r, page, (const unsigned char TAINTED*) str); break; case MRxvt_tformat: { int len = STRLEN(str); if( IS_NULL( PVTS(r, page)->title_format ) || len != STRLEN( PVTS(r, page)->title_format ) ) { rxvt_free( PVTS(r, page)->title_format ); PVTS(r, page)->title_format = STRDUP(str); } else STRCPY( PVTS(r, page)->title_format, str ); /* Redraw the tab title. */ refresh_tabbar_tab( r, page ); break; } case MRxvt_wformat: { int len = STRLEN(str); if( IS_NULL( PVTS(r, page)->winTitleFormat ) || len != STRLEN( PVTS(r,page)->winTitleFormat ) ) { rxvt_free( PVTS(r,page)->winTitleFormat ); PVTS(r,page)->winTitleFormat = STRDUP(str); } else STRCPY( PVTS(r,page)->winTitleFormat, str ); if( ISSET_OPTION( r, Opt2_syncTabTitle ) ) sync_tab_title( r, ATAB(r) ); break; } /* * 2006-02-20 gi1242: These escape sequences are disabled for a possible * security flaw. A malicious user might be able to send a few escape * sequences through a text file, giving him more control than he should * have over the tabs. * * On that note, even the escape sequences for hiding or showing the * tabbar / scroll bar / menubar have been disabled. These aren't really * a security risk, however the user can access these functions through * either keyboard macros, or the popup menu, so these are really just * code bloat :). * * Only the local user should be able to create / close / move tabs. * * NOTE: The disabled code uses the old hotkey code (from mrxvt-0.4.2). * To enable the escape sequences below, you have to uncomment the code * below AND port it to use the macro feature from 0.5.0 upward. */ #if 0 /* {{{ DISABLED FOR SECURITY REASONS */ case MRxvt_hide: #ifdef HAVE_SCROLLBARS if ('s' == *str || 'S' == *str) /* show/hide scrollbar */ { rxvt_hotkey_hide_scrollbar (r, 0); } else #endif /* HAVE_SCROLLBARS */ #ifdef HAVE_MENUBAR if ('m' == *str || 'M' == *str) /* show/hide menubar */ { rxvt_hotkey_hide_menubar (r, 0); } else #endif /* HAVE_MENUBAR */ { rxvt_hotkey_hide_tabbar (r, 0); } break; case MRxvt_tabbtn: rxvt_hotkey_hide_button (r, 0); break; case MRxvt_saveconfig: rxvt_hotkey_save_config (r, 0); break; case MRxvt_newtab: rxvt_append_page (r, 0, str, NULL); break; case MRxvt_prevtab: if (0 != page) rxvt_activate_page (r, page-1); else if (0 != LTAB(r)) rxvt_activate_page (r, LTAB(r)); break; case MRxvt_nexttab: if (page != LTAB(r)) rxvt_activate_page (r, page+1); else if (0 != LTAB(r)) rxvt_activate_page (r, 0); break; case MRxvt_moveleft: rxvt_tabbar_move_tab (r, 0); break; case MRxvt_moveright: rxvt_tabbar_move_tab (r, 1); break; case MRxvt_closewin: if( *str ) { int tabno = atoi(str) - 1; if( tabno == -1 ) { rxvt_hotkey_kill_tab(r, NULL); } else if( tabno >=0 && tabno <=LTAB(r) && ( NOTSET_OPTION(r, Opt2_protectSecondary) || PVTS(r, tabno)->current_screen == PRIMARY)) { rxvt_kill_page (r, tabno); } break; } rxvt_hotkey_close_window (r, NULL); break; case MRxvt_switchtab: { int tabno = atoi(str) - 1; if( tabno == -1) rxvt_activate_page( r, PTAB(r)); else if( tabno >= 0 && tabno <= LTAB(r)) rxvt_activate_page( r, tabno); break; } #endif /* }}} */ /* * 2006-03-13 gi1242: The following are not security risks, but are * unnecessary. Only an interactive user needs such control, and he can * have it using macros / menus. */ #if 0 /* {{{ DISABLED because macros are more useful */ case MRxvt_verybold: /* rxvt_hotkey_verybold (r, 0); */ rxvt_toggle_verybold(r); break; #ifdef TRANSPARENT case MRxvt_trans: rxvt_toggle_transparency (r); break; #endif /* TRANSPARENT */ #endif /* }}} */ #ifdef MULTICHAR_SET case MRxvt_encode: /* We only change encoding method, but not font ;-) */ rxvt_set_multichar_encoding (r, str); break; #endif /* MULTICHAR_SET */ case MRxvt_opacity: if (IS_ATOM(r->h->xa[XA_NET_WM_WINDOW_OPACITY])) { int oldopacity = r->TermWin.opacity; int tmp; if ('-' == *str && (char) 0 == *(str+1)) { /* handle '-' only, remember it's opposite */ tmp = (r->h->rs[Rs_opacityDegree]) ? r->TermWin.opacity_degree : 1; } else if ('+' == *str && (char) 0 == *(str+1)) { /* handle '+' only, remember it's opposite */ tmp = (r->h->rs[Rs_opacityDegree]) ? -(r->TermWin.opacity_degree) : -1; } else { /* other cases, remember it's opposite */ tmp = 100 - atoi (str); /* only change opacity when it is valid */ if (tmp < 0 || tmp > 100) tmp = oldopacity; } if ('-' == *str || '+' == *str) /* use input as offset */ r->TermWin.opacity += tmp; else /* use input as absolute value */ r->TermWin.opacity = tmp; if (r->TermWin.opacity < 0) r->TermWin.opacity = 0; if (r->TermWin.opacity > 100) r->TermWin.opacity = 100; /* only change opacity when it has changed */ if (r->TermWin.opacity != oldopacity) rxvt_set_opacity (r); } break; case MRxvt_tabfg: case MRxvt_tabbg: case MRxvt_itabfg: case MRxvt_itabbg: rxvt_tabbar_change_color (r, op, str); break; #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) # ifdef TINTING_SUPPORT case MRxvt_tint: if (ISSET_PIXCOLOR (r->h, Color_tint) && r->h->rs[Rs_shade]) rxvt_set_window_color(r, page, Color_tint, str); break; case MRxvt_bgfade: /* Make bgfade behave like shade */ case MRxvt_shade: if (!ISSET_PIXCOLOR (r->h, Color_tint) || !r->h->rs[Rs_shade]) break; if( *str == '+' || *str == '-' ) { /* Relative shade level */ shade = (100 - r->TermWin.shade) + atoi(str); } else /* Absolute shade level */ shade = atoi (str); if (shade >=0 && shade <= 100) { shade = 100 - shade; /* reverse it */ changed = (r->TermWin.shade != shade); r->TermWin.shade = shade; } if (changed) { /* shade value is changed, need to refresh terminals */ rxvt_refresh_bg_image (r, page, False); } break; # endif /* TINTING_SUPPORT */ #endif /* TRANSPARENT || BACKGROUND_IMAGE */ case MRxvt_termenv: PVTS(r, page)->termenv = rxvt_get_termenv ((const char*) str); break; default: break; } } /*----------------------------------------------------------------------*/ /*{{{ process DEC private mode sequences `ESC [ ? Ps mode' */ /* * mode can only have the following values: * 'l' = low * 'h' = high * 's' = save * 'r' = restore * 't' = toggle * so no need for fancy checking */ /* INTPROTO */ int rxvt_privcases(rxvt_t* r, int page, int mode, uint32_t bit) { int state; if (mode == 's') { SET_PMODE (r, page, ISSET_PMODE(r, page, bit)); return -1; } else { if (mode == 'r') /* no overlapping */ state = ISSET_SMODE(r, page, bit) ? 1 : 0; else state = (mode == 't') ? !ISSET_PMODE(r, page, bit) : mode; PrivMode(state, bit, page); } return state; } /* we're not using priv _yet_ */ /* INTPROTO */ void rxvt_process_terminal_mode(rxvt_t* r, int page, int mode, int priv __attribute__((unused)), unsigned int nargs, const int *arg) { unsigned int i, j; int state; static const struct { const int argval; const uint32_t bit; } argtopriv[] = { { 1, PrivMode_aplCUR }, { 2, PrivMode_vt52 }, { 3, PrivMode_132 }, { 4, PrivMode_smoothScroll }, { 5, PrivMode_rVideo }, { 6, PrivMode_relOrigin }, { 7, PrivMode_Autowrap }, { 9, PrivMode_MouseX10 }, #ifdef menuBar_esc { menuBar_esc, PrivMode_menuBar }, #endif #ifdef scrollBar_esc { scrollBar_esc, PrivMode_scrollBar }, #endif { 25, PrivMode_VisibleCursor }, { 35, PrivMode_ShiftKeys }, { 40, PrivMode_132OK }, { 47, PrivMode_Screen }, { 66, PrivMode_aplKP }, #ifndef NO_BACKSPACE_KEY { 67, PrivMode_BackSpace }, #endif { 1000, PrivMode_MouseX11 }, { 1010, PrivMode_TtyOutputInh }, { 1011, PrivMode_Keypress }, { 1047, PrivMode_Screen }, /* * 2006-03-12 gi1242: xterm uses 1049 to switch to the alternate screen, * clear it and save the cursor position. Since 1048 was already * implemented with state unkept, we implement 1049 in the same way. * * XXX: I'm not sure if both 1048 and 1049 should be implemented with * state kept. */ }; if (nargs == 0) return; /* make lo/hi boolean */ if (mode == 'l') mode = 0; /* reset */ else if (mode == 'h') mode = 1; /* set */ for (i = 0; i < nargs; i++) { state = -1; /* basic handling */ for (j = 0; j < (sizeof(argtopriv)/sizeof(argtopriv[0])); j++) { if (argtopriv[j].argval == arg[i]) { state = rxvt_privcases(r, page, mode, argtopriv[j].bit); break; } } /* extra handling for values with state unkept */ if (state == -1 && (mode == 0 || mode == 1) ) { switch (arg[i]) { case 1048: /* alternative cursor save */ rxvt_scr_cursor(r, page, mode == 0 ? RESTORE : SAVE ); break; case 1049: /* Alternate screen with cursor save & clearing (like xterm). XXX Should we implement with state kept? */ if( mode == 0 ) { rxvt_scr_change_screen(r, page, PRIMARY); rxvt_scr_cursor( r, page, RESTORE ); } else { rxvt_scr_cursor( r, page, SAVE ); rxvt_scr_change_screen(r, page, SECONDARY); rxvt_scr_erase_screen(r, page, 2); } /* FALLTHROUGH */ default: continue; /* for(;i;) */ } continue; } /* extra handling for values with valid 0 or 1 state */ switch (arg[i]) { /* case 1: - application cursor keys */ case 2: /* VT52 mode */ /* oddball mode. should be set regardless of set/reset * parameter. Return from VT52 mode with an ESC < from * within VT52 mode */ PrivMode(1, PrivMode_vt52, page); break; case 3: /* 80/132 */ if (ISSET_PMODE(r, page, PrivMode_132OK)) { unsigned int w = Width2Pixel((state ? 132 : 80)) + r->szHint.base_width; unsigned int h = r->szHint.base_height; XResizeWindow (r->Xdisplay, r->TermWin.parent, w, h); r->h->want_resize = 1; } break; case 4: /* smooth scrolling */ if (state) { /* Unset jump scroll */ r->h->refresh_limit = BUFSIZ-1; r->h->skip_pages = 1; } else { /* Set jump scroll */ rxvt_set_jumpscroll(r); } break; case 5: /* reverse video */ rxvt_scr_rvideo_mode(r, page, state); break; case 6: /* relative/absolute origins */ rxvt_scr_relative_origin(r, page, state); break; case 7: /* autowrap */ rxvt_scr_autowrap(r, page, state); break; /* case 8: - auto repeat, can't do on a per window basis */ case 9: /* X10 mouse reporting */ if (state) /* orthogonal */ UNSET_PMODE(r, page, PrivMode_MouseX11); break; #ifdef HAVE_MENUBAR # ifdef menuBar_esc case menuBar_esc: if (state) { if (rxvt_menubar_show(r)) rxvt_resize_on_subwin (r, SHOW_MENUBAR); } else { if (rxvt_menubar_hide(r)) rxvt_resize_on_subwin (r, HIDE_MENUBAR); } break; # endif #endif #ifdef HAVE_SCROLLBARS # ifdef scrollBar_esc case scrollBar_esc: if (state) { if (rxvt_scrollbar_show (r)) rxvt_resize_on_subwin (r, SHOW_SCROLLBAR); } else { if (rxvt_scrollbar_hide (r)) rxvt_resize_on_subwin (r, HIDE_SCROLLBAR); } break; # endif #endif case 25: /* visible/invisible cursor */ rxvt_scr_cursor_visible(r, page, state); break; /* case 35: - shift keys */ /* case 40: - 80 <--> 132 mode */ case 47: /* secondary screen */ rxvt_scr_change_screen(r, page, state); break; /* case 66: - application key pad */ /* case 67: - backspace key */ case 1000: /* X11 mouse reporting */ if (state) /* orthogonal */ UNSET_PMODE(r, page, PrivMode_MouseX10); break; #if 0 case 1001: break; /* X11 mouse highlighting */ #endif case 1010: /* scroll to bottom on TTY output inhibit */ if (state) SET_OPTION(r, Opt_scrollTtyOutputInhibit); else UNSET_OPTION(r, Opt_scrollTtyOutputInhibit); break; case 1011: /* scroll to bottom on key press */ if (state) SET_OPTION(r, Opt_scrollTtyKeypress); else UNSET_OPTION(r, Opt_scrollTtyKeypress); break; case 1047: /* secondary screen w/ clearing */ /* * 2006-03-12 gi1242 XXX: Xterm does NOT clear the alternate * screen with this escape sequence. I hope whomever wrote this * knew what he was doing. */ if (PVTS(r, page)->current_screen != PRIMARY) rxvt_scr_erase_screen(r, page, 2); rxvt_scr_change_screen(r, page, state); /* FALLTHROUGH */ default: break; } } } /*}}} */ /*{{{ process sgr sequences */ /* INTPROTO */ void rxvt_process_sgr_mode(rxvt_t* r, int page, unsigned int nargs, const int *arg) { unsigned int i; short rendset; int rendstyle = 0; if (nargs == 0) { rxvt_scr_rendition(r, page, 0, ~RS_None); return; } for (i = 0; i < nargs; i++) { rendset = -1; switch (arg[i]) { case 0: rendset = 0, rendstyle = ~RS_None; break; case 1: rendset = 1, rendstyle = RS_Bold; break; case 4: rendset = 1, rendstyle = RS_Uline; break; case 5: rendset = 1, rendstyle = RS_Blink; break; case 7: rendset = 1, rendstyle = RS_RVid; break; case 22: rendset = 0, rendstyle = RS_Bold; break; case 24: rendset = 0, rendstyle = RS_Uline; break; case 25: rendset = 0, rendstyle = RS_Blink; break; case 27: rendset = 0, rendstyle = RS_RVid; break; } if (rendset != -1) { rxvt_scr_rendition(r, page, rendset, rendstyle); continue; /* for(;i;) */ } switch (arg[i]) { case 30: case 31: /* set fg color */ case 32: case 33: case 34: case 35: case 36: case 37: rxvt_scr_color(r, page, (unsigned int)(minCOLOR+(arg[i]-30)), Color_fg); break; #ifdef TTY_256COLOR case 38: if (nargs > i + 2 && arg[i + 1] == 5) { rxvt_scr_color(r, page, (unsigned int)(minCOLOR+arg[i+2]), Color_fg); i += 2; } break; #endif case 39: /* default fg */ rxvt_scr_color(r, page, Color_fg, Color_fg); break; case 40: case 41: /* set bg color */ case 42: case 43: case 44: case 45: case 46: case 47: rxvt_scr_color(r, page, (unsigned int)(minCOLOR+(arg[i]-40)), Color_bg); break; #ifdef TTY_256COLOR case 48: if (nargs > i + 2 && arg[i + 1] == 5) { rxvt_scr_color(r, page, (unsigned int)(minCOLOR+arg[i+2]), Color_bg); i += 2; } break; #endif case 49: /* default bg */ rxvt_scr_color(r, page, Color_bg, Color_bg); break; #ifndef NO_BRIGHTCOLOR case 90: case 91: /* set bright fg color */ case 92: case 93: case 94: case 95: case 96: case 97: rxvt_scr_color(r, page, (unsigned int)(minBrightCOLOR+(arg[i]-90)), Color_fg); break; case 100: case 101: /* set bright bg color */ case 102: case 103: case 104: case 105: case 106: case 107: rxvt_scr_color(r, page, (unsigned int)(minBrightCOLOR+(arg[i]-100)), Color_bg); break; #endif } } } /*}}} */ /*{{{ process Rob Nation's own graphics mode sequences */ /* INTPROTO */ void rxvt_process_graphics(rxvt_t* r, int page) { int readpage = page; unsigned char ch, cmd = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } if (cmd == 'Q') /* query graphics */ { rxvt_tt_printf(r, page, "\033G0\n"); /* no graphics */ return; } /* swallow other graphics sequences until terminating ':' */ do { ch = rxvt_cmd_getc(r, &readpage); if( readpage == -1 ) { rxvt_set_escfail( r, page, 1 ); return; } } while( ch != ':' && ch >= ' ' && ch <= '~' ); /* 2007-01-06 gi1242: In case the escape sequence is malformed, swallow only printable characters. */ } /*}}} */ /* ------------------------------------------------------------------------- */ /* * Process the value returned by rxvt_cmd_getc() here. This processes escape * sequences, and adds text to the tabs output buffer. */ /* INTPROTO */ void rxvt_process_getc( rxvt_t *r, int page, unsigned char ch ) { int limit; /* Number of lines to read before asking for a refresh */ limit = r->h->skip_pages * r->TermWin.nrow; if( limit < 0 ) /* Integer overflow */ limit = INT_MAX; /* * Process as much input from the tab as is available. Keep a count of the * (approximate) number of lines we have scrolled, so we know when to * refresh. */ for(;;) { if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { /* * Read the longest text string we can from the input buffer. */ int nlines = 0, /* #lines read */ nchars, /* #chars read before newline */ refreshnow = 0; /* If we should request a refresh */ unsigned char *str; nchars = PSCR(r, page).cur.col; /* * point `str' to the start of the string, decrement first since * it was post incremented in rxvt_cmd_getc() */ str = --(PVTS(r, page)->cmdbuf_ptr); while (PVTS(r, page)->cmdbuf_ptr < PVTS(r, page)->cmdbuf_endp) { ch = *(PVTS(r, page)->cmdbuf_ptr)++; if (ch == '\n') { nchars = 0; nlines++; PVTS(r, page)->scrolled_lines++; } else if (ch < ' ' && ch != '\t' && ch != '\r') { /* * Unprintable. Reduce cmdbuf_ptr so that this character * will be processed later. */ PVTS(r, page)->cmdbuf_ptr--; break; } else if( ++nchars > r->TermWin.ncol ) { PVTS(r, page)->scrolled_lines++; nchars = 0; } if( PVTS(r, page)->mapped && PVTS(r, page)->scrolled_lines >= limit ) { refreshnow = 1; break; } } rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "\e[31mAdding %d chars %d lines in tab %d\e[0m\n%.*s\n", PVTS(r, page)->cmdbuf_ptr - str, nlines, page, PVTS(r, page)->cmdbuf_ptr - str, str)); /* * NOTE: nlines can not be MORE than the number of lines we will * actually add! */ rxvt_scr_add_lines(r, page, str, nlines, (PVTS(r, page)->cmdbuf_ptr - str)); /* * Only refresh the screen if we've scrolled more than * MAX_SKIPPED_PAGES pages. * * Refreshing should be correct for small scrolls, because * nbytes_last_read will be small, forcing the refresh. */ if (refreshnow) { refreshnow = 0; /* * Note: If the tab is not visible, then rxvt_scr_refresh * returns immediately. Also rxvt_scr_refresh resets * scrolled_lines. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "Requesting refresh." " Active tab (%d) scrolled %d lines\n", ATAB(r), AVTS(r)->scrolled_lines )); rxvt_scr_refresh(r, page, (r->h->refresh_type & ~CLIPPED_REFRESH) ); /* If we have X events to process, then do so now. */ if( XPending( r->Xdisplay ) ) break; } } /* * Process escape sequence */ else if( ch == C0_ESC ) { /* Save the start of the escape sequence */ if( IS_NULL( PVTS(r, page)->cmdbuf_escstart ) ) PVTS(r, page)->cmdbuf_escstart = PVTS(r, page)->cmdbuf_ptr-1; /* Forget the previous escape sequence failure (if any) */ SET_NULL( PVTS(r, page)->cmdbuf_escfail ); /* Attempt to process the escape sequence */ rxvt_process_escape_seq(r, page); /* If we succeeded, then clear the start. */ if( IS_NULL( PVTS(r, page)->cmdbuf_escfail ) ) SET_NULL( PVTS(r, page)->cmdbuf_escstart ); else /* Otherwise don't process any more data from this tab */ break; } /* * Anything else must be a non-printing character */ else { rxvt_process_nonprinting(r, page, ch); } /* * Check if we can keep reading on this tab. * * NOTE: We could check if we also have pending X events, but this will * generate many many extra protocol requests, which can be quite a * problem on a slow connection. Thus for now we only process X events * on screen refreshes or in rxvt_cmd_getc(). */ if( rxvt_cmdbuf_has_input( r, page ) ) ch = *PVTS(r,page)->cmdbuf_ptr++; else break; } /* for(;;) */ } /*{{{ Read and process output from the application */ /* LIBPROTO */ void rxvt_main_loop(rxvt_t *r) { register int i; unsigned char ch; int page; rxvt_dbgmsg ((DBG_VERBOSE, DBG_COMMAND, "Entering rxvt_main_loop()\n" )); /* Send the screen size. */ for (i = 0; i <= LTAB(r); i ++) { rxvt_tt_winsize(PVTS(r, i)->cmd_fd, r->TermWin.ncol, r->TermWin.nrow, PVTS(r, i)->cmd_pid); } while (1) { /* wait for something */ page = -1; ch = 0; while( r->ndead_childs == 0 && /* Nothing dead */ r->cleanDeadChilds == 0 && /* Nothing to be cleaned up */ ( (ch = rxvt_cmd_getc(r, &page)) == 0 ) /* No input */ ) ; /* * 2006-08-23 gi1242: If rxvt_cmd_getc is called, and then * r->ndead_childs gets set during this call, then we should not discard * the return value of rxvt_cmd_getc. */ if( page != -1 && ch != 0 ) /* rxvt_cmd_getc() returned something */ rxvt_process_getc( r, page, ch ); /* * See if we need a refresh. If we read a large number of bytes from * this tabs cmd_fd, then we should let rxvt_process_getc() handle the * refresh (because we might be "flat out" scrolling). * * If we read a small number of bytes on our last read(), then we should * refresh the screen here, because if other tabs are busy, we can not * count on rxvt_cmd_getc() refreshing the screen. * * XXX 2006-09-01 gi1242: If we have multiple visible terminal windows, * then we should do this refresh for ALL tabs with visible terminal * windows (and not only the active tab). */ if( AVTS(r)->nbytes_last_read <= r->h->refresh_limit ) rxvt_refresh_vtscr_if_needed( r ); /* * handle the case that some children have died regardless of what * rxvt_cmd_getc returned */ if (r->ndead_childs > 0 || r->cleanDeadChilds ) rxvt_clean_cmd_page (r); } /* while(1) */ /* NOT REACHED */ assert (0); } /* * Send printf() formatted output to the command. * Only use for small amounts of data. */ /* EXTPROTO */ void rxvt_tt_printf(rxvt_t* r, int page, const char *fmt,...) { va_list arg_ptr; unsigned char buf[256]; va_start(arg_ptr, fmt); vsnprintf((char *)buf, sizeof(buf)-1, fmt, arg_ptr); buf[sizeof(buf)-1] = (unsigned char) 0; va_end(arg_ptr); rxvt_tt_write(r, page, buf, (unsigned int)STRLEN(buf)); } /* ---------------------------------------------------------------------- */ /* Addresses pasting large amounts of data and rxvt hang * code pinched from xterm (v_write()) and applied originally to * rxvt-2.18 - Hops * Write data to the pty as typed by the user, pasted with the mouse, * or generated by us in response to a query ESC sequence. */ /* EXTPROTO */ void rxvt_tt_write(rxvt_t* r, int page, const unsigned char *d, int len) { #define MAX_PTY_WRITE 128 /* 1/2 POSIX minimum MAX_INPUT */ register int k, beg, end; if (ISSET_OPTION(r, Opt2_broadcast)) { beg = 0; end = LTAB(r); } else { beg = end = page; } for (k = beg; k <= end; k ++) { int riten; int p; /* start of physical buffer */ unsigned char* v_buffer; /* start of current buffer pending */ unsigned char* v_bufstr; /* end of current buffer pending */ unsigned char* v_bufptr; /* end of physical buffer */ unsigned char* v_bufend; rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "rxvt_tt_write %d (%s)\n", k, d ? (char*) d: "nil")); if (IS_NULL(PVTS(r, k)->v_bufstr) && len > 0) { p = (len / MAX_PTY_WRITE + 1) * MAX_PTY_WRITE; if (p <= 0) /* possible integer overflow */ return ; v_buffer = v_bufstr = v_bufptr = rxvt_malloc(p); v_bufend = v_buffer + p; } else { v_buffer = PVTS(r, k)->v_buffer; v_bufstr = PVTS(r, k)->v_bufstr; v_bufptr = PVTS(r, k)->v_bufptr; v_bufend = PVTS(r, k)->v_bufend; } /* * Append to the block we already have. Always doing this simplifies the * code, and isn't too bad, either. If this is a short block, it isn't * too expensive, and if this is a long block, we won't be able to write * it all anyway. */ if (len > 0) { if (v_bufend < v_bufptr + len) { /* run out of room */ if (v_bufstr != v_buffer) { /* there is unused space, move everything down */ MEMMOVE(v_buffer, v_bufstr, (unsigned int)(v_bufptr - v_bufstr)); v_bufptr -= v_bufstr - v_buffer; v_bufstr = v_buffer; } if (v_bufend < v_bufptr + len) { /* still won't fit: get more space, use most basic ** realloc because an error is not fatal. */ unsigned int size = v_bufptr - v_buffer; unsigned int reallocto; reallocto = ((size+len) / MAX_PTY_WRITE + 1) *MAX_PTY_WRITE; v_buffer = rxvt_realloc(v_buffer, reallocto); /* save across realloc */ if (v_buffer) { v_bufstr = v_buffer; v_bufptr = v_buffer + size; v_bufend = v_buffer + reallocto; } else { /* no memory: ignore entire write request */ rxvt_msg (DBG_ERROR, DBG_COMMAND, "data loss: cannot allocate buffer space"); /* restore clobbered pointer */ v_buffer = v_bufstr; } } } if (v_bufend >= v_bufptr + len) { /* new stuff will fit */ MEMCPY(v_bufptr, d, len); v_bufptr += len; } } /* * Write out as much of the buffer as we can. Be careful not to overflow * the pty's input silo. We are conservative here and only write a small * amount at a time. * * If we can't push all the data into the pty yet, we expect write to * return a non-negative number less than the length requested (if some * data written) or -1 and set errno to EAGAIN, EWOULDBLOCK, or EINTR * (if no data written). * * (Not all systems do this, sigh, so the code is actually a little more * forgiving.) */ if ((p = v_bufptr - v_bufstr) > 0) { riten = write(PVTS(r, k)->cmd_fd, v_bufstr, min(p, MAX_PTY_WRITE)); rxvt_dbgmsg ((DBG_DEBUG, DBG_COMMAND, "tt_write %d chars to vts[%d].cmd_fd = %d\n", riten, k, PVTS(r, k)->cmd_fd)); if (riten < 0) riten = 0; v_bufstr += riten; if (v_bufstr >= v_bufptr) /* we wrote it all */ v_bufstr = v_bufptr = v_buffer; } /* * If we have lots of unused memory allocated, return it */ if (v_bufend - v_bufptr > MAX_PTY_WRITE * 8) { /* arbitrary hysteresis, save pointers across realloc */ unsigned int start = v_bufstr - v_buffer; unsigned int size = v_bufptr - v_buffer; unsigned int reallocto; reallocto = (size / MAX_PTY_WRITE + 1) * MAX_PTY_WRITE; v_buffer = rxvt_realloc(v_buffer, reallocto); if (v_buffer) { v_bufstr = v_buffer + start; v_bufptr = v_buffer + size; v_bufend = v_buffer + reallocto; } else { /* should we print a warning if couldn't return memory? */ /* restore clobbered pointer */ v_buffer = v_bufstr - start; } } PVTS(r, k)->v_buffer = v_buffer; PVTS(r, k)->v_bufstr = v_bufstr; PVTS(r, k)->v_bufptr = v_bufptr; PVTS(r, k)->v_bufend = v_bufend; } /* for */ } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/command.h0000644000175000001440000000632210756127602012204 00000000000000/*--------------------------------*-H-*---------------------------------* * File: command.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __COMMAND_H__ #define __COMMAND_H__ #define STRING_MAX 512 /* max string size for process_rxvt_xterm_seq() */ #define ESC_ARGS 32 /* max # of args for esc sequences */ #ifdef OFFIX_DND # define DndFile 2 # define DndDir 5 # define DndLink 7 #endif #ifndef MULTICLICK_TIME # define MULTICLICK_TIME 500 #endif #ifndef SCROLLBAR_INITIAL_DELAY # ifdef NEXT_SCROLLER # define SCROLLBAR_INITIAL_DELAY 20 # else # define SCROLLBAR_INITIAL_DELAY 40 # endif #endif #ifndef SCROLLBAR_CONTINUOUS_DELAY # define SCROLLBAR_CONTINUOUS_DELAY 2 #endif /* * Home/End key-strings. (The trailing '~' will be automatically added). * * If only these keys were standardized */ /* Linux console style */ #define KS_HOME_LINUX "\033[1" /* Home == Find */ #define KS_END_LINUX "\033[4" /* End == Select */ /* X Terminal style [default] */ #define KS_HOME "\033[7" /* Home */ #define KS_END "\033[8" /* End */ /* * ESC-Z processing: * * By stealing a sequence to which other xterms respond, and sending the * same number of characters, but having a distinguishable sequence, * we can avoid having a timeout (when not under an rxvt) for every login * shell to auto-set its DISPLAY. * * This particular sequence is even explicitly stated as obsolete since * about 1985, so only very old software is likely to be confused, a * confusion which can likely be remedied through termcap or TERM. Frankly, * I doubt anyone will even notice. We provide a #ifdef just in case they * don't care about auto-display setting. Just in case the ancient * software in question is broken enough to be case insensitive to the 'c' * character in the answerback string, we make the distinguishing * characteristic be capitalization of that character. The length of the * two strings should be the same so that identical read(2) calls may be * used. */ #define VT100_ANS "\033[?1;2c" /* vt100 answerback */ #ifndef ESCZ_ANSWER # define ESCZ_ANSWER VT100_ANS /* obsolete ANSI ESC[c */ #endif #endif /* __COMMAND_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/xdefaults.c0000644000175000001440000013077311032001370012545 00000000000000/*--------------------------------*-C-*---------------------------------* * File: xdefaults.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1994 Robert Nation * Copyright (c) 1997,1998 mj olesen * Copyright (c) 2004 Terry Griffin * Copyright (c) 2005 Grant McDorman * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ #ifndef NO_RESOURCES void rxvt_get_xdefaults (rxvt_t*, FILE*, const char*, macro_priority_t); #endif /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ static const char *emptyResource = ""; static const char *const xnames[3] = { ".mrxvtrc", ".Xdefaults", ".Xresources", }; /*{{{ monolithic option/resource structure: */ /* * `string' options MUST have a usage argument * `switch' and `boolean' options have no argument * if there's no desc(ription), it won't appear in rxvt_usage() */ /* INFO() - descriptive information only */ #define INFO(opt, arg, desc) \ {0, -1, NULL, (opt), (arg), (desc), 0} /* STRG() - command-line option, with/without resource */ #define STRG(rsp, kw, opt, arg, desc, multiple) \ {0, (rsp), (kw), (opt), (arg), (desc), (multiple)} /* RSTRG() - resource/long-option */ #define RSTRG(rsp, kw, arg, multiple) \ {0, (rsp), (kw), NULL, (arg), NULL, (multiple)} /* BOOL() - regular boolean `-/+' flag */ #define BOOL(kw, opt, flag, desc) \ {(flag), -1, (kw), (opt), NULL, (desc), 0} /* SWCH() - `-' flag */ #define SWCH(kw, opt, flag, desc) \ {(flag), -1, (kw), (opt), NULL, (desc), 0} /* convenient macros */ #define optList_STRLEN(i) \ (optList[i].flag ? 0 : (optList[i].arg ? STRLEN(optList[i].arg) : 1)) #define optList_isBool(i) \ (optList[i].flag) #define optList_isReverse(i) \ (optList[i].flag & Opt_Reverse) #define optList_isMultiple(i) \ (optList[i].multiple) #define optList_size() \ (sizeof(optList) / sizeof(optList[0])) static const struct { const uint32_t flag; /* Option flag */ const int doff; /* data offset */ const char* kw; /* keyword */ const char* opt; /* option */ const char* arg; /* argument */ const char* desc; /* description */ const char BOOLVAR( multiple, 1 ); /* multiple values for profiles */ } optList[] = { /* Options for each profile */ #ifdef BACKGROUND_IMAGE STRG(Rs_backgroundPixmap, "Pixmap", "pixmap", "file[;geom]", "background image for a tab", 1), #endif STRG(Rs_tabtitle, "tabTitle", "tt", "string", "title name for tab", 1), STRG(Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save for tab", 1), STRG(Rs_command, "command", "e", "string", "command to execute for a tab", 1), STRG( Rs_foreground, "foreground", "fg", "color", "foreground color for a tab", 1), STRG( Rs_background, "background", "bg", "color", "background color for a tab", 1), STRG( Rs_cwd, "workingDirectory", "wd", "dir", "Working directory to open new tabs in", 1 ), STRG(Rs_holdExit, "holdExit", "hold", "number", "Keep tab open after child exits, based on childs exit status", 1 ), STRG(Rs_holdExitTxt, "holdExitText", "het", "string", "text to show while holding the terminal", 1), STRG(Rs_holdExitTtl, "holdExitTitle", "heT", "string", "Tab title of exited tabs", 1), STRG(Rs_titleFormat, "titleFormat", "tf", "string", "Displayed tab title format", 1), STRG( Rs_winTitleFormat, "winTitleFormat", "wtf", "string", "format of window title (when syncing to tab title)", 1 ), /* Global options */ STRG(Rs_maxTabWidth, "maxTabWidth", "mtw", "number", "maximum (char) title width of all tabs", 0), STRG(Rs_minVisibleTabs, "minVisibleTabs", "mvt", "number", "minimum # of tabs to keep visible (requires xftpfn)", 0), BOOL( "highlightTabOnBell", "htb", Opt2_hlTabOnBell, "highlighting inactive tabs only when bell sounds" ), BOOL( "syncTabTitle", "stt", Opt2_syncTabTitle, "synchronizing terminal title with tab title" ), BOOL( "hideTabbar", "ht", Opt2_hideTabbar, "hiding tabbar on initialization" ), BOOL( "autohideTabbar", "aht", Opt2_autohideTabbar, "auto hide/show the tabbar depending on number of open tabs" ), BOOL( "bottomTabbar", "bt", Opt2_bottomTabbar, "showing tabbar at bottom" ), BOOL( "hideButtons", "hb", Opt2_hideButtons, "hide buttons on tabbar" ), BOOL( "syncTabIcon", "sti", Opt2_syncTabIcon, "synchronizing icon name with tab title" ), BOOL( "veryBoldFont", "vbf", Opt2_veryBold, "showing color text with bold font" ), #ifndef NO_BRIGHTCOLOR BOOL( "boldColors", NULL, Opt2_boldColors, NULL), /* Show bold primary colors using bright colors */ BOOL( "veryBright", NULL, Opt_veryBright, NULL), /* Show bold primary colors using bold font also */ #endif STRG(Rs_container_window, NULL, "into", "WinID", "Parent window id", 0), STRG(Rs_display_name, NULL, "d", NULL, NULL, 0), STRG(Rs_display_name, NULL, "display", "string", "X server to contact", 0), STRG(Rs_term_name, "termName", "tn", "string", "the TERM environment variable", 0), STRG(Rs_title, "title", "title", "string", "title name for window", 0), STRG(Rs_geometry, NULL, "g", NULL, NULL, 0), STRG(Rs_geometry, "geometry", "geometry", "geometry", "size (in characters) and position", 0), BOOL( "interceptConsole", "C", Opt_console, "intercept console messages" ), BOOL( "startIconic", "iconic", Opt_iconic, "start iconic" ), BOOL( "maximized", "m", Opt2_maximized, "Start maximized" ), BOOL( "fullscreen", "fs", Opt2_fullscreen, "Start fullscreen" ), BOOL( "reverseVideo", "rv", Opt_reverseVideo, "reverse video" ), BOOL( "loginShell", "ls", Opt_loginShell, "login shell" ), RSTRG( Rs_refreshLimit, "refreshLimit", "nchars", 0 ), RSTRG( Rs_skipPages, "skipPages", "%d", 0 ), #ifdef TINTING_SUPPORT STRG(Rs_color + Color_tint, "tintColor", "tint", "color", "tint color", 0), STRG(Rs_shade, "shading", "shade", "%", "shade background by %x when tinting", 0), STRG(Rs_shade, "backgroundFade", "bgfade", "%", "fade background image or transparent background by %x (obsolete)", 0), #endif #ifdef TRANSPARENT RSTRG(Rs_bgRefreshInterval, "bgRefreshInterval", "ms", 0), #endif STRG(Rs_fade, "fading", "fade", "%", "make colors x% darker when losing focus", 0), #ifdef HAVE_SCROLLBARS BOOL( "scrollBar", "sb", Opt_scrollBar, "scrollbar" ), BOOL( "scrollbarRight", "sr", Opt_scrollBar_right, "scrollbar right" ), BOOL( "scrollbarFloating", "st", Opt_scrollBar_floating, "scrollbar without a trough" ), STRG(Rs_scrollBar_thickness, "scrollbarThickness", "sbt", "number", "scrollbar thickness/width in pixels", 0), STRG(Rs_scrollBar_style, "scrollbarStyle", "ss", "mode", "scrollbar style = plain|xterm|rxvt|next|sgi", 0), STRG(Rs_scrollBar_align, "scrollbarAlign", "sa", "mode", "scrollbar alignment = top|bottom", 0), # ifdef BACKGROUND_IMAGE STRG(Rs_scrollbarPixmap, "scrollbarPixmap", "sbpixmap", "file[;geom]", "scrollbar background image", 0), # endif #endif BOOL( "scrollTtyOutputInhibit", "si", Opt_scrollTtyOutputInhibit, "scroll-on-tty-output inhibit" ), BOOL( "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress" ), STRG(Rs_opacity, "opacity", "o", "%", "transluscent window (true transparent) opaque degree", 0), STRG(Rs_opacityDegree, "opacityDegree", "od", "%", "transluscent window opaque degree interval", 0), #ifdef TRANSPARENT BOOL( "transparent", "tr", Opt_transparent, "transparent" ), BOOL( "transparentForce", "trf", Opt_forceTransparent, "forcefully transparent" ), # ifdef HAVE_SCROLLBARS BOOL( "transparentScrollbar", "trs", Opt_transparent_scrollbar, "transparent scrollbar" ), # endif # ifdef HAVE_MENUBAR BOOL( "transparentMenubar", "trm", Opt_transparent_menubar, "transparent menubar" ), # endif BOOL( "transparentTabbar", "trt", Opt_transparent_tabbar, "transparent tabbar" ), #endif /* TRANSPARENT */ #ifdef BACKGROUND_IMAGE STRG(Rs_tabbarPixmap, "tabbarPixmap", "tbpixmap", "file[;geom]", "tabbar background image", 0), BOOL( "tabUsePixmap", "tupixmap", Opt_tabPixmap, "use tabbar background image for tabs" ), STRG(Rs_appIcon, "appIcon", "ic", "file[;geom]", "application icon file", 0), #endif /* BACKGROUND_IMAGE */ BOOL( "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit - do not log to utmp" ), STRG(Rs_confFile, NULL, "cf", "file", "Configuration file instead of ~/.mrxvtrc", 0), #ifndef NO_BELL BOOL( "visualBell", "vb", Opt_visualBell, "visual bell" ), BOOL( "currentTabVBell", "ctvb", Opt_currentTabVBell, "visual bell only for active tab in focused window" ), RSTRG( Rs_vBellDuration, "vBellDuration", "Duration (ms) of the visual bell", 0), STRG( Rs_bellCommand, "bellCommand", "blc", "string", "command to execute instead of beeping", 0), STRG( Rs_monitorCommand, "monitorCommand", "mcmd", "string", "command to execute if activity/inactivity was detected while monitoring", 0), STRG( Rs_monitorTimeout, "monitorTimeout", "mto", "number", "timeout in milliseconds for tab-monitoring", 0), # if ! defined(NO_MAPALERT) && defined(MAPALERT_OPTION) BOOL( "mapAlert", NULL, Opt_mapAlert, NULL ), # endif #endif #ifdef META8_OPTION BOOL( "meta8", "m8", Opt_meta8, "meta8" ), #endif #ifdef MOUSE_WHEEL BOOL( "mouseWheelScrollPage", "mp", Opt_mouseWheelScrollPage, "mouse wheel scrolling a page" ), #endif #ifdef MULTICHAR_SET BOOL( "multibyte_cursor", "mcc", Opt_mc_hack, "Multibyte character cursor movement" ), #endif #ifndef NO_FRILLS BOOL( "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection" ), #endif STRG(Rs_color + Color_ufbg, "ufBackground", "ufbg", "color", "unfocused background color", 0), #ifdef TEXT_SHADOW STRG(Rs_textShadow, "textShadow", "ts", "color", "text shadow color", 0), STRG(Rs_textShadowMode, "textShadowMode", "tsm", "mode", "shadow mode = " "top|bottom|left|right|topleft|topright|botleft|botright", 0), #endif STRG(Rs_tabfg, "tabForeground", "tabfg", "color", "tabbar active tab foreground color", 0), STRG(Rs_tabbg, "tabBackground", "tabbg", "color", "tabbar and active tab background color", 0), STRG(Rs_itabfg, "itabForeground", "itabfg", "color", "tabbar inactive tab foreground color", 0), STRG(Rs_itabbg, "itabBackground", "itabbg", "color", "tabbar inactive tab background color", 0), RSTRG(Rs_color + minCOLOR + 0, "color0", "color", 0), RSTRG(Rs_color + minCOLOR + 1, "color1", "color", 0), RSTRG(Rs_color + minCOLOR + 2, "color2", "color", 0), RSTRG(Rs_color + minCOLOR + 3, "color3", "color", 0), RSTRG(Rs_color + minCOLOR + 4, "color4", "color", 0), RSTRG(Rs_color + minCOLOR + 5, "color5", "color", 0), RSTRG(Rs_color + minCOLOR + 6, "color6", "color", 0), RSTRG(Rs_color + minCOLOR + 7, "color7", "color", 0), #ifndef NO_BRIGHTCOLOR RSTRG(Rs_color + minBrightCOLOR + 0, "color8", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 1, "color9", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 2, "color10", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 3, "color11", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 4, "color12", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 5, "color13", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 6, "color14", "color", 0), RSTRG(Rs_color + minBrightCOLOR + 7, "color15", "color", 0), #endif /* NO_BRIGHTCOLOR */ #ifndef NO_BOLD_UNDERLINE_REVERSE RSTRG(Rs_color + Color_BD, "colorBD", "color", 0), RSTRG(Rs_color + Color_UL, "colorUL", "color", 0), RSTRG(Rs_color + Color_RV, "colorRV", "color", 0), #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ #ifdef KEEP_SCROLLCOLOR RSTRG(Rs_color + Color_scroll, "scrollColor", "color", 0), RSTRG(Rs_color + Color_trough, "troughColor", "color", 0), #endif /* KEEP_SCROLLCOLOR */ #ifdef OPTION_HC RSTRG(Rs_color + Color_HC, "highlightColor", "color", 0), #endif #ifndef NO_CURSORCOLOR STRG(Rs_color + Color_cursor, "cursorColor", "cr", "color", "cursor color", 0), RSTRG(Rs_color + Color_cursor2, "cursorColor2", "color", 0), #endif /* NO_CURSORCOLOR */ STRG(Rs_color + Color_pointer, "pointerColor", "pr", "color", "pointer color", 0), STRG(Rs_color + Color_border, "borderColor", "bd", "color", "border color", 0), #if defined (BACKGROUND_IMAGE) || defined(HAVE_MENUBAR) RSTRG(Rs_path, "path", "search path", 0), #endif /* defined (BACKGROUND_IMAGE) || (HAVE_MENUBAR) */ #ifdef HAVE_MENUBAR STRG(Rs_menu, "menu", "menu", "filename[;tag]", "menubar definition file", 0), BOOL( "showMenu", "showmenu", Opt_showMenu, "show menubar" ), # ifdef BACKGROUND_IMAGE STRG(Rs_menubarPixmap, "menubarPixmap", "mbpixmap", "file[;geom]", "menubar background image", 0), # endif #endif #ifndef NO_BOLDFONT STRG(Rs_boldFont, "boldFont", "fb", "fontname", "bold text font", 0), # if MAX_NFONTS > 1 RSTRG(Rs_boldFont + 1, "boldFont1", "fontname", 0), #endif # if MAX_NFONTS > 2 RSTRG(Rs_boldFont + 2, "boldFont2", "fontname", 0), #endif # if MAX_NFONTS > 3 RSTRG(Rs_boldFont + 3, "boldFont3", "fontname", 0), #endif # if MAX_NFONTS > 4 RSTRG(Rs_boldFont + 4, "boldFont4", "fontname", 0), #endif # if MAX_NFONTS > 5 RSTRG(Rs_boldFont + 5, "boldFont5", "fontname", 0), #endif # if MAX_NFONTS > 6 RSTRG(Rs_boldFont + 6, "boldFont6", "fontname", 0), #endif # if MAX_NFONTS > 7 RSTRG(Rs_boldFont + 7, "boldFont7", "fontname", 0), #endif #endif STRG(Rs_font + 0, "font", "fn", "fontname", "normal text font", 0), #if MAX_NFONTS > 1 RSTRG(Rs_font + 1, "font1", "fontname", 0), #endif #if MAX_NFONTS > 2 RSTRG(Rs_font + 2, "font2", "fontname", 0), #endif #if MAX_NFONTS > 3 RSTRG(Rs_font + 3, "font3", "fontname", 0), #endif #if MAX_NFONTS > 4 RSTRG(Rs_font + 4, "font4", "fontname", 0), #endif #if MAX_NFONTS > 5 RSTRG(Rs_font + 5, "font5", "fontname", 0), #endif #if MAX_NFONTS > 6 RSTRG(Rs_font + 6, "font6", "fontname", 0), #endif #if MAX_NFONTS > 7 RSTRG(Rs_font + 7, "font7", "fontname", 0), #endif #ifdef MULTICHAR_SET STRG(Rs_mfont + 0, "mfont", "fm", "fontname", "multichar font", 0), # if MAX_NFONTS > 1 RSTRG(Rs_mfont + 1, "mfont1", "fontname", 0), # endif # if MAX_NFONTS > 2 RSTRG(Rs_mfont + 2, "mfont2", "fontname", 0), # endif # if MAX_NFONTS > 3 RSTRG(Rs_mfont + 3, "mfont3", "fontname", 0), # endif # if MAX_NFONTS > 4 RSTRG(Rs_mfont + 4, "mfont4", "fontname", 0), # endif # if MAX_NFONTS > 5 RSTRG(Rs_mfont + 5, "mfont5", "fontname", 0), # endif # if MAX_NFONTS > 6 RSTRG(Rs_mfont + 6, "mfont6", "fontname", 0), # endif # if MAX_NFONTS > 7 RSTRG(Rs_mfont + 7, "mfont7", "fontname", 0), # endif #endif /* MULTICHAR_SET */ #ifdef XFT_SUPPORT BOOL( "xft", "xft", Opt_xft, "use freetype font" ), STRG(Rs_xftfont, "xftFont", "xftfn", "fontname", "freetype font", 0), # ifdef MULTICHAR_SET STRG(Rs_xftmfont, "xftmFont", "xftfm", "fontname", "freetype multichar font", 0), STRG(Rs_xftmsz, "xftmSize", "xftmsz", "number", "freetype multichar font size", 0), BOOL( "xftNomFont", "xftnfm", Opt2_xftNomFont, "use freetype font as freetype mfont" ), BOOL( "xftSlowOutput", "xftslow", Opt2_xftSlowOutput, "multichar string display in slow mode for better visual effect" ), # endif BOOL( "xftAntialias", "xftaa", Opt2_xftAntialias, "antialias of freetype font" ), BOOL( "xftHinting", "xftht", Opt2_xftHinting, "hinting of freetype font" ), BOOL( "xftAutoHint", "xftah", Opt2_xftAutoHint, "autohint of freetype font" ), BOOL( "xftGlobalAdvance", "xftga", Opt2_xftGlobalAdvance, "global advance of freetype font" ), STRG(Rs_xftwt, "xftWeight", "xftwt", "style", "Xft font weight", 0), STRG(Rs_xftBwt, "xftBoldWeight", "xftbwt", "style", "Xft bold font weight", 0), STRG(Rs_xftst, "xftSlant", "xftst", "style", "slant style = roman|italic|oblique", 0), STRG(Rs_xftsz, "xftSize", "xftsz", "number", "freetype font size", 0), STRG(Rs_xftwd, "xftWidth", "xftwd", "style", "freetype font width = " "ultracondensed|condensed|normal|expanded|ultraexpended", 0), STRG(Rs_xftrgb, "xftRGBA", "xftrgb", "style", "freetype font sub-pixel order = rgb|bgr|vrgb|vbgr|none", 0), STRG(Rs_xftpfn, "xftPFont", "xftpfn", "fontname", "propotionally spaced freetype font to use for tabbar / menubar", 0), STRG(Rs_xftpsz, "xftPSize", "xftpsz", "size", "size of propotional freetype font", 0), #endif BOOL( "cmdAllTabs", "at", Opt2_cmdAllTabs, "running -e command for all tabs" ), BOOL( "protectSecondary", "ps", Opt2_protectSecondary, "protecting tab that uses the secondary screen from being closed" ), #ifdef MULTICHAR_SET STRG(Rs_multichar_encoding, "multichar_encoding", "km", "mode", "multichar encoding mode = eucj|sjis|big5|gb|gbk|kr|noenc", 0), #endif /* MULTICHAR_SET */ #ifdef USE_XIM STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method", 0), STRG(Rs_preeditType, "preeditType", "pt", "style", "input style = OverTheSpot|OffTheSpot|Root", 0), #endif /* USE_XIM */ #ifdef GREEK_SUPPORT STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode", "greek keyboard mapping mode = iso|ibm", 0), RSTRG(Rs_greektoggle_key, "greektoggle_key", "keysym", 0), #endif STRG(Rs_name, "clientName", "name", "string", "client instance, icon, and title strings", 0), STRG(Rs_title, NULL, "T", NULL, NULL, 0), /* short form */ STRG(Rs_iconName, "iconName", "in", "string", "icon name for window", 0), BOOL( "borderLess", "bl", Opt2_borderLess, "borderless window" ), BOOL( "overrideRedirect", "or", Opt2_overrideRedirect, "override_redirect flag" ), STRG(Rs_desktop, "desktop", "desktop", "number", "desktop to place the program", 0), BOOL( "broadcast", "bcst", Opt2_broadcast, "broadcast input to all terminals" ), #ifndef NO_FRILLS STRG(Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels", 0), STRG(Rs_ext_bwidth, NULL, "bw", NULL, NULL, 0), STRG(Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL, 0), STRG(Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels", 0), /* Reposition window on resize to stay on screen */ BOOL( "smartResize", NULL, Opt2_smartResize, NULL ), /* Resize window smooothly (not in character steps) */ BOOL( "smoothResize", NULL, Opt2_smoothResize, NULL ), #endif #ifndef NO_LINESPACE STRG(Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows", 0), #endif #ifdef POINTER_BLANK BOOL( "pointerBlank", "pb", Opt_pointerBlank, "blank pointer" ), RSTRG(Rs_pointerBlankDelay, "pointerBlankDelay", "number", 0), #endif #ifdef CURSOR_BLINK BOOL( "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor" ), STRG(Rs_cursorBlinkInterval, "cursorBlinkInterval", "bci", "number", "cursor blinking interval (ms)", 0), #endif #ifndef NO_BACKSPACE_KEY RSTRG(Rs_backspace_key, "backspaceKey", "string", 0), #endif #ifndef NO_DELETE_KEY RSTRG(Rs_delete_key, "deleteKey", "string", 0), #endif RSTRG(Rs_selectstyle, "selectStyle", "select style mode = old|oldword", 0), #ifdef PRINTPIPE RSTRG(Rs_print_pipe, "printPipe", "string", 0), #endif BOOL( "noSysConfig", "nsc", Opt2_noSysConfig, "reading /etc/mrxvt/mrxvtrc." ), BOOL( "disableMacros", "dm", Opt2_disableMacros, "all keyboard shortcuts (macros)" ), BOOL( "linuxHomeEndKey", "lk", Opt2_linuxHomeEndKey, "enable Linux console Home/End keys" ), STRG(Rs_modifier, "modifier", "mod", "modifier", "meta modifier = alt|meta|hyper|super|mod1|...|mod5", 0), INFO("xrm", "string", "X resource"), #ifdef CUTCHAR_RESOURCE RSTRG(Rs_cutchars, "cutChars", "string", 0), #endif /* CUTCHAR_RESOURCE */ #ifdef ACS_ASCII RSTRG(Rs_acs_chars, "acsChars", "string", 0), #endif /* ACS_ASCII */ RSTRG(Rs_answerbackstring, "answerbackString", "string", 0), #ifdef HAVE_X11_SM_SMLIB_H BOOL( "sessionMgt", "sm", Opt2_enableSessionMgt, "enabling X session management" ), STRG(Rs_smClientID, "smClientID", "sid", "string", "client id of mrxvt for X session management", 0), #endif /* HAVE_X11_SM_SMLIB_H */ /* Initial number of terminals */ STRG( Rs_init_term_num, "initTermNumber", "tnum", "number", "Initial number of tabs/terminals", 0), STRG( Rs_initProfiles, "initProfileList", "ip", "profile list", "List of profiles to load on startup", 0 ), STRG(Rs_debug_masks, "dbgMasks", "dmask", "string", "List of debug masks separated by coma", 0), STRG(Rs_debug_level, "dbgLevel", "dlevel", "string", "Name of number of the debug level", 0), #ifdef USE_FIFO BOOL( "useFifo", NULL, Opt_useFifo, NULL ), #endif/*USE_FIFO*/ INFO("e", "command arg ...", "command to execute") }; /* Previously set options */ static uint32_t pSetOpts[ MAX_OPTION_ARRAY ] = { 0u, 0u, 0u, 0u }; #undef INFO #undef STRG #undef RSTRG #undef SWCH #undef BOOL /*}}} */ static const char releasestring[] = "Mrxvt v" VERSION "\n"; static const char optionsstring[] = "Options: " #if defined(BACKGROUND_IMAGE) # ifdef HAVE_LIBXPM "XPM," # endif # ifdef USE_JPEG "Jpeg," # endif # ifdef USE_JPEG "PNG," # endif #endif #if defined(TRANSPARENT) "transparent," #endif "fade," #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) # if defined(TINTING_SUPPORT) "tint," # endif #endif #if defined(TEXT_SHADOW) "textshadow," #endif #if defined(UTMP_SUPPORT) "utmp," #endif #if defined(HAVE_MENUBAR) "menubar," #endif #if defined(USE_XIM) "XIM," #endif #if defined(MULTICHAR_SET) "multichar_languages," #endif "scrollbars=" #if !defined(HAVE_SCROLLBARS) "NONE" #else # if defined(RXVT_SCROLLBAR) "rxvt" # if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) || defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR) "+" # endif # endif /* RXVT_SCROLLBAR */ # if defined(NEXT_SCROLLBAR) "NeXT" # if defined(XTERM_SCROLLBAR) || defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR) "+" # endif # endif /* NEXT_SCROLLBAR */ # if defined(XTERM_SCROLLBAR) "xterm" # if defined(SGI_SCROLLBAR) || defined(PLAIN_SCROLLBAR) "+" # endif # endif /* XTERM_SCROLLBAR */ # if defined(SGI_SCROLLBAR) "sgi" # if defined(PLAIN_SCROLLBAR) "+" # endif # endif /* SGI_SCROLLBAR */ # if defined(PLAIN_SCROLLBAR) "plain" # endif /* PLAIN_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ "," #ifdef XFT_SUPPORT "xft," #endif #if defined(GREEK_SUPPORT) "Greek," #endif #if defined(NO_BACKSPACE_KEY) "no_backspace," #endif #if defined(NO_DELETE_KEY) "no_delete," #endif #ifdef OUR_STRINGS "strings," #endif #ifdef OUR_MALLOC "fast memory," #endif #if !defined(NO_FRILLS) "frills," #endif #if !defined(NO_LINESPACE) "linespace," #endif #if defined(PREFER_24BIT) "24bit," #endif #if defined(SELECTION_SCROLLING) "selectionscrolling," #endif #if defined(TTY_256COLOR) "256colour," #endif #if defined(CURSOR_BLINK) "cursorBlink," #endif #if defined(POINTER_BLANK) "pointerBlank," #endif #ifdef HAVE_X11_SM_SMLIB_H "session management," #endif #if defined(NO_RESOURCES) "NoResources" #else "Resources" #endif "\nUsage: "; /* Usage */ #define INDENT 24 /* * Print usage and exit. */ /* EXTPROTO */ void rxvt_usage(int type) { unsigned int i, col; write(STDOUT_FILENO, releasestring, sizeof(releasestring) - 1); write(STDOUT_FILENO, optionsstring, sizeof(optionsstring) - 1); write(STDOUT_FILENO, APL_NAME, sizeof(APL_NAME) - 1); switch (type) { case 0: /* brief listing */ fprintf(stdout, " [-help] [--help]\n"); for (col = 1, i = 0; i < optList_size(); i++) if (NOT_NULL(optList[i].desc)) { int len = 0; if (!optList_isBool(i)) { len = optList_STRLEN(i); if (len > 0) len++; /* account for space */ } assert(NOT_NULL(optList[i].opt)); len += 4 + STRLEN(optList[i].opt) + (optList_isBool(i) ? 2: 0); col += len; if (col > 79) /* assume regular width */ { putc('\n', stdout); col = 1 + len; } fprintf(stdout, " [-%s%s", (optList_isBool(i) ? "/+" : ""), optList[i].opt); if (optList_STRLEN(i)) fprintf(stdout, " %s]", optList[i].arg); else fprintf(stdout, "]"); } break; case 1: /* full command-line listing */ fprintf(stdout, " [options] [-e command args]\n\n" "where options include:\n"); for (i = 0; i < optList_size(); i++) if (NOT_NULL(optList[i].desc)) { assert(NOT_NULL(optList[i].opt)); fprintf(stdout, " %s%s %-*s%s%s\n", (optList_isBool(i) ? "-/+" : "-"), optList[i].opt, (INDENT - STRLEN(optList[i].opt) + (optList_isBool(i) ? 0 : 2)), (optList[i].arg ? optList[i].arg : ""), (optList_isBool(i) ? "turn on/off " : ""), optList[i].desc); } fprintf(stdout, "\n --help to list long-options"); break; case 2: /* full resource listing */ fprintf(stdout, " [options] [-e command args]\n\n" "where resources (long-options) include:\n"); #ifdef DEBUG /* * Print short options, long options and descriptions so we can * generate man page. */ for (i = 0; i < optList_size(); i++) fprintf( stdout, "%3d. %s %s %s %s %d\n", i, optList[i].kw ? optList[i].kw : "NullKW", optList[i].opt ? optList[i].opt : "NullOpt", !optList_isBool(i) ? optList[i].arg : "boolean", optList[i].desc ? optList[i].desc : "NullDsc", optList[i].multiple); #else for (i = 0; i < optList_size(); i++) if (NOT_NULL(optList[i].kw)) fprintf(stdout, " %s: %*s%s\n", optList[i].kw, (INDENT - STRLEN(optList[i].kw)), "", /* XXX */ (optList_isBool(i) ? "boolean" : optList[i].arg)); #endif fprintf(stdout, "\n -help to list options"); break; } /* switch */ fprintf(stdout, "\n\n"); exit(EXIT_FAILURE); /* NOTREACHED */ } /* INTPROTO */ int num_tabs( int len ) { return (len >=0 && len < 40) ? (40 - (len - (len%8)) ) / 8 : 0; } /* EXTPROTO */ int rxvt_save_options (rxvt_t* r, const char* filename) { int i; FILE* pf = fopen (filename, "w"); const char *name = r->h->rs[Rs_name] ? r->h->rs[Rs_name] : APL_NAME; char *tabs="\t\t\t\t\t"; if (IS_NULL(pf)) return 0; for (i = 0; i < optList_size(); i ++) { if( IS_NULL( optList[i].kw ) || /* Options without a keyword can't be written */ ( optList[i].doff == -1 && !optList_isBool(i) ) /* Boolean options don't require * a data offset. */ ) continue; if( optList[i].multiple) { register int j; for (j = 0; j < MAX_PROFILES; j ++) { if (r->h->rs[optList[i].doff + j]) fprintf( pf, "%s.profile%d.%s:%.*s%s\n", name, j, optList[i].kw, num_tabs( STRLEN(name) + sizeof(".profile") + 2 + STRLEN( optList[i].kw ) ), tabs, r->h->rs[optList[i].doff +j]); } } else if (optList_isBool(i)) { int bval; char* OnOff[2] = {"False", "True"}; bval = ISSET_OPTION(r, optList[i].flag) ? 1 : 0; if (optList_isReverse(i)) bval = !bval; fprintf( pf, "%s.%s:%.*s%s\n", name, optList[i].kw, num_tabs( STRLEN(name) + 1 + STRLEN(optList[i].kw) + 1 ), tabs, OnOff[bval] ); } else if (r->h->rs[optList[i].doff]) { fprintf( pf, "%s.%s:%.*s%s\n", name, optList[i].kw, num_tabs( STRLEN(name) + 1 + STRLEN(optList[i].kw) + 1 ), tabs, r->h->rs[optList[i].doff] ); } } fputs( "\n\n# vim: set ft=mrxvtrc :\n", pf ); fclose (pf); return 1; } /* * Process command line options. */ /* EXTPROTO */ void rxvt_get_options(rxvt_t *r, int argc, const char *const *argv) { int i, bad_option = 0; static const char On[3] = "ON", Off[4] = "OFF"; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "rxvt_get_options()\n")); for (i = 1; i < argc; i++) { unsigned int entry, longopt = 0; const char *flag, *opt; int profileNum; opt = argv[i]; profileNum = 0; /* initialize profileNum to 0 by default */ rxvt_msg (DBG_INFO, DBG_RESOURCE, "argv[%d] = %s: \n", i, opt); if (*opt == '-') { flag = On; if (*++opt == '-') longopt = *opt++; /* long option */ } else if (*opt == '+') { flag = Off; if (*++opt == '+') longopt = *opt++; /* long option */ } else { bad_option = 1; rxvt_msg (DBG_ERROR, DBG_RESOURCE, "bad option \"%s\"\n", opt); continue; } if (!STRCMP(opt, "help")) rxvt_usage(longopt ? 2 : 1); if (!STRCMP(opt, "h")) rxvt_usage(0); /* feature: always try to match long-options */ for (entry = 0; entry < optList_size(); entry++) { char buflong[256]; char bufshort[128]; /* initialize it to empty string */ buflong[0] = '\0'; bufshort[0] = '\0'; /* * Get the long option name in buflong, or the short option name in * bufshort. */ if ( optList[entry].multiple ) { int offset = 0; /* * For backward compatibility, accept vt%d style options. */ offset = rxvt_str_match( opt, "vt" ); if( offset == 0 ) offset = rxvt_str_match( opt, "profile" ); /* * Copy --profile%d.resource or --vt%d.resource into buflong and * bufshort. */ if( offset ) { profileNum = atoi( opt + offset ); if( profileNum < 0 || profileNum >= MAX_PROFILES ) { entry = optList_size(); break; /* out of range, jump to bad option */ } snprintf( buflong, sizeof(buflong)-1, "%.*s%d.%s", offset, opt, profileNum, optList[entry].kw ); buflong[sizeof(buflong)-1] = '\0'; snprintf( bufshort, sizeof(bufshort)-1, "%.*s%d.%s", offset, opt, profileNum, optList[entry].opt ); bufshort[sizeof(bufshort)-1] = '\0'; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "Matched profile=%d buflong=%s bufshort=%s\n", profileNum, buflong, bufshort )); } /* If no profile number is specified, use 0 by default */ else { STRNCPY( buflong, optList[entry].kw, sizeof(buflong) - 1 ); buflong[ sizeof(buflong)-1 ] = '\0'; STRNCPY( bufshort, optList[entry].opt, sizeof(bufshort)-1 ); bufshort[ sizeof(bufshort)-1 ] = '\0'; profileNum = 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "Matched default buflong=%s bufshort=%s\n", buflong, bufshort )); } } else if (optList[entry].kw) { STRNCPY (buflong, optList[entry].kw, sizeof(buflong)-1); buflong[sizeof(buflong)-1] = '\0'; if (optList[entry].opt) { STRNCPY (bufshort, optList[entry].opt, sizeof(bufshort)-1); bufshort[sizeof(bufshort)-1] = '\0'; } } else if (optList[entry].opt) { /* here NULL == optList[entry].kw */ STRNCPY (bufshort, optList[entry].opt, sizeof(bufshort)-1); bufshort[sizeof(bufshort)-1] = '\0'; } /* Check to see if option matches */ if( ( optList[entry].kw && !STRCMP(opt, buflong) ) || ( !longopt && optList[entry].opt && !STRCASECMP(opt, bufshort) ) ) break; } /* for */ /* Found option */ if (entry < optList_size()) { if (optList_isReverse(entry)) flag = (flag == On) ? Off : On; /* string value */ if( optList_STRLEN(entry) ) { const char *str = argv[++i]; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "string (%s,%s) = ", optList[entry].opt ? optList[entry].opt : "nil", optList[entry].kw ? optList[entry].kw : "nil")); if (flag == On && str && (optList[entry].doff != -1)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "\"%s\"\n", str)); r->h->rs[optList[entry].doff + profileNum] = str; /* * special cases are handled in main.c:main() to allow X * resources to set these values before we settle for * default values */ } else rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "???\n")); } /* boolean value */ else { rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "boolean (%s,%s) = %s\n", optList[entry].opt, optList[entry].kw, flag )); if( flag == On ) SET_OPTION( r, optList[entry].flag ); else UNSET_OPTION( r, optList[entry].flag ); /* * Remember that we've set this option, so it does not get reset * later. */ SET_ARRAYOPT( pSetOpts, optList[entry].flag ); } } /* No option found */ else { if ( rxvt_str_match( opt, "macro.")) { const char *str = argv[++i]; if (NOT_NULL(str)) rxvt_parse_macros( r, opt + sizeof( "macro." ) - 1, str, 0); /* priority 0 = highest. All previous macros get replaced. */ } else { /* * various old-style options, just ignore * Obsolete since about Jan 96, * so they can probably eventually be removed */ const char *msg = "bad"; if (longopt) { opt--; bad_option = 1; } else if (!STRCMP(opt, "7") || !STRCMP(opt, "8") #ifdef GREEK_SUPPORT /* obsolete 12 May 1996 (v2.17) */ || rxvt_str_match(opt, "grk") #endif ) msg = "obsolete"; else bad_option = 1; rxvt_msg (DBG_ERROR, DBG_RESOURCE, "%s option \"%s\"", msg, --opt); } } } if (bad_option) { /* Printing the usage is too verbose ... */ #if 0 rxvt_usage(0); #endif rxvt_msg (DBG_ERROR, DBG_RESOURCE, "Use -h, -help or --help to get help\n" ); exit( EXIT_FAILURE ); } rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "rxvt_get_options() done.\n")); } #ifndef NO_RESOURCES /* * Read resources from a file. "name" is the class name to use. */ /* INTPROTO */ void rxvt_get_xdefaults(rxvt_t *r, FILE *stream, const char *name, macro_priority_t priority) { unsigned int len, lenstr; char TAINTED * str; char buffer[256]; rxvt_msg (DBG_INFO, DBG_RESOURCE, "rxvt_get_xdefaults (%s)\n", name); if (IS_NULL(stream)) return; len = STRLEN(name); while (NOT_NULL(str = fgets(buffer, sizeof(buffer), stream))) { unsigned int entry, n; while (*str && isspace((int) *str)) str++; /* leading whitespace */ if( (str[len] != '*' && str[len] != '.') || (len && STRNCMP(str, name, len)) ) continue; str += (len + 1); /* skip `name*' or `name.' */ lenstr = STRLEN( str ); { /* * replace '*' with '.', but stop at ':'! bug reported by * afo@zlug.org */ char* ptr = str; while (*ptr && *ptr != ':') { if ('*' == *ptr) *ptr = '.'; ptr ++; } } if( !rxvt_parse_macros( r, str, NULL, priority ) ) { for (entry = 0; entry < optList_size(); entry++) { /* const char* kw = optList[entry].kw; */ char kw[256]; int profileNum = 0; /* default is no offset */ if (IS_NULL(optList[entry].kw)) continue; STRNCPY (kw, optList[entry].kw, sizeof(kw)-1); kw[sizeof(kw)-1] = (char) 0; if( optList[entry].multiple ) { int offset = 0; /* * For backward compatibility, accept vt%d style options. */ offset = rxvt_str_match( str, "vt" ); if( offset == 0 ) offset = rxvt_str_match( str, "profile" ); /* * Copy profile%d.resource into kw. */ if( offset ) { char buf[256]; profileNum = atoi( str + offset ); if (profileNum < 0 || profileNum >= MAX_PROFILES) continue; /* out of range */ snprintf( buf, sizeof(buf)-1, "%.*s%d.%s", offset, str, profileNum, kw ); buf[sizeof(buf)-1] = '\0'; STRNCPY (kw, buf, sizeof(kw)-1); kw[sizeof(kw)-1] = '\0'; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "Matched profile=%d kw=%s\n", profileNum, kw)); } /* * No profile%d specified. Match resource on it's own, and * use profile 0. */ else { profileNum = 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "Matched default kw=%s for option %s", kw, str)); } } n = STRLEN(kw); if( n < lenstr && str[n] == ':' && rxvt_str_match(str, kw) ) { /* skip `keyword:' */ str += (n + 1); rxvt_str_trim(str); n = STRLEN(str); /* * Only set the resource if it's not already set. We read * config file items in reverse order (most significant to * least significant). So if a resource is already set, then * we should not over ride it. */ if( optList_isBool( entry ) ) { /* * Boolean options: We dont' need to duplicate the * argument of the resource string. That only wastes * memory. */ if( NOTSET_ARRAYOPT( pSetOpts, optList[entry].flag ) ) { /* * Only set this option if we've not already set it. */ int s; s = STRCASECMP(str, "true") == 0 || STRCASECMP(str, "yes") == 0 || STRCASECMP(str, "on") == 0 || STRCASECMP(str, "1") == 0; if (optList_isReverse(entry)) s = !s; if (s) SET_OPTION(r, optList[entry].flag); else UNSET_OPTION(r, optList[entry].flag); /* Remember we've already set this option */ SET_ARRAYOPT( pSetOpts, optList[entry].flag ); } } else if( IS_NULL( r->h->rs[ optList[entry].doff + profileNum ] ) ) { /* * Regular option, that has not previously been set. * The argument needs to be duplicated and stored. */ r->h->rs[optList[entry].doff+profileNum] = n && !optList_isBool(entry) ? STRDUP( str ) : emptyResource; } break; /* out of for( entry=0 ... ) */ } /* if( str[n] =':' ...) */ } /* for (entry = 0...) */ } /* if( !rxvt_parse_macros ... ) */ } /* while() */ rewind( stream ); } #endif /* NO_RESOURCES */ /* * Open resource files and call rxvt_get_xdefaults() for each one in turn. */ /* ARGSUSED */ /* EXTPROTO */ void rxvt_extract_resources ( rxvt_t *r, Display *display __attribute__((unused)), const char *name ) { #ifndef NO_RESOURCES /* get resources the hard way, but save lots of memory */ FILE *fd = NULL; char *home; macro_priority_t priority = 1; /* As resources get more general, we increment this value so that resources with lower priority are not overwritten */ # if defined XAPPLOADDIR # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) /* Compute the path of the possibly available localized Rxvt file */ char *localepath = NULL; if (NOT_NULL(r->h->locale)) { /* XXX: must limit length of string */ localepath = rxvt_malloc(256); sprintf( localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, (int) ( 258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)), r->h->locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ } # endif # endif /* XAPPLOADDIR */ /* open user supplied config file first */ if (NOT_NULL(r->h->rs[Rs_confFile])) fd = fopen( r->h->rs[Rs_confFile], "r" ); if (IS_NULL(fd) && NOT_NULL(home = getenv("HOME"))) { int i, len = STRLEN(home) + 2; char* f = NULL; /* possible integer overflow? */ assert (len > 0); for( i = 0; i < (sizeof(xnames) / sizeof(xnames[0])); i++ ) { /* possible integer overflow? */ assert (len + STRLEN(xnames[i]) >= len); f = rxvt_realloc( f, ( len + STRLEN(xnames[i]) ) * sizeof(char) ); sprintf( f, "%s/%s", home, xnames[i] ); if (NOT_NULL(fd = fopen(f, "r"))) break; } rxvt_free(f); } /* * The normal order to match resources is the following: * * @ global resources (partial match, ~/.Xdefaults) * @ application file resources (XAPPLOADDIR/Rxvt) * @ class resources (~/.Xdefaults) * @ private resources (~/.Xdefaults) * * However, for the hand-rolled resources, the matching algorithm checks if * a resource string value has already been allocated and won't overwrite it * with (in this case) a less specific resource value. * * This avoids multiple allocation. Also, when we've called this routine * command-line string options have already been applied so we needn't to * allocate for those resources. * * So, search in resources from most to least specific. * * Also, use a special sub-class so that we can use either or both of * "XTerm" and "Rxvt" as class names. */ rxvt_get_xdefaults(r, fd, name, priority++); rxvt_get_xdefaults(r, fd, APL_SUBCLASS, priority++); rxvt_get_xdefaults(r, fd, APL_CLASS, priority++); #if 0 rxvt_get_xdefaults(r, fd, "", priority++); /* partial match */ #endif if (NOT_NULL(fd)) fclose(fd); # if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) { FILE* ad = NULL; # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) if (IS_NULL(localepath) || IS_NULL(ad = fopen(localepath, "r"))) # endif ad = fopen(XAPPLOADDIR "/" APL_SUBCLASS, "r"); if (NOT_NULL(ad)) { rxvt_get_xdefaults(r, ad, APL_SUBCLASS, priority++); #if 0 /* * 2006-05-23 gi1242: If we don't use the X resource database, we * don't have to match the empty class. */ rxvt_get_xdefaults(r, ad, "", priority++); #endif fclose(ad); } } # endif /* XAPPLOADDIR */ /* * Now read config from system wide config file. */ if (NOTSET_OPTION(r, Opt2_noSysConfig) && NOT_NULL(fd = fopen( PKG_CONF_DIR "/mrxvtrc", "r"))) { rxvt_get_xdefaults( r, fd, APL_SUBCLASS, priority++ ); fclose(fd); } /* * Unset resources that point to emptyResource * * 2006-06-02 gi1242: On second thought, let's leave them pointing to * emptyResource. That way we will be able to tell which resources have been * cleared by the user, and which were never set in the first place. */ #if 0 { int i; for( i=0; i < NUM_RESOURCES; i++) { if( r->h->rs[i] == emptyResource ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_RESOURCE, "Setting resource #%d to NULL\n", i)); r->h->rs[i] = NULL; } } } #endif # if defined XAPPLOADDIR # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) /* Free the path of the possibly available localized Rxvt file */ rxvt_free(localepath); # endif # endif #endif /* NO_RESOURCES */ /* * Clear the boolean and reverse flags from Options and Options2. Otherwise * this will cause trouble when we want to save the options. In that case, * the boolean flag is set for each boolean options. Then if we compare * Options(2) to the flag, we always get TRUE! */ UNSET_OPTION(r, ( Opt_Reverse | IS_OPTION1 ) ); UNSET_OPTION(r, ( Opt_Reverse | IS_OPTION2 ) ); UNSET_OPTION(r, ( Opt_Reverse | IS_OPTION3 ) ); UNSET_OPTION(r, ( Opt_Reverse | IS_OPTION4 ) ); /* * even without resources, at least do this setup for command-line options * and command-line long options */ #ifdef MULTICHAR_SET if (r->h->rs[Rs_multichar_encoding]) rxvt_set_multichar_encoding(r, r->h->rs[Rs_multichar_encoding]); else { char* enc; if (NOT_NULL(enc = rxvt_get_encoding_from_locale (r))) rxvt_set_multichar_encoding (r, enc); else rxvt_set_multichar_encoding(r, MULTICHAR_ENCODING); } #endif #ifdef GREEK_SUPPORT /* this could be a function in grkelot.c */ /* void set_greek_keyboard (const char * str); */ if (r->h->rs[Rs_greek_keyboard]) { if (!STRCMP(r->h->rs[Rs_greek_keyboard], "iso")) greek_setmode(GREEK_ELOT928); /* former -grk9 */ else if (!STRCMP(r->h->rs[Rs_greek_keyboard], "ibm")) greek_setmode(GREEK_IBM437); /* former -grk4 */ } { KeySym sym; if (r->h->rs[Rs_greektoggle_key] && ((sym = XStringToKeysym(r->h->rs[Rs_greektoggle_key]))!=0)) r->h->ks_greekmodeswith = sym; } #endif /* GREEK_SUPPORT */ } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/scrollbar-rxvt.c0000644000175000001440000001674710756127602013561 00000000000000/*--------------------------------*-C-*---------------------------------* * File: scrollbar-rxvt.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ #ifdef HAVE_SCROLLBARS #ifdef RXVT_SCROLLBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL)) /* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ /* INTPROTO */ void rxvt_draw_button(rxvt_t *r, int x, int y, int state, int dirn) { unsigned int sz, sz2; XPoint pt[3]; unsigned long top, bot; sz = r->scrollBar.width; sz2 = sz / 2; switch (state) { case +1: top = r->scrollBar.rxvt_topshadow; bot = r->scrollBar.rxvt_botshadow; break; case -1: top = r->scrollBar.rxvt_botshadow; bot = r->scrollBar.rxvt_topshadow; break; default: top = bot = r->scrollBar.rxvt_fg; break; } /* fill triangle */ pt[0].x = x; pt[1].x = x + sz - 1; pt[2].x = x + sz2; if (dirn == UP) { pt[0].y = pt[1].y = y + sz - 1; pt[2].y = y; } else { pt[0].y = pt[1].y = y; pt[2].y = y + sz - 1; } CHOOSE_GC_FG (r, r->scrollBar.rxvt_fg); XFillPolygon(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt, 3, Convex, CoordModeOrigin); /* draw base */ CHOOSE_GC_FG (r, (dirn == UP) ? bot : top); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); /* draw shadow on left */ pt[1].x = x + sz2 - 1; pt[1].y = y + (dirn == UP ? 0 : sz - 1); CHOOSE_GC_FG (r, top); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #if (SHADOW > 1) /* doubled */ pt[0].x++; if (dirn == UP) { pt[0].y--; pt[1].y++; } else { pt[0].y++; pt[1].y--; } CHOOSE_GC_FG (r, top); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #endif /* draw shadow on right */ pt[1].x = x + sz - 1; /* pt[2].x = x + sz2; */ pt[1].y = y + (dirn == UP ? sz - 1 : 0); pt[2].y = y + (dirn == UP ? 0 : sz - 1); CHOOSE_GC_FG (r, bot); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #if (SHADOW > 1) /* doubled */ pt[1].x--; if (dirn == UP) { pt[2].y++; pt[1].y--; } else { pt[2].y--; pt[1].y++; } CHOOSE_GC_FG (r, bot); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #endif } /* EXTPROTO */ void rxvt_scrollbar_init_rxvt (rxvt_t* r) { XGCValues gcvalue; unsigned long gcmask; /* Initialize the colors */ r->scrollBar.rxvt_fg = r->pixColorsFocus[Color_trough]; r->scrollBar.rxvt_bg = r->pixColorsFocus[Color_bottomShadow]; r->scrollBar.rxvt_topshadow = r->pixColorsFocus[Color_topShadow]; r->scrollBar.rxvt_botshadow = r->pixColorsFocus[Color_bottomShadow]; gcvalue.foreground = r->scrollBar.rxvt_fg; # ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) # endif # ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) # endif gcvalue.background = r->scrollBar.rxvt_bg; gcmask = GCForeground; # ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) # endif # ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) # endif gcmask |= GCBackground; r->scrollBar.gc = XCreateGC (r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(r->scrollBar.gc)); # ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) # endif # ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) # endif XSetWindowBackground (r->Xdisplay, r->scrollBar.win, r->scrollBar.rxvt_bg); } /* EXTPROTO */ void rxvt_scrollbar_exit_rxvt (rxvt_t* r) { /* No resources to free */ } /* EXTPROTO */ int rxvt_scrollbar_show_rxvt(rxvt_t *r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len) { int sbshadow = r->sb_shadow; int sbwidth = (int)r->scrollBar.width; if (last_top < r->scrollBar.top) XClearArea(r->Xdisplay, r->scrollBar.win, sbshadow, last_top, sbwidth, (r->scrollBar.top - last_top), False); if (r->scrollBar.bot < last_bot) XClearArea(r->Xdisplay, r->scrollBar.win, sbshadow, r->scrollBar.bot, sbwidth, (last_bot - r->scrollBar.bot), False); /* scrollbar slider */ #ifdef TRANSPARENT /* clear background when there's transparent */ if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) ) { XClearArea (r->Xdisplay, r->scrollBar.win, sbshadow, r->scrollBar.top, sbwidth, scroller_len, False); } else #endif # ifdef BACKGROUND_IMAGE /* clear background when there's bg image */ if (IS_PIXMAP(r->scrollBar.pixmap)) { XClearArea (r->Xdisplay, r->scrollBar.win, sbshadow, r->scrollBar.top, sbwidth, scroller_len, False); } else # endif { CHOOSE_GC_FG (r, r->scrollBar.rxvt_fg); XFillRectangle (r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, sbshadow, r->scrollBar.top, sbwidth, scroller_len); } if (sbshadow) /* trough shadow */ rxvt_draw_shadow(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, r->scrollBar.rxvt_botshadow, r->scrollBar.rxvt_topshadow, 0, 0, sbwidth + 2 * sbshadow, /* scrollbar_TotalWidth() */ r->scrollBar.end + (sbwidth + 1) + sbshadow); /* shadow for scrollbar slider */ rxvt_draw_shadow(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, r->scrollBar.rxvt_topshadow, r->scrollBar.rxvt_botshadow, sbshadow, r->scrollBar.top, sbwidth, scroller_len); /* Redraw scrollbar arrows */ rxvt_draw_button(r, sbshadow, sbshadow, (scrollbar_isUp() ? -1 : +1), UP); rxvt_draw_button(r, sbshadow, (r->scrollBar.end + 1), (scrollbar_isDn() ? -1 : +1), DN); return 1; } #endif /* RXVT_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/ptytty.c0000644000175000001440000002041610756127602012136 00000000000000/*--------------------------------*-C-*---------------------------------* * File: ptytty.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /* ------------------------------------------------------------------------- * * GET PSEUDO TELETYPE - MASTER AND SLAVE * * ------------------------------------------------------------------------- */ /* * Returns pty file descriptor, or -1 on failure * If successful, ttydev is set to the name of the slave device. * fd_tty _may_ also be set to an open fd to the slave device */ /* EXTPROTO */ int rxvt_get_pty(int *fd_tty, char **ttydev) { int pfd; *ttydev = NULL; #ifdef PTYS_ARE_OPENPTY { char tty_name[sizeof "/dev/pts/????\0"]; if (openpty(&pfd, fd_tty, tty_name, NULL, NULL) != -1) { *ttydev = STRDUP(tty_name); return pfd; } } #endif #ifdef PTYS_ARE__GETPTY { char* ptr = _getpty(&pfd, O_RDWR|O_NDELAY|O_NOCTTY, 0622, 0); if (ptr) *ttydev = STRDUP(ptr); if (ptr) return pfd; } #endif #ifdef PTYS_ARE_GETPTY { char* ptydev; while ((ptydev = getpty()) != NULL) if ((pfd = open(ptydev, O_RDWR | O_NOCTTY, 0)) >= 0) { *ttydev = STRDUP(ptydev); return pfd; } } #endif #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) # if defined(PTYS_ARE_GETPT) || defined(PTYS_ARE_PTMX) { extern char *ptsname(); # ifdef PTYS_ARE_GETPT extern int getpt (); pfd = getpt(); # else pfd = open("/dev/ptmx", O_RDWR | O_NOCTTY, 0); # endif if (pfd >= 0) { extern int grantpt (int); extern int unlockpt (int); if (grantpt(pfd) == 0 && /* change slave permissions */ unlockpt(pfd) == 0) { /* slave now unlocked */ char* ptr = ptsname(pfd); /* get slave's name */ if (ptr) *ttydev = STRDUP(ptr); return pfd; } close(pfd); } } # endif #endif #ifdef PTYS_ARE_PTC if ((pfd = open("/dev/ptc", O_RDWR | O_NOCTTY, 0)) >= 0) { char* ptr = ttyname(pfd); if (ptr) *ttydev = STRDUP(ptr); return pfd; } #endif #ifdef PTYS_ARE_CLONE if ((pfd = open("/dev/ptym/clone", O_RDWR | O_NOCTTY, 0)) >= 0) { char* ptr = ptsname(pfd); if (ptr) *ttydev = STRDUP(ptr); return pfd; } #endif #ifdef PTYS_ARE_NUMERIC { int idx; char* c1; char* c2; char pty_name[] = "/dev/ptyp???"; char tty_name[] = "/dev/ttyp???"; c1 = &(pty_name[sizeof(pty_name) - 4]); c2 = &(tty_name[sizeof(tty_name) - 4]); for (idx = 0; idx < 256; idx++) { sprintf(c1, "%d", idx); sprintf(c2, "%d", idx); if (access(tty_name, F_OK) < 0) { idx = 256; break; } if ((pfd = open(pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) { if (access(tty_name, R_OK | W_OK) == 0) { *ttydev = STRDUP(tty_name); return pfd; } close(pfd); } } } #endif #ifdef PTYS_ARE_SEARCHED { const char* c1; const char* c2; char pty_name[] = "/dev/pty??"; char tty_name[] = "/dev/tty??"; # ifndef PTYCHAR1 # define PTYCHAR1 "pqrstuvwxyz" # endif # ifndef PTYCHAR2 # define PTYCHAR2 "0123456789abcdef" # endif for (c1 = PTYCHAR1; *c1; c1++) { pty_name[(sizeof(pty_name) - 3)] = tty_name[(sizeof(pty_name) - 3)] = *c1; for (c2 = PTYCHAR2; *c2; c2++) { pty_name[(sizeof(pty_name) - 2)] = tty_name[(sizeof(pty_name) - 2)] = *c2; if ((pfd = open(pty_name, O_RDWR | O_NOCTTY, 0)) >= 0) { if (access(tty_name, R_OK | W_OK) == 0) { *ttydev = STRDUP(tty_name); return pfd; } close(pfd); } } } } #endif return -1; } /*----------------------------------------------------------------------*/ /* * Returns tty file descriptor, or -1 on failure */ /* EXTPROTO */ int rxvt_get_tty(const char *ttydev) { return open(ttydev, O_RDWR | O_NOCTTY, 0); } /*----------------------------------------------------------------------*/ /* * Make our tty a controlling tty so that /dev/tty points to us */ /* EXTPROTO */ int rxvt_control_tty(int fd_tty, const char *ttydev) { #ifndef __QNX__ int fd; rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): pid: %d, tty fd: %d, dev: %s\n", (int) getpid(), fd_tty, ttydev)); /* ---------------------------------------- */ # ifdef HAVE_SETSID setsid(); # endif # if defined(HAVE_SETPGID) setpgid(0, 0); # elif defined(HAVE_SETPGRP) setpgrp(0, 0); # endif /* ---------------------------------------- */ # ifdef TIOCNOTTY fd = open("/dev/tty", O_RDWR | O_NOCTTY); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): Voiding tty associations: previous=%s\n", fd < 0 ? "no" : "yes")); if (fd >= 0) { ioctl(fd, TIOCNOTTY, NULL); /* void tty associations */ close(fd); } # endif /* ---------------------------------------- */ fd = open("/dev/tty", O_RDWR | O_NOCTTY); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): /dev/tty has controlling tty? %s\n", fd < 0 ? "no (good)" : "yes (bad)")); if (fd >= 0) close(fd); /* ouch: still have controlling tty */ /* ---------------------------------------- */ #if defined(PTYS_ARE_PTMX) && defined(I_PUSH) /* * Push STREAMS modules: * ptem: pseudo-terminal hardware emulation module. * ldterm: standard terminal line discipline. * ttcompat: V7, 4BSD and XENIX STREAMS compatibility module. * * After we push the STREAMS modules, the first open() on the slave side * (i.e. the next section between the dashes giving us "tty opened OK") * should make the "ptem" (or "ldterm" depending upon either which OS * version or which set of manual pages you have) module give us a * controlling terminal. We must already have close()d the master side * fd in this child process before we push STREAMS modules on because the * documentation is really unclear about whether it is any close() on * the master side or the last close() - i.e. a proper STREAMS dismantling * close() - on the master side which causes a hang up to be sent * through - Geoff Wing */ # ifdef HAVE_ISASTREAM if (isastream(fd_tty) == 1) # endif { rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): Pushing STREAMS modules\n")); ioctl(fd_tty, I_PUSH, "ptem"); ioctl(fd_tty, I_PUSH, "ldterm"); ioctl(fd_tty, I_PUSH, "ttcompat"); } #endif /* ---------------------------------------- */ # if defined(TIOCSCTTY) fd = ioctl(fd_tty, TIOCSCTTY, NULL); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): ioctl(..,TIOCSCTTY): %d\n", fd)); # elif defined(TIOCSETCTTY) fd = ioctl(fd_tty, TIOCSETCTTY, NULL); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): ioctl(..,TIOCSETCTTY): %d\n", fd)); # else fd = open(ttydev, O_RDWR); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): tty open%s\n", fd < 0 ? " failure" : "ed OK")); if (fd >= 0) close(fd); # endif /* ---------------------------------------- */ fd = open("/dev/tty", O_WRONLY); rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): do we have controlling tty now: %s\n", fd < 0 ? "no (fatal)" : "yes (good)")); if (fd < 0) return -1; /* fatal */ close(fd); /* ---------------------------------------- */ rxvt_dbgmsg ((DBG_DEBUG, DBG_PTYTTY, "rxvt_control_tty(): tcgetpgrp(): %d getpgrp(): %d\n", (int) tcgetpgrp(fd_tty), (int) getpgrp())); /* ---------------------------------------- */ #endif /* ! __QNX__ */ return 0; } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/feature.h0000644000175000001440000003732210756133022012216 00000000000000/*--------------------------------*-H-*---------------------------------* * File: feature.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-1998 Oezguer Kesim * Copyright (c) 2005 William P. Y. Hadisoeseno * * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __FEATURE_H__ #define __FEATURE_H__ #ifndef X11USRLIBDIR # define X11USRLIBDIR "/usr/X11R6/lib" #endif #ifndef X11LIBDIR # define X11LIBDIR X11USRLIBDIR "/X11" #endif #ifndef XAPPLOADDIR # define XAPPLOADDIR X11LIBDIR "/app-defaults" # define XAPPLOADDIRLOCALE X11LIBDIR "/%-.*s/app-defaults" #endif /* Check ~/.Xdefaults and ~/.Xresources as well */ #define HAVE_EXTRA_XRESOURCE_FILES /*-----------------------SCREEN OPTIONS AND COLOURS-----------------{{{1*/ /* * Define the name of the environment variable to be used in * addition to the "PATH" environment and the `path' resource. * Usually it should point to where you keep your background pixmaps and/or * your menu files */ #define PATH_ENV "RXVTPATH" /* * Avoid enabling the colour cursor (-cr, cursorColor, cursorColor2) */ /* #define NO_CURSORCOLOR */ /* * Suppress use of BOLD and BLINK attributes for setting bright foreground * and background, respectively. Simulate BOLD using colorBD, boldFont or * overstrike characters. */ /* #define NO_BRIGHTCOLOR */ /* * Try and brighten colors in the 16--255 range (if possible) instead of using * the bold attribute. */ /* #define BOLD_BRIGHTENS_256_COLORS */ /* * Make colours match xterm colours instead of `traditional' rxvt colours */ #define XTERM_COLORS /* * Disable separate colours for bold, underline and reverse video */ /* #define NO_BOLD_UNDERLINE_REVERSE */ /* * Disable using simulated bold using overstrike. You can also turn off * overstrike just for multi char fonts * Note: NO_BOLDOVERSTRIKE implies NO_BOLDOVERSTRIKE_MULTI */ /* #define NO_BOLDOVERSTRIKE */ /* #define NO_BOLDOVERSTRIKE_MULTI */ /* * Don't bother cleaning up pixel droppings. If you don't use bold * overstrike then you don't usually need this */ /* #define NO_PIXEL_DROPPING_AVOIDANCE */ /* * Compile without support for real bold fonts */ /* #define NO_BOLDFONT */ /* * Add support for '-hc colour' for background highlight of selection */ #define OPTION_HC /* * Define maximum possible columns and rows */ #define MAX_COLS 1000 #define MAX_ROWS 1000 /* * Define default colours for certain items. If you have a low colour * display, then consider using colours which are already pre-allocated: * Black (#000000) * Red3 (#CD0000) + these * Green3 (#00CD00) + colours * Yellow3 (#CDCD00) + are * Blue3 (#0000CD) + not * Magenta3 (#CD00CD) + pre-allocated * Cyan3 (#00CDCD) + if * AntiqueWhite (#FAEBD7) + NO_BRIGHTCOLOR * Grey25 (#404040) + defined * Red (#FF0000) * Green (#00FF00) * Yellow (#FFFF00) * Blue (#0000FF) * Magenta (#FF00FF) * Cyan (#00FFFF) * White (#FFFFFF) */ /* These colours MUST be defined */ #define COLOR_FOREGROUND "Black" #define COLOR_BACKGROUND "White" #define COLOR_SCROLLBAR "#B2B2B2" /* scrollColor match Netscape */ #define COLOR_SCROLLTROUGH "#969696" /* * The cursor colours are special. Be very careful about setting these: * foreground/background colours may be modified by command line or resources * prior to this allocation. Also, they are not valid if NO_CURSORCOLOR is * defined */ #define COLOR_CURSOR_FOREGROUND NULL /* if NULL, use background colour */ #define COLOR_CURSOR_BACKGROUND NULL /* if NULL, use foreground colour */ /* * Define to remove support for XCopyArea() support. XCopyArea() is useful * for scrolling on non-local X displays */ /* #define NO_SLOW_LINK_SUPPORT */ /* * Printer pipe which will be used for emulation of attached vt100 printer */ #define PRINTPIPE "lpr" /* * Allow 80/132 mode switching on startup */ /* #define ALLOW_132_MODE */ /*------------------------------RESOURCES---------------------------{{{1*/ /* * Define to find installed application defaults for rxvt */ /* #define USE_XAPPLOADDIR */ /* * Add support for the Offix DND (Drag 'n' Drop) protocol */ /* #define OFFIX_DND */ /*---------------------------------KEYS-----------------------------{{{1*/ /* * Define defaults for backspace and delete keys - unless they have been * configured out with --disable-backspace-key / --disable-delete-key */ /* #define DEFAULT_BACKSPACE "DEC" */ /* SPECIAL */ /* #define DEFAULT_BACKSPACE "\177" */ /* #define DEFAULT_DELETE "\033[3~" */ /* * If defined, then escape sequences for keys with a modifier pressed will be * the same as those sent by Xterm, instead of those sent by rxvt. */ #define XTERM_KEYS /* * If defined, then when numlock is on, the DEC terminal sequences sent by all * the keypad keys (including +,-,*, etc) will be the sequences sent with the * shift modifier ignored. Otherwise only the numeric keys and the decimal point * will ignore the shift modifier. */ #define NUMLOCK_ALWAYS_IGNORES_SHIFT /* * If defined, macros will be allowed to be "UNSHIFTED" (i.e. your macros don't * necessarily need a modifier key). */ #define UNSHIFTED_MACROS /* (Hops) Set to choose a number of lines of context between pages * (rather than a proportion (1/5) of savedlines buffer) * when paging the savedlines with SHIFT-{Prior,Next} keys. */ #define PAGING_CONTEXT_LINES (1) /* * Have either Ctrl+Tab or Mod4+Tab emit \e\t * Useful when window manager grabs Alt+Tab -- mg */ /* #define CTRL_TAB_MAKES_META */ /* #define MOD4_TAB_MAKES_META */ /* * default mode switch when greek keyboard is enabled (i.e. GREEK_SUPPORT) */ #ifndef GREEK_KEYBOARD_MODESWITCH # define GREEK_KEYBOARD_MODESWITCH XK_Mode_switch #endif /*--------------------------------MOUSE-----------------------------{{{1*/ /* * Enable jump scrolling when use mouse wheel */ #ifdef MOUSE_WHEEL # define JUMP_MOUSE_WHEEL #endif /* * Disable sending escape sequences (up, down, page up/down) * from the scrollbar when XTerm mouse reporting is enabled */ /* #define NO_SCROLLBAR_REPORT */ /* * Default separating chars for multiple-click selection * Space and tab are separate separating characters and are not settable */ #define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}~" /* * Add run-time support for changing the cutchars for double click selection */ #define CUTCHAR_RESOURCE /* * Have mouse reporting include double-click info for button1 */ /* #define MOUSE_REPORT_DOUBLECLICK */ /* * Set delay between multiple click events [default: 500 milliseconds] */ /* #define MULTICLICK_TIME 500 */ /* * Time factor to slow down a `jumpy' mouse. Motion isn't recognised until * this long after the last mouse click [default: 50 milliseconds] */ #define MOUSE_THRESHOLD 50 /* * If mouse wheel is defined, then scrolling is by 5 lines (or 1 line * if the shift key is down). Scrolling can be smooth or jump scrolling */ /* #define JUMP_MOUSE_WHEEL */ /* * Set delay periods for continuous scrolling with scrollbar buttons */ /* #define SCROLLBAR_INITIAL_DELAY 40 */ /* #define SCROLLBAR_CONTINUOUS_DELAY 2 */ /* * The speed of selection scrolling is proportional to the distance * the mouse pointer is out of the text window. This is the max * number of lines to scroll at a time. */ #define SELECTION_SCROLL_MAX_LINES 2 /* * The number of lines (measured in character's heights, not pixels) * the pointer must be out of the window for each increase in the * number of lines scrolled. */ #define SELECTION_SCROLL_LINE_SPEEDUP 4 /*--------------------------------MISC------------------------------{{{1*/ /* * Disable to reset tty device to pre-incovation state */ #define RESET_TTY_TO_COMMON_DEFAULTS /* * Only log in wtmp file when we're a login shell (-ls option) */ #define WTMP_ONLY_ON_LOGIN /* * When pasting ACS characters, convert to similar normal characters */ #define ACS_ASCII /* * Default ascii characters to which ACS symbols are converted */ #ifdef ACS_ASCII # define ACS_CHARS ".# o+ ----+---__++--|<> =#. " #endif /* * When executing external commands (e.g. via NewTab macro) use attempt to word * split at quotes internally. */ /* #define INTERNAL_ARGV_SPLIT */ /* * Maximum number of process (executed via Exec / NewTab macros, or -blc option) * that can be alive at one time. */ #define MAX_CHILDS (16) /* * Quick timeout default. The amount of time (micro seconds) mrxvt should wait * for X events when a screen refresh is pending. Screen refreshes (especially * with Xft and anti-aliasing) is quite expensive. The higher the value, the * fewer screen refreshes are preformed. If you set it too high, you might find * typing text a little jerky. If you set it too low, bye bye CPU. Try something * in the range of 500 -- 50000 */ #define TIMEOUT_USEC (10000) /*--------------------------------BELL------------------------------{{{1*/ /* * Disable all bell indications */ /* #define NO_BELL */ /* * Disable automatic de-iconify when a bell is received */ /* #define NO_MAPALERT */ /* * Have mapAlert behaviour selectable with mapAlert resource */ #define MAPALERT_OPTION /*------------------------------TAB BAR-----------------------------{{{1*/ /* Default title of new tabs if unspecified */ #define DEFAULT_TAB_TITLE "Terminal" /*-----------------------------SCROLL BAR---------------------------{{{1*/ /* * Choose the rxvt style scrollbar width * - should be an even number [default: 10] */ /* #define SB_WIDTH_RXVT 10 */ /* * Minimum and maximum widths of the scrollbar (all styles) */ #define SB_WIDTH_MINIMUM 5 #define SB_WIDTH_MAXIMUM 100 /* * When using Rxvt scrollbar, clicking above or below the slider will move * 1/4 of the screen height, if possible. Setting RXVT_SCROLL_FULL will move * it one screen height less one line, if possible */ #define RXVT_SCROLL_FULL 1 /* * (Hops) draw an internal border line on inside edge of the scrollbar */ /* #define SB_BORDER */ /*------------------------------MENU BAR----------------------------{{{1*/ /* * Choose how many of (experimental) menuBars you want to be able to stack at * one time. * A value of 1 disables menuBar stacking. * A value of 0 disables menuBar all together. * Note that the amount of memory overhead is the same for any value >= 2. */ /* * 2006-02-04 gi1242: The user interface (using escape sequences) for modifying * menus has been disabled due to a security hole. Thus stacking menubars is * absolutely pointless and a waste of memory. The stacking code has been * removed. */ /* #define MENUBAR_MAX 8 */ /* * Change the default shadow style */ /* #define MENUBAR_SHADOW_IN */ /* * Change the default shadow style */ #define MENU_SHADOW_IN /*---------------------------MULTILINGUAL---------------------------{{{1*/ /* * Allow run-time selection of Meta (Alt) to set the 8th bit on */ #define META8_OPTION /*---------------------------DISPLAY OPTIONS------------------------{{{1*/ /* * Force local connection to be socket (or other local) communication */ /* #define LOCAL_X_IS_UNIX */ /* * Have DISPLAY environment variable & "\E[7n" transmit display with IP number */ /* #define DISPLAY_IS_IP */ /* * Have "\E[7n" transmit the display name. * This has been cited as a potential security hole. */ /* #define ENABLE_DISPLAY_ANSWER */ /* * Change what ESC Z transmits instead of the default "\E[?1;2c" */ /* #define ESCZ_ANSWER "\033[?1;2C" */ /* * Check the current value of the window-time/icon-name and avoid * re-setting it to the same value -- avoids unnecessary window refreshes */ #define SMART_WINDOW_TITLE /* * Allow colors to be changed with an xterm escape sequence. */ #define XTERM_COLOR_CHANGE /* * Remove secondary screen's independent cursor position, a la xterm */ /* #define NO_SECONDARY_SCREEN_CURSOR */ /* * If no secondary screen is available (NO_SECONDARY_SCREEN in config.h), * then scroll the text up on a window change request */ /* #define SCROLL_ON_NO_SECONDARY */ /* Width of the term internal border */ #define DEFAULT_INTERNALBORDERWIDTH (0) #define MAX_INTERNALBORDERWIDTH (20) /* Width of the term external border */ #define DEFAULT_EXTERNALBORDERWIDTH (0) #define MAX_EXTERNALBORDERWIDTH (20) /* Default number of extra dots between lines */ #define DEFAULT_LINESPACE (0) #define MAX_LINESPACE (20) /* Default seconds of pointer blank delay */ #define DEFAULT_BLANKDELAY (2) #define MAX_BLANKDELAY (20) /* Default number of lines in the scrollback buffer */ #define DEFAULT_SAVELINES (100) #define MAX_SAVELINES (0xffff) /* Default bell throttle interval */ #define THROTTLE_BELL_MSEC (500) #define THROTTLE_BELL_COUNT (3) /* Default tabstop size */ #define TABSTOP_SIZE (8) /* Maximal length and display length of tab title */ #define MAX_TAB_TXT (507) #define MAX_DISPLAY_TAB_TXT (40) #define MAX_TAB_PIXEL_WIDTH (200) #define DEFAULT_DISPLAY_TAB_TXT (27) #define DEFAULT_MIN_VISIBLE_TABS (6) /* Minimum Xft font size (pixel) */ #define MIN_XFT_FONT_SIZE (1) /* Default Xft font name and size */ #define DEFAULT_XFT_FONT_SIZE (12) #define DEFAULT_XFT_FONT_NAME "Monospace" /* Default Xft propotional font name and size (used for menubar / tabs) */ #define DEFAULT_XFT_PFONT_SIZE (10) #define DEFAULT_XFT_PFONT_NAME "Sans" /* Default cursor blinking time (ms) */ #define MIN_BLINK_TIME (100) #define DEFAULT_BLINK_TIME (500) #define MAX_BLINK_TIME (5000) /* * Make text cursor highlighting be the same as color of char that the cursor is * currently on. */ #define CURSOR_COLOR_IS_RENDITION_COLOR /* #define SIMULATE_LINUX_CONSOLE_CURSOR_COLOR */ /* Set tab title on Xterm escape sequence to change window title */ #define SET_TAB_TITLE_ON_XTERM_SEQUENCE /* Set tab title on Xterm escape sequence but not change window title */ #define SET_TAB_TITLE_NOT_WIN_TITLE /* Enable dead key. To do so, set option "XkbLayout" to "us_intl" ** in the keyboard device section. Then disable multichar encoding (-km noenc) and use ISO8859-X fonts. */ #define USE_DEADKEY /* Strip trailing spaces from selection */ #define DONT_SELECT_TRAILING_SPACES /* * Default interval (micro secs) to wait before refreshing the background under * pseudo transparency. */ #define DEFAULT_BG_REFRESH_INTERVAL 100000L /* * Default number of pages to skip when jump scrolling. */ #define DEFAULT_SKIP_PAGES (25) /* * If an active tab produces fewer than these many characters, a screen refresh * is requested immediately. Otherwise it is delayed slightly (about 10ms) to * ensure that the active tab is not "flat out" scrolling. */ #define DEFAULT_REFRESH_LIMIT (0) /* * Provide termcap/terminfo bw support */ /* #define TERMCAP_HAS_BW */ #endif /* __FEATURE_H__ */ /*}}}1*/ /* vim: set fdm=marker: */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/right.xbm0000644000175000001440000000065210756127602012242 00000000000000#define right_width 18 #define right_height 18 static unsigned char right_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0xc0, 0x00, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x0f, 0x00, 0xc0, 0x1f, 0x00, 0xc0, 0x0f, 0x00, 0xc0, 0x07, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x01, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; mrxvt-0.5.4/src/right.xpm0000644000175000001440000000077110756127602012262 00000000000000/* XPM */ static char * right_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #00086D", "..................", "..................", "..................", "......+...........", "......++..........", "......+++.........", "......++++........", "......+++++.......", "......++++++......", "......+++++++.....", "......++++++......", "......+++++.......", "......++++........", "......+++.........", "......++..........", "......+...........", "..................", ".................."}; mrxvt-0.5.4/src/macros.c0000644000175000001440000010720511032001370012024 00000000000000/*--------------------------------*-C-*----------------------------------------* * File: macros.c (used to be hotkeys.c) *-----------------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass * Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /* * Must sync these to macroFnNames in rxvtlib.h. */ static const char *const macroNames[] = { "Dummy", /* Delete macro */ "Esc", /* Escape sequence to send to mrxvt */ "Str", /* String to send to child process */ "NewTab", /* Open a new tab, and exec a program in it. */ "Exec", /* Exec a program asynchronusly */ "Close", /* Close tab(s) */ "GotoTab", /* Switch to tab */ "MoveTab", /* Move tab */ "Scroll", /* Scroll up/down */ "Copy", /* Copy selection */ "Paste", /* Paste selection */ "PasteFile", /* Paste the content of a file */ "MonitorTab", /* Monitor tab for activity/inactivity */ "ToggleSubwin", /* Toggle subwindows (scroll / menu / tabbar) */ "ResizeFont", /* Resize terminal font */ "ToggleVeryBold", /* Toggle use of bold font for colored text */ "ToggleBoldColors", /* Toggle option boldColors */ "ToggleVeryBright", /* Toggle option veryBright */ "ToggleTransparency", /* Toggle pseudo transparency */ "ToggleBroadcast", /* Toggle broadcasting of input */ "ToggleHold", /* Toggle holding of completed tabs */ "ToggleFullscreen", /* Toggle full screen mode */ "Raise", /* Raise the terminal window */ "SetTitle", /* Set title of active tab to selection */ "UseFifo", /* Enable / disable using fifo */ "PrintScreen", /* Dump screen to file / printer */ "SaveConfig", /* Save config to file */ "ToggleMacros" /* Toggle using keyboard macros */ }; /******************************************************************************\ * BEGIN INTERNAL ROUTINE PROTOTYPES * \******************************************************************************/ int macro_cmp ( const void*, const void*); int rxvt_add_macro ( rxvt_t*, KeySym, unsigned char, char*, Bool, macro_priority_t); unsigned char macro_set_number ( unsigned char, unsigned char); /******************************************************************************\ * END INTERNAL ROUTINE PROTOTYPES * \******************************************************************************/ /* * 2006-02-23 gi1242: New macro code. This should extend the hotkey aproach * without causing code bloat. The idea is that defining "macros" can also * enable the user to communicate with mrxvt using escape sequences! */ /* * str = [+-][s|t|m|b] * * '+' means show. '-' means hide. Neither means toggle. * * s, t, m, b are the scroll tab and menubars respectively. 'b' is tabbar * buttons. * * 2006-02-23 gi1242 TODO: Permit hiding / showing more than one sub window at * one time. Currently calls to resize_on_subwin must be followed by * ConfigureNotify event (which we process) to correct the sizeHint (otherwise * we end up having the wrong size). */ /* EXTPROTO */ void rxvt_toggle_subwin( rxvt_t *r, const unsigned char *str) { if (IS_NULL(str) || (char) 0 == *str || STRCHR( str, 't') || STRCHR( str, 'T' ) ) { /* * Backward compatibility -- If str is NULL or empty, then toggle the * tabbar visibility. */ if (rxvt_tabbar_visible (r) && (IS_NULL(str) || '+' != *str)) { /* * If the tabbar is visible, and we are not forced to show it then * hide it. */ if( rxvt_tabbar_hide(r) ) rxvt_resize_on_subwin (r, HIDE_TABBAR); } else if (!rxvt_tabbar_visible (r) && (IS_NULL(str) || '-' != *str)) { /* * If the tabbar is hidden, and we are not forced to hide it, then * show the tabbar. */ if( rxvt_tabbar_show(r)) rxvt_resize_on_subwin (r, SHOW_TABBAR); } return; } /* * The remainder of this function assumes a non-empty string. */ if( STRCHR( str, 'b') || STRCHR( str, 'B') ) { /* Toggle tabbar buttons */ switch( *str ) { case '+': /* Show buttons */ UNSET_OPTION(r, Opt2_hideButtons); break; case '-': /* Hide buttons */ SET_OPTION(r, Opt2_hideButtons); break; default: /* Toggle buttons */ TOGGLE_OPTION(r, Opt2_hideButtons); } /* Refresh tabbar */ rxvt_tabbar_set_visible_tabs (r, False); if (IS_WIN(r->tabBar.win)) XClearArea( r->Xdisplay, r->tabBar.win, 0, 0, 0, 0, True); return; } #ifdef HAVE_SCROLLBARS if( STRCHR( str, 's') || STRCHR( str, 'S' ) ) { if( rxvt_scrollbar_visible (r) && *str != '+' ) { if( rxvt_scrollbar_hide(r) ) rxvt_resize_on_subwin (r, HIDE_SCROLLBAR); } else if( !rxvt_scrollbar_visible( r ) && *str != '-' ) { if( rxvt_scrollbar_show(r) ) rxvt_resize_on_subwin (r, SHOW_SCROLLBAR); } return; } #endif #ifdef HAVE_MENUBAR if( STRCHR( str, 'm') || STRCHR( str, 'M' ) ) { if( rxvt_menubar_visible (r) && *str != '+' ) { if( rxvt_menubar_hide(r) ) rxvt_resize_on_subwin (r, HIDE_MENUBAR); } else if( !rxvt_menubar_visible( r ) && *str != '-' ) { if( rxvt_menubar_show(r) ) rxvt_resize_on_subwin (r, SHOW_MENUBAR); } return; } #endif } /* }}} */ /* * Functions to parse macros (add them to our list), and exec actions. */ /* {{{1 macro_cmp() * * Used by bsearch and qsort for macro comparison. */ int macro_cmp( const void *p1, const void *p2) { const macros_t *macro1 = p1, *macro2 = p2; /* First compare keysyms, then modflags. Ignore the "Primary" modifier */ if( macro1->keysym == macro2->keysym ) { if( (macro1->modFlags & ~MACRO_PRIMARY & MACRO_MODMASK) == (macro2->modFlags & ~MACRO_PRIMARY & MACRO_MODMASK) ) return MACRO_GET_NUMBER( macro1->modFlags ) - MACRO_GET_NUMBER( macro2->modFlags ); else return (macro1->modFlags & ~MACRO_PRIMARY & MACRO_MODMASK) - (macro2->modFlags & ~MACRO_PRIMARY & MACRO_MODMASK); } else return macro1->keysym - macro2->keysym; } /* {{{1 macro_set_number( flag, num ) */ /* INTPROTO */ unsigned char macro_set_number( unsigned char flag, unsigned char num ) { flag &= MACRO_MODMASK; flag |= (num << MACRO_N_MOD_BITS); return flag; } /* {{{1 rxvt_parse_macros(str, arg): Parse macro from arguments * * str and arg can be as follows: * * 1. str = keyname, arg = argument. * 2. str = macro.keyname: argument, arg = NULL * * If a valid macro is found, it is added to our list (r->macros) of macros. * Returns 1 if the macro is added to r->macros, 0 if it is not a macro (i.e. * does not begin with "macro."), and -1 if invalid syntax / error adding / etc. */ /* EXTPROTO */ #define NEWARGLIM 500 /* `reasonable' size */ int rxvt_parse_macros( rxvt_t *r, const char *str, const char *arg, macro_priority_t priority) { char newarg[NEWARGLIM], keyname[ NEWARGLIM], *keyname_nomods; unsigned char modFlags = 0; KeySym keysym; Bool addmacro = False; if (IS_NULL(arg)) { char *keyend; int n; /* * Need to split str into keyname and argument. */ if( (n = rxvt_str_match(str, "macro.")) == 0 ) return 0; str += n; /* skip `macro.' */ if (IS_NULL(keyend = STRCHR( str, ':' ))) return -1; n = min( keyend - str, NEWARGLIM - 1 ); STRNCPY( keyname, str, n ); keyname[n] = 0; STRNCPY( newarg, keyend + 1, NEWARGLIM - 1 ); } else { /* * Keyname is already in str. Copy arg into newarg. */ STRNCPY( keyname, str, NEWARGLIM - 1 ); keyname[ NEWARGLIM - 1] = '\0'; STRNCPY( newarg, arg, NEWARGLIM - 1 ); } /* Null terminate and strip leading / trailing spaces */ newarg[NEWARGLIM - 1] = '\0'; rxvt_str_trim( newarg ); rxvt_msg( DBG_INFO, DBG_MACROS, "Got macro '%s' -- '%s'\n", keyname, newarg ); /* * Breakup keyname into a keysym and modifier flags. */ if (IS_NULL(keyname_nomods = STRRCHR( keyname, '+' ))) { /* No modifiers specified */ #ifdef UNSHIFTED_MACROS keyname_nomods = keyname; #else return -1; #endif } else { *(keyname_nomods++) = 0; /* * keyname is now a null terminated string containing only the * modifiers, and keyname_nomods is a null terminated string * containing only the key name. */ if( STRCASESTR( keyname, "ctrl" ) ) modFlags |= MACRO_CTRL; if( STRCASESTR( keyname, "meta" ) || STRCASESTR( keyname, "alt")) modFlags |= MACRO_META; if( STRCASESTR( keyname, "shift") ) modFlags |= MACRO_SHIFT; if( STRCASESTR( keyname, "primary")) modFlags |= MACRO_PRIMARY; if( STRCASESTR( keyname, "add" ) ) addmacro = True; } /* * Always store the keysym as upper case. That way we can treat shift * correctly even when Caps Lock is pressed. */ { KeySym upper; XConvertCase(XStringToKeysym(keyname_nomods), &keysym, &upper); } if (NOT_KEYSYM(keysym)) { rxvt_msg (DBG_ERROR, DBG_MACROS, "Invalid keysym %s. Skipping macro.", keyname_nomods); return -1; } return rxvt_add_macro( r, keysym, modFlags, newarg, addmacro, priority) ? 1 : -1; } /* {{{1 rxvt_add_macro( keysym, modFlags, astring, priority) * * Add a macro to our list of macros (r->macros) if astring describes a valid * macro. * * priority is the priority with which the macro should be added. A macro should * never overwrite a macro with lower priority (yes, I know that's backwards). A * macro should be added to a chain ONLY IF it's priority is the same as the * previous macro's priority. */ /* INTPROTO */ int rxvt_add_macro( rxvt_t *r, KeySym keysym, unsigned char modFlags, char *astring, Bool addmacro, macro_priority_t priority) { const unsigned nmacros_increment = 64; /* # extra macros to alloc space for when we need to enlarge our list of macros. A large number here is not wasteful as we clean it up after initialization */ unsigned short i, replaceIndex = r->nmacros, dummyIndex = r->nmacros; unsigned char macroNum = 0; action_t action; rxvt_dbgmsg(( DBG_DEBUG, DBG_MACROS, "%s(%08lx, %2hhx, '%s', %d, %d)\n", __func__, keysym, modFlags, astring, addmacro, priority )); /* * Check to see if macro already exists. */ for( i=0; i < r->nmacros; i++ ) { if( r->macros[i].keysym == keysym && (r->macros[i].modFlags & MACRO_MODMASK & ~MACRO_PRIMARY) == (modFlags & MACRO_MODMASK & ~MACRO_PRIMARY) ) { if( addmacro && r->macros[i].priority == priority ) { /* * Find the last macro in the macro chain (the macro with the * largest number). */ unsigned char num; num = MACRO_GET_NUMBER( r->macros[i].modFlags ); if( num > macroNum ) macroNum = num; if( macroNum == MACRO_MAX_CHAINLEN ) { rxvt_msg (DBG_ERROR, DBG_MACROS, "Macro chain too long" ); return 0; } replaceIndex = i; } /* * Macro for key already exists. Only replace it if we have a * *lower* priority (which in theory should never happen). */ else if( priority > r->macros[i].priority ) return 1; /* Claim to have succeded so that caller will not complain about "Failing to add a ... macro". */ /* * 2006-03-06 gi1242: Don't delete "Dummy" macros here. If we do * that then the user will have no way to delete macros defined in * the system /etc/mrxvt/mrxvtrc file. "Dummy" macros will be * deleted after init. */ else { if( replaceIndex < r->nmacros ) { /* * replaceIndex points to a macro with keysym == the keysym * of the macro to be added. Set keysym to 0 so that it will * be cleaned up by rxvt_cleanup_macros(). */ r->macros[replaceIndex].keysym = 0; } replaceIndex = i; } } else if( r->macros[i].keysym == 0 ) /* * Macros with keysym 0 are dummies, and can be safely replaced. */ dummyIndex = i; } /* for */ /* * Now dummyIndex will point to a macro that can safely be replaced. * replaceIndex (if less than r->nmacros) will be the index of a macro in * r->macros which has the same keysym / modflags as the macro we wish to * add. We will either replace this macro with the new one, or add to it if * the "Add" flag was specified. */ if( addmacro ) { if( replaceIndex == r->nmacros ) { rxvt_msg( DBG_ERROR, DBG_MACROS, "No previous macro to add to (key %s%s%s%s)", (modFlags & MACRO_CTRL) ? "Ctrl+" : "", (modFlags & MACRO_META) ? "Meta+" : "", (modFlags & MACRO_SHIFT) ? "Shift+" : "", XKeysymToString( keysym ) ); return 0; /* Failure */ } else if( r->macros[replaceIndex].priority != priority ) { rxvt_msg( DBG_ERROR, DBG_MACROS, "Can not add to a macro defined at a different location " "(key %s%s%s%s)", (modFlags & MACRO_CTRL) ? "Ctrl+" : "", (modFlags & MACRO_META) ? "Meta+" : "", (modFlags & MACRO_SHIFT) ? "Shift+" : "", XKeysymToString( keysym ) ); return 0; /* Failure */ } else if( r->macros[replaceIndex].action.type == MacroFnDummy ) { /* Do not add to a dummy macro */ rxvt_msg (DBG_ERROR, DBG_MACROS, "Can not add actions to a Dummy macro" "(key %s%s%s%s)", (modFlags & MACRO_CTRL) ? "Ctrl+" : "", (modFlags & MACRO_META) ? "Meta+" : "", (modFlags & MACRO_SHIFT) ? "Shift+" : "", XKeysymToString( keysym ) ); return 0; /* Failure */ } /* * We're going to add to this macro chain, so don't replace this macro. */ replaceIndex = dummyIndex; /* * Make the number of this macro one higher than the last in the macro * chain. */ modFlags = macro_set_number( modFlags, macroNum+1 ); } else { modFlags = macro_set_number( modFlags, 0 ); /* Set replaceIndex to the index of a macro we can replace */ if( dummyIndex < replaceIndex ) replaceIndex = dummyIndex; } /* * Add action to the list of macros (making it bigger if necessary). */ if( replaceIndex == r->nmacros ) { if( r->nmacros == r->maxMacros ) { /* Get space for more macros*/ r->maxMacros += nmacros_increment; r->macros = (macros_t *) rxvt_realloc( r->macros, r->maxMacros * sizeof(macros_t)); } r->nmacros++; } else { /* Macro action string needs to be freed (as it will be replaced) */ if( r->macros[replaceIndex].action.str ) rxvt_free( r->macros[replaceIndex].action.str ); } /* * Set the action string. This malloc's memory so any returns after this * should either save action in to a global variable, or free it. */ assert( astring ); SET_NULL(action.str); /* Make sure rxvt_set_action won't free non-existent memory */ if( !rxvt_set_action( &action, astring) ) return 0; /* Failure: Probably unrecognized action type */ /* * Save macro values in our global macro list. */ r->macros[replaceIndex].keysym = keysym; r->macros[replaceIndex].modFlags = modFlags; r->macros[replaceIndex].action = action; r->macros[replaceIndex].priority = priority; rxvt_dbgmsg(( DBG_DEBUG, DBG_MACROS, "Added macro %hu of %hu. Type %s, len %hu, args '%s'.\n", replaceIndex, r->maxMacros, macroNames[ action.type ], action.len, (action.type == MacroFnStr || action.type == MacroFnEsc) ? "(escaped string)" : (IS_NULL(action.str) ? "(nil)" : (char*) action.str))); return 1; /* Success */ } /* {{{1 rxvt_cleanup_macros() * * Delete all "Dummy" macros from our list of macros, and free space alloced for * extra macros */ void rxvt_cleanup_macros( rxvt_t *r ) { unsigned i, nDummyMacros = 0; if( r->nmacros == 0 ) return; /* Nothing to be done */ for( i = 0; i < r->nmacros; i++) { if( r->macros[i].action.type == MacroFnDummy || NOT_KEYSYM(r->macros[i].keysym) ) { /* * Dummy macro needs to be deleted. Make sure this macro comes first * in the macro list. * * 2006-03-06 gi1242: Would be more efficient if we made sure that * this macro was last in the list, however that would involve * knowing what the max keysym value is. Could be different on * different architectures. */ r->macros[i].keysym = 0; r->macros[i].modFlags = 0; if (NOT_NULL(r->macros[i].action.str)) { rxvt_free( r->macros[i].action.str ); SET_NULL(r->macros[i].action.str); /* Probably unnecessary */ } nDummyMacros++; } } /* for */ /* * The macro list now needs to be sorted on keysym. When we look for macros, * we assume the macro list is sorted, so we can use a binary search to * lookup macros quickly. */ qsort( r->macros, r->nmacros, sizeof( macros_t ), macro_cmp); /* Remove dummy macros from our list */ MEMMOVE( r->macros, r->macros + nDummyMacros, (r->nmacros - nDummyMacros) * sizeof( macros_t ) ); r->nmacros -= nDummyMacros; /* Shrink our macros list */ if( r->nmacros < r->maxMacros ) { r->macros = rxvt_realloc( r->macros, r->nmacros * sizeof( macros_t )); r->maxMacros = r->nmacros; } rxvt_dbgmsg(( DBG_DEBUG, DBG_MACROS, "Read %d macros. (Have space for %d macros)\n", r->nmacros, r->maxMacros)); } /* {{{1 rxvt_set_action( action, astring) * * Check what action is specified by astring, and assign respective values in * action. * * The string astring might be modified, but can be freed immediately after * calling this function (regardless of wether it succeeds or not). */ /* EXTPROTO */ Bool rxvt_set_action (action_t *action, char *astring) { unsigned short type, len; rxvt_dbgmsg ((DBG_DEBUG, DBG_MACROS, "Setting action '%s'\n", astring)); /* * Match head of "astring" to a name in macroNames to figure out the macro * type. */ for( type = 0; type < NMACRO_FUNCS; type++) { if( (len = rxvt_str_match( astring, macroNames[type])) ) { /* Matched a macroName at the start of astring */ if( astring[len] && !isspace( astring[len] ) ) /* Not delimited by a space */ continue; /* Skip macroName and delimiting spaces */ astring += len; while( *astring && isspace( *astring ) ) astring++; /* Exit for loop early */ break; } } if( type == NMACRO_FUNCS ) { rxvt_msg (DBG_ERROR, DBG_MACROS, "Action %s is not of known type", astring); return False; /* Failure: No matching macro name */ } /* * Setup values in action */ action->type = type; /* * Interpolate escape sequences into action. XXX: Should we only do this for * MacroFnStr and MacroFnEsc?. */ len = rxvt_str_escaped( astring ); /* All macros exept MacroFnStr and MacroFnEsc have null terminated string */ if( type != MacroFnStr && type != MacroFnEsc && len > 0 && astring[len-1] ) astring[ len++ ] = 0; /* Since astring was null terminated, astring[len] is certainly part of the memory in astring. */ action->len = len; /* Set action->str. If any data is previously there, realloc it. */ if( len > 0 ) { action->str = (unsigned char *) rxvt_realloc( action->str, len * sizeof(unsigned char)); MEMCPY( action->str, astring, len); } else if (NOT_NULL(action->str)) { rxvt_free( action->str ); SET_NULL(action->str); } return True; } /* {{{1 rxvt_process_macros( keysym, ev) * * Check to see if a macro key was pressed. If yes, exec the action and return * 1. Else return 0. * * 2006-02-24 gi1242: Take both a keysym, and a XKeyEvent argument because, the * caller might have modified keysym based on XIM. */ /* EXTPROTO */ int rxvt_process_macros( rxvt_t *r, KeySym keysym, XKeyEvent *ev) { macros_t ck, /* Storing the keysym and mods of the current key that's pressed. */ *macro; /* Macro we find in our saved list corresponding to the current key press */ int status; if( r->nmacros == 0 ) return 0; /* No macro processed */ /* Copy the modifier mask and keysym into ck */ ck.modFlags = 0; if (ev->state & ShiftMask) ck.modFlags |= MACRO_SHIFT; if (ev->state & ControlMask) ck.modFlags |= MACRO_CTRL; if (ev->state & r->h->ModMetaMask) ck.modFlags |= MACRO_META; /* Use uppercase version so we can ignore caps lock */ { KeySym upper; XConvertCase(keysym, &ck.keysym, &upper); } /* Check if macro ck is in our list of macros. */ macro = bsearch( &ck, r->macros, r->nmacros, sizeof( macros_t ), macro_cmp); if ( /* * No macro found. */ IS_NULL(macro) || ( /* * Primary only macro in secondary screen. */ (macro->modFlags & MACRO_PRIMARY) && AVTS(r)->current_screen != PRIMARY ) || ( /* * When macros are disabled, only the toggle macros macro should * work. */ ISSET_OPTION(r, Opt2_disableMacros) && macro->action.type != MacroFnToggleMacros ) ) return 0; /* No macro processed */ do { rxvt_dbgmsg ((DBG_DEBUG, DBG_MACROS, "Processing macro #%d mods %02hhx\n", macro - r->macros, macro->modFlags)); status = rxvt_dispatch_action( r, &(macro->action), (XEvent*) ev ); } while( status == 1 && (++macro - r->macros) < r->nmacros && MACRO_GET_NUMBER( macro->modFlags ) ); return status; } /* {{{1 rxvt_dispatch_action( action, ev) * * Exec the macro / menu action with type "type" and action "action". Returns 1 * on success, -1 on failure. */ /* EXTPROTO */ int rxvt_dispatch_action( rxvt_t *r, action_t *action, XEvent *ev) { const int maxLen = 1024; char expstr[ maxLen ]; char *astr; int alen, retval = 1; /* Succeed by default */ if( IS_NULL( action->str ) ) { SET_NULL( astr ); alen = 0; } else { /* % interpolate the action string */ astr = expstr; alen = rxvt_percent_interpolate( r, ATAB(r), (char *) action->str, action->len, astr, maxLen ); } switch( action->type ) { case MacroFnEsc: /* Send action to rxvt */ if( NOT_NULL( astr ) && alen > 1 ) rxvt_cmd_write( r, ATAB(r), (unsigned char*) astr, alen - 1); else { rxvt_msg (DBG_ERROR, DBG_MACROS, "Macro %s requires argument.", macroNames[action->type] ); retval = -1; } break; case MacroFnStr: /* Send action to child process */ if( NOT_NULL( astr ) && alen > 1 ) rxvt_tt_write( r, ATAB(r), (unsigned char*) astr, alen - 1); else { rxvt_msg (DBG_ERROR, DBG_MACROS, "Macro %s requires argument.", macroNames[action->type] ); retval = -1; } break; case MacroFnNewTab: if (NOT_NULL(astr)) { /* * If the first word is quoted, use that as the title. Don't be * fancy and check for nested quotes. That's probably * unnecessary. * * Everything after the first quoted word is the command. If * command starts with "!", then the shell is exec'ed before * running command. */ const int MaxMacroTitle = 80; /* Longest title we will have */ char titlestring[MaxMacroTitle]; char *command = (char *) astr; char *title = NULL; int profile = 0; /* See if a profile is specified */ if( *command == '-' ) { char *pnum_end; profile = strtoul( ++command, &pnum_end, 0 ); if( profile < 0 || profile >= MAX_PROFILES ) profile = AVTS(r)->profileNum; /* Skip spaces */ command = pnum_end; while( isspace( *command ) ) command++; } /* See if a title is specified */ if( *command == '"' ) { int i; /* Copy everything until first " into title */ for( i=0, command++; i < MaxMacroTitle - 2 && *command && *command != '"'; i++, command++ ) titlestring[i] = *command; titlestring[i] = '\0'; /* Null terminate title */ title = titlestring; /* Skip spaces after title */ if( *command ) command++; while( isspace( *command ) ) command++; } /* Add page */ rxvt_append_page( r, profile, title, *command ? command : NULL ); } else rxvt_append_page( r, 0, NULL, NULL ); break; case MacroFnExec: if( NOT_NULL( astr ) ) retval = rxvt_async_exec( r, astr ) ? 1 : -1; else { rxvt_msg (DBG_ERROR, DBG_MACROS, "Macro %s requires argument.", macroNames[action->type] ); retval = -1; } break; case MacroFnClose: if( alen > 0 && *(astr) ) { /* Close tab specified by str */ int tabno = atoi( (char*) astr) - 1; if( tabno == -1 ) tabno = ATAB(r); if ( tabno >=0 && tabno <=LTAB(r) && ( NOTSET_OPTION(r, Opt2_protectSecondary) || PVTS(r, tabno)->current_screen == PRIMARY ) ) { rxvt_kill_page (r, tabno); } else retval = -1; } else rxvt_exit_request( r ); break; case MacroFnGoto: { /* Goto tab in position astr */ int tabno; if (NOT_NULL(astr) && *(astr) ) { tabno = atoi( (char*) astr ); if( *(astr) == '+' || *(astr) == '-' ) { /* * Relative movement of tabs */ tabno += ATAB(r); /* Wrap around */ tabno = tabno % (LTAB(r) + 1); if( tabno < 0 ) tabno += LTAB(r) + 1; } else if( tabno == 0 ) { /* * Previous active tab */ tabno = PTAB(r); } else if( --tabno > LTAB(r) ) { /* * Absolute tab number. If we're too far to the right, * activate the last tab. */ tabno = LTAB(r); } } else tabno = PTAB(r); rxvt_activate_page( r, tabno); break; } case MacroFnMove: /* Move active tab to position in astr */ if( alen > 0 && *(astr) ) { short tabno = atoi( (char*) astr ); if( *(astr) == '+' || *(astr) == '-' ) rxvt_tabbar_move_tab( r, tabno + ATAB(r)); else rxvt_tabbar_move_tab( r, tabno-1 ); } else retval = -1; break; case MacroFnScroll: /* Scroll by an amount specified in astr */ if( alen > 1 ) { int amount = abs( atoi( (char*) astr )); enum page_dirn direction = (*(astr) == '-' ? UP : DN); rxvt_dbgmsg ((DBG_DEBUG, DBG_MACROS, "astr: '%s', alen: %d\n", astr, alen)); if( tolower( astr[ alen - 2] ) == 'p' ) /* scroll pages */ amount *= #ifdef PAGING_CONTEXT_LINES r->TermWin.nrow - PAGING_CONTEXT_LINES #else r->TermWin.nrow * 4 / 5 #endif ; rxvt_scr_page( r, ATAB(r), direction, amount); # ifdef HAVE_SCROLLBARS rxvt_scrollbar_update(r, 1); # endif /* HAVE_SCROLLBARS */ } break; #if 0 case MacroFnCopy: #endif case MacroFnPaste: { int sel = XA_PRIMARY; if (NOT_NULL(ev)) { if( NOT_NULL(astr) && *astr ) { if(strcmp ("PRIMARY", astr) == 0) sel=XA_PRIMARY; else if (strcmp ("SECONDARY", astr) == 0) sel=XA_SECONDARY; else if (strcmp ("CLIPBOARD", astr) == 0) sel=XA_CLIPBOARD; else break; rxvt_selection_request_by_sel( r, ATAB(r), ev->xkey.time, 0, 0, sel); } else rxvt_selection_request (r, ATAB(r), ev->xkey.time, 0, 0); } else { retval = -1; } break; } case MacroFnPasteFile: { if (NOT_NULL(ev)) { if( NOT_NULL(astr) && *astr ) rxvt_paste_file (r, ATAB(r), ev->xkey.time, 0, 0, astr); else break; } else retval = -1; break; } case MacroFnMonitorTab: { if (NOT_NULL(ev)) { if( NOT_NULL(astr) && *astr ) { short doit = 0; /* which monitoring type do we need ? */ if(strcmp ("ACTIVITY", astr) == 0) { AVTS(r)->monitor_tab = (AVTS(r)->monitor_tab == TAB_MON_ACTIVITY ) ? TAB_MON_OFF : TAB_MON_ACTIVITY; doit = 1; rxvt_msg (DBG_INFO, DBG_MACROS, "Macro %s ACTIVITY : activity monitoring request on tab %i.", macroNames[action->type], AVTS(r)->vts_idx ); } else if (strcmp ("INACTIVITY", astr) == 0) { AVTS(r)->monitor_tab = (AVTS(r)->monitor_tab == TAB_MON_INACTIVITY) ? TAB_MON_OFF : TAB_MON_INACTIVITY; doit = 1; rxvt_msg (DBG_INFO, DBG_MACROS, "Macro %s INACTIVITY : inactivity monitoring request on tab %i.", macroNames[action->type], AVTS(r)->vts_idx ); } else if (strcmp ("AUTO", astr) == 0) { AVTS(r)->monitor_tab = (AVTS(r)->monitor_tab == TAB_MON_AUTO) ? TAB_MON_OFF : TAB_MON_AUTO; doit = 1; rxvt_msg (DBG_INFO, DBG_MACROS, "Macro %s AUTO : request for automatic (in-)activity monitoring on tab %i.", macroNames[action->type], AVTS(r)->vts_idx ); } else { rxvt_msg (DBG_INFO, DBG_MACROS, "Macro %s requires argument or invalid argument provided.", macroNames[action->type] ); break; } /* activating/deactivating the macro */ if (doit != 0) { if (AVTS(r)->monitor_tab == TAB_MON_OFF ) { rxvt_msg (DBG_INFO, DBG_MACROS, "Macro %s was already active, deactivating previous macro call.", macroNames[action->type] ); }else { AVTS(r)->monitor_nbytes_read = 0; gettimeofday( &AVTS(r)->monitor_start , NULL); } } } } else { retval = -1; } break; } case MacroFnToggleSubwin: rxvt_toggle_subwin( r, (unsigned char*) astr); break; case MacroFnFont: { const int MaxFontLen = 8; /* Only need space for "#+xx" */ char fontname[MaxFontLen]; if( alen >= MaxFontLen - 1 ) break; /* Remember that alen includes the trailing null char */ fontname[0] = FONT_CMD; /* Internal prefix */ STRNCPY( fontname + 1, astr, MaxFontLen - 1); fontname[MaxFontLen - 1] = '\0'; /* Null terminate */ rxvt_resize_on_font( r, fontname ); break; } case MacroFnToggleVeryBold: TOGGLE_OPTION( r, Opt2_veryBold ); rxvt_scr_touch (r, ATAB(r), True); break; case MacroFnToggleBoldColors: TOGGLE_OPTION( r, Opt2_boldColors ); rxvt_scr_touch (r, ATAB(r), True); break; case MacroFnToggleVeryBright: TOGGLE_OPTION( r, Opt_veryBright ); rxvt_scr_touch (r, ATAB(r), True); break; case MacroFnToggleTransp: #ifdef TRANSPARENT rxvt_toggle_transparency(r); #else retval = -1; #endif break; case MacroFnToggleBcst: if( NOT_NULL(astr) && *astr ) { long state = strtol( astr, NULL, 0 ); switch(state) { case 1: SET_OPTION( r, Opt2_broadcast ); break; case 0: UNSET_OPTION( r, Opt2_broadcast ); break; case -1: TOGGLE_OPTION( r, Opt2_broadcast ); break; default: rxvt_msg( DBG_ERROR, DBG_MACROS, "Badly formed argument '%s' to %s\n", astr, macroNames[action->type] ); retval = -1; break; } } else TOGGLE_OPTION(r, Opt2_broadcast); break; case MacroFnToggleHold: if( NOT_NULL(astr) && *astr ) { /* Set the hold option for this tab */ char op = *astr++; unsigned long holdMask; holdMask = strtoul( astr, NULL, 0 ); switch( op ) { case '+': AVTS(r)->holdOption |= holdMask; break; case '-': AVTS(r)->holdOption &= ~holdMask; break; case '!': AVTS(r)->holdOption ^= holdMask; break; default: rxvt_msg (DBG_ERROR, DBG_MACROS, "Badly formed argument '%s' to %s\n", astr, macroNames[action->type] ); retval = -1; break; } /* Remove the ATAB if it no longer needs to be held */ if( AVTS(r)->dead && AVTS(r)->hold > 1 && !SHOULD_HOLD( r, ATAB(r) ) ) rxvt_remove_page( r, ATAB(r) ); } else { /* * Behaviour almost compatible with mrxvt-0.5.1: Just get rid of * all held tabs. */ int k; for (k = LTAB(r); k>= 0; k --) if (PVTS(r, k)->dead && PVTS(r, k)->hold > 1) rxvt_remove_page (r, k); } break; case MacroFnToggleFullscreen: ewmh_message( r->Xdisplay, XROOT, r->TermWin.parent, XInternAtom( r->Xdisplay, "_NET_WM_STATE", True), _NET_WM_STATE_TOGGLE, XInternAtom( r->Xdisplay, "_NET_WM_STATE_FULLSCREEN", True), 0, 0, 0 ); break; case MacroFnRaise: ewmh_message( r->Xdisplay, XROOT, r->TermWin.parent, XInternAtom( r->Xdisplay, "_NET_ACTIVE_WINDOW", True), 1, 0 /*timestamp?*/, r->TermWin.parent, 0, 0 ); break; case MacroFnSetTitle: if (NOT_NULL(astr)) rxvt_tabbar_set_title( r, ATAB(r), (unsigned char*) astr); else if (NOT_NULL(r->selection.text)) rxvt_tabbar_set_title( r, ATAB(r), (const unsigned char TAINTED*) r->selection.text); else retval = -1; break; #ifdef USE_FIFO case MacroFnUseFifo: if( NOT_NULL( astr ) ) { int state = strtol( astr, NULL, 0 ); if( state == -1 ) state = ISSET_OPTION( r, Opt_useFifo ) ? 0 : 1; if( state == 1 && !ISSET_OPTION( r, Opt_useFifo ) ) { SET_OPTION( r, Opt_useFifo ); rxvt_init_fifo( r ); } else if( state == 0 && ISSET_OPTION( r, Opt_useFifo ) ) { if( r->fifo_fd != -1 ) { close( r->fifo_fd ); if( r->num_fds == r->fifo_fd + 1) rxvt_adjust_fd_number( r ); r->fifo_fd = -1; unlink( r->fifo_name ); } UNSET_OPTION( r, Opt_useFifo ); } } break; #endif/*USE_FIFO*/ case MacroFnPrintScreen: { /* * Arguments: [-{s,n,p}] command * s: Dump whole scroll back buffer. * p: Pretty print (i.e. with escape sequences for ANSII color) * n: No line continuation * scroll back buffer. The argument if any is the command to use for * the printer pipe. */ char *s = (char*) astr; int pretty = 0, scrollback = 0, linecont = 1; if( *s && *s == '-' ) { while( *(++s) && !isspace( *s ) ) { switch( *s ) { case 's': scrollback = 1; break; case 'p': pretty = 1; break; case 'n': linecont = 0; break; default: rxvt_msg (DBG_ERROR, DBG_MACROS, "Bad option %c to macro %s", *s, macroNames[action->type] ); retval = -1; } } while( isspace(*s) ) s++; } rxvt_scr_printscreen( r, ATAB(r), scrollback, pretty, linecont, *s ? s : NULL ); break; } case MacroFnSaveConfig: { char cfile[PATH_MAX] = ""; if (NOT_NULL(astr)) STRNCPY( cfile, astr, PATH_MAX-1 ); else { char* home = getenv ("HOME"); if (IS_NULL(home)) return -1; /* Failure */ snprintf (cfile, PATH_MAX-1, "%s/%s", home, ".mrxvtrc.save"); } cfile[PATH_MAX-1] = (char) 0; /* Null terminate */ retval = rxvt_save_options (r, cfile) ? 1 : -1; break; } case MacroFnToggleMacros: TOGGLE_OPTION(r, Opt2_disableMacros); break; default: assert( action->type < sizeof( macroNames ) / sizeof( char ** ) ); rxvt_msg (DBG_ERROR, DBG_MACROS, "Support for macro type '%s' not compiled.", macroNames[action->type]); retval = -1; } return retval; } /* }}} */ /* vim: set fdm=marker: */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/left.xbm0000644000175000001440000000064710756127602012063 00000000000000#define left_width 18 #define left_height 18 static unsigned char left_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x0f, 0x00, 0xe0, 0x0f, 0x00, 0xc0, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; mrxvt-0.5.4/src/left.xpm0000644000175000001440000000077010756127602012076 00000000000000/* XPM */ static char * left_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #00086D", "..................", "..................", "..................", "............+.....", "...........++.....", "..........+++.....", ".........++++.....", "........+++++.....", ".......++++++.....", "......+++++++.....", ".......++++++.....", "........+++++.....", ".........++++.....", "..........+++.....", "...........++.....", "............+.....", "..................", ".................."}; mrxvt-0.5.4/src/term.xbm0000644000175000001440000000064710756127602012100 00000000000000#define term_width 18 #define term_height 18 static unsigned char term_bits[] = { 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0xfe, 0xff, 0x01, 0xfe, 0xff, 0x01, 0xfe, 0xff, 0x01, 0x02, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x12, 0x00, 0x01, 0x12, 0x00, 0x01, 0x0a, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x01, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00 }; mrxvt-0.5.4/src/term.xpm0000644000175000001440000000131310756127602012105 00000000000000/* XPM */ static char * term_xpm[] = { "18 18 17 1", " c None", ". c #D3D3DD s background", "+ c #000000", "@ c #1C60AB", "# c #BABABA", "$ c #C0C0C0", "% c #CBCBCB", "& c #D3D3D3", "* c #D8D8D7", "= c #DBDBDB", "- c #E4E3E3", "; c #EBEBEB", "> c #F3F3F3", ", c #E0DFDF", "' c #F8F8F7", ") c #FDFDFD", "! c #F0EFF0", "..................", ".++++++++++++++++.", ".+@@@@@@@@@@@@@@+.", ".+@@@@@@@@@@@@@@+.", ".++++++++++++++++.", ".+#########$$$$%+.", ".+#+####$$$$%%&&+.", ".+##+##$$$%&&&**+.", ".+##+$%%%&&**==-+.", ".+$+%%%&&*==--;;+.", ".+%%&&*==---;;>>+.", ".+&**=,---;>>'')+.", ".+=,---!>>>'))))+.", ".+--;!!>''))))))+.", ".+;>>>')))))))))+.", ".+>'))))))))))))+.", ".++++++++++++++++.", ".................."}; mrxvt-0.5.4/src/logging.c0000644000175000001440000003243210756127602012210 00000000000000/*--------------------------------*-C-*---------------------------------* * File: logging.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey * Copyright (c) 1993 lipka * Copyright (c) 1993 Brian Stempien * Copyright (c) 1995 Raul Garcia Garcia * Copyright (c) 1995 Piet W. Plomp * Copyright (c) 1997 Raul Garcia Garcia * Copyright (c) 1998-2001 Geoff Wing * Copyright (c) 1999 D J Hawkey Jr * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef UTMP_SUPPORT # if defined(HAVE_UPDWTMP) && defined(OS_SOLARIS) void updwtmp(char *wfile, struct utmp *utmp); # endif # if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) && defined(OS_SOLARIS) void updwtmpx(char *wfile, struct utmpx *utmp); # endif /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ #ifdef HAVE_UTMP_H # ifndef UTEMPTER_SUPPORT int rxvt_write_bsd_utmp (int utmp_pos, struct utmp* wu); # endif #endif #if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) # ifndef UTEMPTER_SUPPORT void rxvt_update_wtmp (const char *fname, const struct utmp *putmp); # endif #endif #ifdef LASTLOG_SUPPORT void rxvt_update_lastlog (const char *fname, const char *pty, const char *host); #endif /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /* * BSD style utmp entry * ut_line, ut_name, ut_host, ut_time * SYSV style utmp (and utmpx) entry * ut_user, ut_id, ut_line, ut_pid, ut_type, ut_exit, ut_time */ /* ------------------------------------------------------------------------- */ /* * make and write utmp and wtmp entries */ /* EXTPROTO */ void rxvt_makeutent(rxvt_t *r, int page, const char *pty, const char *hostname) { #ifdef UTEMPTER_SUPPORT utempter_add_record (PVTS(r, page)->cmd_fd, hostname); #else /* UTEMPTER_SUPPORT */ #ifdef HAVE_STRUCT_UTMP struct utmp *ut = &(PVTS(r, page)->ut); #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) struct utmpx *utx = &(PVTS(r, page)->utx); #endif #ifdef HAVE_UTMP_PID int i; #endif char ut_id[5]; struct passwd *pwent = getpwuid(getuid()); if (!STRNCMP(pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) { STRNCPY(ut_id, (pty + 3), sizeof(ut_id)); } #ifdef HAVE_UTMP_PID else if (sscanf(pty, "pts/%d", &i) == 1) sprintf(ut_id, "vt%02x", (i & 0xff)); /* sysv naming */ #endif else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) { rxvt_msg (DBG_ERROR, DBG_LOGGING, "can't parse tty name \"%s\"", pty); return; } #ifdef HAVE_STRUCT_UTMP MEMSET(ut, 0, sizeof(struct utmp)); # ifdef HAVE_UTMP_PID setutent(); STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id)); ut->ut_type = DEAD_PROCESS; getutid(ut); /* position to entry in utmp file */ STRNCPY(PVTS(r, page)->ut_id, ut_id, sizeof(PVTS(r, page)->ut_id)); # endif #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) MEMSET(utx, 0, sizeof(struct utmpx)); setutxent(); STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id)); utx->ut_type = DEAD_PROCESS; getutxid(utx); /* position to entry in utmp file */ STRNCPY(PVTS(r, page)->ut_id, ut_id, sizeof(PVTS(r, page)->ut_id)); #endif #ifdef HAVE_STRUCT_UTMP STRNCPY(ut->ut_line, pty, sizeof(ut->ut_line)); ut->ut_time = time(NULL); # ifdef HAVE_UTMP_PID STRNCPY(ut->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?", sizeof(ut->ut_user)); STRNCPY(ut->ut_id, ut_id, sizeof(ut->ut_id)); ut->ut_time = time(NULL); ut->ut_pid = PVTS(r, page)->cmd_pid; # ifdef HAVE_UTMP_HOST STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host)); # endif ut->ut_type = USER_PROCESS; pututline(ut); endutent(); /* close the file */ PVTS(r, page)->utmp_pos = 0; # else STRNCPY(ut->ut_name, (pwent && pwent->pw_name) ? pwent->pw_name : "?", sizeof(ut->ut_name)); # ifdef HAVE_UTMP_HOST STRNCPY(ut->ut_host, hostname, sizeof(ut->ut_host)); # endif # endif #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) STRNCPY(utx->ut_line, pty, sizeof(utx->ut_line)); STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?", sizeof(utx->ut_user)); STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id)); # ifdef HAVE_UTMPX_SESSION utx->ut_session = getsid(0); # endif utx->ut_tv.tv_sec = time(NULL); utx->ut_tv.tv_usec = 0; utx->ut_pid = PVTS(r, page)->cmd_pid; # ifdef HAVE_UTMPX_HOST STRNCPY(utx->ut_host, hostname, sizeof(utx->ut_host)); # endif utx->ut_type = USER_PROCESS; pututxline(utx); endutxent(); /* close the file */ PVTS(r, page)->utmp_pos = 0; #endif #if defined(HAVE_STRUCT_UTMP) && !defined(HAVE_UTMP_PID) { int i; # ifdef HAVE_TTYSLOT i = ttyslot(); if (rxvt_write_bsd_utmp(i, ut)) PVTS(r, page)->utmp_pos = i; # else FILE *fd0; if (NOT_NULL(fd0 = fopen(TTYTAB_FILENAME, "r"))) { char buf[256], name[256]; buf[sizeof(buf) - 1] = '\0'; for (i = 1; NOT_NULL(fgets(buf, sizeof(buf) - 1, fd0)); ) { if (*buf == '#' || sscanf(buf, "%s", name) != 1) continue; if (!STRCMP(ut->ut_line, name)) { if (!rxvt_write_bsd_utmp(i, ut)) i = 0; PVTS(r, page)->utmp_pos = i; fclose(fd0); break; } i++; } fclose(fd0); } # endif } #endif #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN if (ISSET_OPTION(r, Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UPDWTMP updwtmp(RXVT_WTMP_FILE, ut); # else rxvt_update_wtmp(RXVT_WTMP_FILE, ut); # endif # endif # if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) # ifdef HAVE_UPDWTMPX updwtmpx(RXVT_WTMPX_FILE, utx); # else pututxline (utx); # endif # endif } #endif #endif /* UTEMPTER_SUPPORT */ #if defined(LASTLOG_SUPPORT) && defined(RXVT_LASTLOG_FILE) if (ISSET_OPTION(r, Opt_loginShell)) rxvt_update_lastlog(RXVT_LASTLOG_FILE, pty, hostname); #endif } /* ------------------------------------------------------------------------- */ /* * remove utmp and wtmp entries */ /* EXTPROTO */ void rxvt_cleanutent(rxvt_t *r, int page) { #ifdef UTEMPTER_SUPPORT utempter_remove_record (PVTS(r, page)->cmd_fd); #else /* UTEMPTER_SUPPORT */ #ifdef HAVE_STRUCT_UTMP struct utmp *ut = &(PVTS(r, page)->ut); #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) struct utmpx *tmputx, *utx = &(PVTS(r, page)->utx); #endif #ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UTMP_PID MEMSET(ut, 0, sizeof(struct utmp)); setutent(); STRNCPY(ut->ut_id, PVTS(r, page)->ut_id, sizeof(ut->ut_id)); ut->ut_type = USER_PROCESS; { struct utmp *tmput = getutid(ut); if (tmput) /* position to entry in utmp file */ ut = tmput; } ut->ut_type = DEAD_PROCESS; # else MEMSET(ut->ut_name, 0, sizeof(ut->ut_name)); # ifdef HAVE_UTMP_HOST MEMSET(ut->ut_host, 0, sizeof(ut->ut_host)); # endif # endif ut->ut_time = time(NULL); #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) MEMSET(utx, 0, sizeof(struct utmpx)); setutxent(); STRNCPY(utx->ut_id, PVTS(r, page)->ut_id, sizeof(utx->ut_id)); utx->ut_type = USER_PROCESS; if ((tmputx = getutxid(utx))) /* position to entry in utmp file */ utx = tmputx; utx->ut_type = DEAD_PROCESS; # ifdef HAVE_UTMPX_SESSION utx->ut_session = getsid(0); # endif utx->ut_tv.tv_sec = time(NULL); utx->ut_tv.tv_usec = 0; #endif /* * Write ending wtmp entry */ #ifdef WTMP_SUPPORT # ifdef WTMP_ONLY_ON_LOGIN if (ISSET_OPTION(r, Opt_loginShell)) # endif { # ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UPDWTMP updwtmp(RXVT_WTMP_FILE, ut); # else rxvt_update_wtmp(RXVT_WTMP_FILE, ut); # endif # endif # if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) # ifdef HAVE_UPDWTMPX updwtmpx(RXVT_WTMPX_FILE, utx); # else pututxline (utx); # endif # endif } #endif /* * Write utmp entry */ #ifdef HAVE_STRUCT_UTMP # ifdef HAVE_UTMP_PID if (ut->ut_pid == PVTS(r, page)->cmd_pid) pututline(ut); endutent(); # else MEMSET(ut, 0, sizeof(struct utmp)); rxvt_write_bsd_utmp(PVTS(r, page)->utmp_pos, ut); # endif #endif #if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) if (utx->ut_pid == PVTS(r, page)->cmd_pid) pututxline(utx); endutxent(); #endif #endif /* UTEMPTER_SUPPORT */ } /* ------------------------------------------------------------------------- */ /* * Write a BSD style utmp entry */ #ifdef HAVE_UTMP_H # ifndef UTEMPTER_SUPPORT /* INTPROTO */ int rxvt_write_bsd_utmp(int utmp_pos, struct utmp *wu) { int fd; if (utmp_pos <= 0 || (fd = open(RXVT_UTMP_FILE, O_WRONLY)) == -1) return 0; if (lseek(fd, (off_t) (utmp_pos * sizeof(struct utmp)), SEEK_SET) != -1) write(fd, wu, sizeof(struct utmp)); close(fd); return 1; } # endif /* UTEMPTER_SUPPORT */ #endif /* ------------------------------------------------------------------------- */ /* * Update a BSD style wtmp entry */ #if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) # ifndef UTEMPTER_SUPPORT /* INTPROTO */ void rxvt_update_wtmp(const char *fname, const struct utmp *putmp) { int fd, gotlock, retry; struct flock lck; /* fcntl locking scheme */ struct stat sbuf; if ((fd = open(fname, O_WRONLY | O_APPEND, 0)) < 0) return; lck.l_whence = SEEK_END; /* start lock at current eof */ lck.l_len = 0; /* end at ``largest possible eof'' */ lck.l_start = 0; lck.l_type = F_WRLCK; /* we want a write lock */ /* attempt lock with F_SETLK; F_SETLKW would cause a deadlock! */ for (retry = 10, gotlock = 0; retry--;) { if (fcntl(fd, F_SETLK, &lck) != -1) { gotlock = 1; break; } else if (errno != EAGAIN && errno != EACCES) break; } if (!gotlock) { /* give it up */ close(fd); return; } if (fstat(fd, &sbuf) == 0) if (write(fd, putmp, sizeof(struct utmp)) != sizeof(struct utmp)) ftruncate(fd, sbuf.st_size); /* remove bad writes */ lck.l_type = F_UNLCK; /* unlocking the file */ fcntl(fd, F_SETLK, &lck); close(fd); } # endif /* UTEMPTER_SUPPORT */ #endif /* ------------------------------------------------------------------------- */ #ifdef LASTLOG_SUPPORT /* INTPROTO */ void rxvt_update_lastlog(const char *fname, const char *pty, const char *host) { # ifdef HAVE_STRUCT_LASTLOGX struct lastlogx llx; # endif # ifdef HAVE_STRUCT_LASTLOG int fd; struct lastlog ll; # ifdef LASTLOG_IS_DIR char lastlogfile[256]; # endif struct passwd *pwent; # endif # ifdef HAVE_STRUCT_LASTLOGX MEMSET(&llx, 0, sizeof(llx)); llx.ll_tv.tv_sec = time(NULL); llx.ll_tv.tv_usec = 0; STRNCPY(llx.ll_line, pty, sizeof(llx.ll_line)); STRNCPY(llx.ll_host, host, sizeof(llx.ll_host)); updlastlogx(RXVT_LASTLOGX_FILE, getuid(), &llx); # endif # ifdef HAVE_STRUCT_LASTLOG pwent = getpwuid(getuid()); if (!pwent) { rxvt_msg (DBG_ERROR, DBG_LOGGING, "no entry in password file"); return; } MEMSET(&ll, 0, sizeof(ll)); ll.ll_time = time(NULL); STRNCPY(ll.ll_line, pty, sizeof(ll.ll_line)); STRNCPY(ll.ll_host, host, sizeof(ll.ll_host)); # ifdef LASTLOG_IS_DIR sprintf(lastlogfile, "%.*s/%.*s", sizeof(lastlogfile) - sizeof(pwent->pw_name) - 2, fname, sizeof(pwent->pw_name), (!pwent->pw_name || pwent->pw_name[0] == '\0') ? "unknown" : pwent->pw_name); if ((fd = open(lastlogfile, O_WRONLY | O_CREAT, 0644)) >= 0) { write(fd, &ll, sizeof(ll)); close(fd); } # else if ((fd = open(fname, O_RDWR)) != -1) { if (lseek(fd, (off_t) ((long)pwent->pw_uid * sizeof(ll)), SEEK_SET) != -1) write(fd, &ll, sizeof(ll)); close(fd); } # endif /* LASTLOG_IS_DIR */ # endif /* HAVE_STRUCT_LASTLOG */ } #endif /* LASTLOG_SUPPORT */ /* ------------------------------------------------------------------------- */ #endif /* UTMP_SUPPORT */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/session.c0000644000175000001440000002456310756127602012253 00000000000000/*--------------------------------*-C-*---------------------------------* * File: session.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1999 Felix Bellaby * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef HAVE_X11_SM_SMLIB_H #define GnomePriority "_GSM_Priority" /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ static void callback_die (SmcConn, SmPointer); static void fetch_window_position (rxvt_t*, int*, int*); static void callback_save_yourself (SmcConn, SmPointer, int, Bool, int, Bool); static void callback_shutdown_cancelled (SmcConn, SmPointer); static void callback_save_complete (SmcConn, SmPointer); static void ice_io_error_handler (IceConn); static void ice_connection_watch (IceConn, IcePointer, Bool, IcePointer*); /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /* INTPROTO */ static void callback_die (SmcConn smc_conn, SmPointer client_data) { rxvt_t* r = rxvt_get_r (); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received die\n")); if (NULL != smc_conn) { SmcCloseConnection (smc_conn, 0, NULL); r->TermWin.sm_conn = NULL; } } /* INTPROTO */ static void fetch_window_position (rxvt_t* r, int* px, int* py) { int k; unsigned int n; Window wintree[PARENT_NUMBER]; Window root; Window* list; XWindowAttributes attr; assert (NULL != px); assert (NULL != py); /* set default position to r->TermWin.parent's position */ *px = r->szHint.x; *py = r->szHint.y; /* ** look for parent tree of top level window because the window ** manager may embed our window into some frame windows */ wintree[0] = r->TermWin.parent; for (k = 1; k < PARENT_NUMBER; k++) { XQueryTree (r->Xdisplay, wintree[k-1], &root, &(wintree[k]), &list, &n); XFree (list); if (wintree[k] == XROOT) break; } if (PARENT_NUMBER == k || 1 == k) return ; k --; XGetWindowAttributes (r->Xdisplay, wintree[k], &attr); *px = attr.x; *py = attr.y; } /* INTPROTO */ static void callback_save_yourself (SmcConn smc_conn, SmPointer client_data, int save_style, Bool shutdown, int interact_style, Bool fast) { rxvt_t* r = rxvt_get_r (); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received save_yourself\n")); if (NULL != smc_conn) { struct { SmPropValue program[1]; SmPropValue user[1]; SmPropValue hint[1]; SmPropValue priority[1]; SmPropValue restart[32]; } vals; SmProp prop[] = { {SmProgram, SmARRAY8, 1, vals.program }, {SmUserID, SmARRAY8, 1, vals.user }, {SmRestartStyleHint, SmCARD8, 1, vals.hint }, {GnomePriority, SmCARD8, 1, vals.priority}, {SmCloneCommand, SmLISTofARRAY8, 0, vals.restart }, {SmRestartCommand, SmLISTofARRAY8, 0, vals.restart }, }; SmProp* props[] = { &prop[0], &prop[1], &prop[2], &prop[3], &prop[4], &prop[5], }; char priority = 5; char restart_style = SmRestartIfRunning; struct passwd* pw = NULL; int n = 0, i; char initprof[(32+1) * MAX_PAGES]; char desktop[32 + 1]; char geometry[(32+1)*4]; int x, y; char posx[32+1], posy[32+1]; vals.program->value = (r->global_argv)[0]; vals.program->length = STRLEN(vals.program->value); #ifdef HAVE_GETPWUID pw = getpwuid (getuid()); #endif vals.user->value = pw ? pw->pw_name : ""; vals.user->length = STRLEN(vals.user->value); vals.hint->value = &restart_style; vals.hint->length = 1; vals.priority->value = &priority; vals.priority->length = 1; /* generate init profile list */ sprintf (initprof, "%d", PVTS(r, 0)->profileNum); for (i = 1; i <= LTAB(r); i ++) { char tmpbuf[64]; sprintf (tmpbuf, ",%d", PVTS(r, i)->profileNum); STRCAT (initprof, tmpbuf); } /* generate desktop number */ sprintf (desktop, "%d", (int) rxvt_get_desktop (r)); /* generate window geometry */ sprintf (geometry, "%dx%d", r->TermWin.ncol, r->TermWin.nrow); /* generate window position */ fetch_window_position (r, &x, &y); sprintf (posx, (x >= 0) ? "+%d":"%d", x); sprintf (posy, (y >= 0) ? "+%d":"%d", y); STRCAT (geometry, posx); STRCAT (geometry, posy); vals.restart[n++].value = (r->global_argv)[0]; vals.restart[n++].value = "-ip"; vals.restart[n++].value = initprof; vals.restart[n++].value = "-desktop"; vals.restart[n++].value = desktop; vals.restart[n++].value = "-geometry"; vals.restart[n++].value = geometry; #ifdef MULTICHAR_SET vals.restart[n++].value = "-km"; vals.restart[n++].value = rxvt_encoding_name (r); #endif prop[4].num_vals = n; vals.restart[n++].value = "-sm"; vals.restart[n++].value = "-sid"; vals.restart[n++].value = r->TermWin.sm_client_id; prop[5].num_vals = n; for (i = 0; i < n; i++) vals.restart[i].length = STRLEN(vals.restart[i].value); SmcSetProperties(smc_conn, sizeof(props)/sizeof(SmProp*), props); SmcSaveYourselfDone (smc_conn, 1); } } /* INTPROTO */ static void callback_shutdown_cancelled (SmcConn smc_conn, SmPointer client_data) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received shutdown_cancelled\n")); /* We are not really interested in this message. */ } /* INTPROTO */ static void callback_save_complete (SmcConn smc_conn, SmPointer client_data) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received save_complete\n")); /* We are not really interested in this message. */ } /* INTPROTO */ static void ice_io_error_handler (IceConn connection) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received ice io_error\n")); /* The less we do here the better - the default handler does an exit(1) instead of closing the losing connection. */ } /* INTPROTO */ static void ice_connection_watch (IceConn connection, IcePointer client_data, Bool opening, IcePointer* watch_data) { rxvt_t* r = rxvt_get_r (); if (opening) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: new ice connection\n")); r->TermWin.ice_conn = connection; r->TermWin.ice_fd = IceConnectionNumber(connection); /* Make sure ice_fd is not passed to child */ if (-1 != r->TermWin.ice_fd) fcntl(r->TermWin.ice_fd, F_SETFD, FD_CLOEXEC); } else { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: close ice connection\n")); r->TermWin.ice_conn = NULL; r->TermWin.ice_fd = -1; } } /* EXTPROTO */ void rxvt_process_ice_msgs (rxvt_t* r) { IceProcessMessagesStatus status; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: received ice msgs\n")); assert (NULL != r->TermWin.ice_conn); assert (NULL != r->TermWin.sm_conn); status = IceProcessMessages(r->TermWin.ice_conn, NULL, NULL); if (status == IceProcessMessagesIOError) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: ICE IO error\n")); IceSetShutdownNegotiation (r->TermWin.ice_conn, False); IceCloseConnection (r->TermWin.ice_conn); } } /* EXTPROTO */ void rxvt_session_init (rxvt_t* r) { SmcCallbacks callbacks; char error_string_ret[4096] = ""; char* client_id = NULL; char* prev_client_id; rxvt_msg (DBG_INFO, DBG_SESSION, "SessionMgr: init\n"); if (NULL != r->TermWin.sm_conn) { rxvt_msg (DBG_INFO, DBG_SESSION, "SessionMgr: duplicate session init\n"); return ; } if (NULL == getenv("SESSION_MANAGER")) { rxvt_msg (DBG_INFO, DBG_SESSION, "SessionMgr: session manager is not running\n"); return ; } /* Initialize ice handler */ IceSetIOErrorHandler (ice_io_error_handler); IceAddConnectionWatch (ice_connection_watch, NULL); /* Initialize callbacks */ callbacks.save_yourself.callback = callback_save_yourself; callbacks.die.callback = callback_die; callbacks.save_complete.callback = callback_save_complete; callbacks.shutdown_cancelled.callback = callback_shutdown_cancelled; callbacks.save_yourself.client_data = callbacks.die.client_data = callbacks.save_complete.client_data = callbacks.shutdown_cancelled.client_data = (SmPointer) NULL; /* previous client id must be NULL if it is not specified */ prev_client_id = (char*) r->h->rs[Rs_smClientID]; r->TermWin.sm_conn = SmcOpenConnection(NULL, NULL, SmProtoMajor, SmProtoMinor, SmcSaveYourselfProcMask | SmcSaveCompleteProcMask | SmcDieProcMask | SmcShutdownCancelledProcMask, &callbacks, prev_client_id, &client_id, sizeof(error_string_ret), error_string_ret); if (NULL == r->TermWin.sm_conn) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SESSION, "SessionMgr: connection failed with error %s\n", error_string_ret)); return ; } if (NULL == client_id) { /* well, prev_client_id shouldn't be NULL */ r->TermWin.sm_client_id = STRDUP (prev_client_id); } else { r->TermWin.sm_client_id = STRDUP (client_id); rxvt_free (client_id); } } /* EXTPROTO */ void rxvt_session_exit (rxvt_t* r) { rxvt_msg (DBG_INFO, DBG_SESSION, "SessionMgr: exit\n"); if (NULL == r->TermWin.sm_conn) return ; SmcCloseConnection (r->TermWin.sm_conn, 0, NULL); r->TermWin.sm_conn = NULL; } #endif /* HAVE_X11_SM_SMLIB_H */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/netdisp.c0000644000175000001440000000612010756127602012223 00000000000000/*--------------------------------*-C-*---------------------------------* * File: netdisp.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1996 Chuck Blake * Copyright (c) 1996 mj olesen * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef DISPLAY_IS_IP /*----------------------------------------------------------------------*/ /* return NULL a pointer to buffer which may be freed */ /* EXTPROTO */ char* rxvt_network_display (const char *display) { char buffer[1024], *rval = NULL; struct ifconf ifc; struct ifreq *ifr; int i, skfd; if (display[0] != ':' && STRNCMP(display, "unix:", 5)) return (char *) display; /* nothing to do */ ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */ ifc.ifc_buf = buffer; if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { perror("socket"); return NULL; } if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) { perror("SIOCGIFCONF"); close(skfd); return NULL; } for (i = 0, ifr = ifc.ifc_req; i < (ifc.ifc_len / sizeof(struct ifreq)); i++, ifr++) { struct ifreq ifr2; STRCPY(ifr2.ifr_name, ifr->ifr_name); if (ioctl(skfd, SIOCGIFADDR, &ifr2) >= 0) { uint32_t addr; struct sockaddr_in* p_addr; p_addr = (struct sockaddr_in *)&(ifr2.ifr_addr); addr = htonl((uint32_t)p_addr->sin_addr.s_addr); /* * not "0.0.0.0" or "127.0.0.1" - so format the address */ if (addr && addr != 0x7F000001) { int l; char* colon = STRCHR(display, ':'); if (IS_NULL(colon)) colon = ":0.0"; /* possible integer overflow */ l = 16 + STRLEN(colon); if (l <= 0 || l > 1024) l = 1024; rval = rxvt_malloc(l); snprintf(rval, "%d.%d.%d.%d%s", l-1 (int)((addr >> 030) & 0xFF), (int)((addr >> 020) & 0xFF), (int)((addr >> 010) & 0xFF), (int)(addr & 0xFF), colon); rval[l-1] = (char) 0; break; } } } close(skfd); return rval; } #endif /* DISPLAY_IS_IP */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/term_d.xpm0000644000175000001440000000131510756127602012412 00000000000000/* XPM */ static char * term_d_xpm[] = { "18 18 17 1", " c None", ". c #D3D3DD s background", "+ c #9B9797", "@ c #7676FD", "# c #BABABA", "$ c #C0C0C0", "% c #CBCBCB", "& c #D3D3D3", "* c #D8D8D7", "= c #DBDBDB", "- c #E4E3E3", "; c #EBEBEB", "> c #F3F3F3", ", c #E0DFDF", "' c #F8F8F7", ") c #FDFDFD", "! c #F0EFF0", "..................", ".++++++++++++++++.", ".+@@@@@@@@@@@@@@+.", ".+@@@@@@@@@@@@@@+.", ".++++++++++++++++.", ".+#########$$$$%+.", ".+#+####$$$$%%&&+.", ".+##+##$$$%&&&**+.", ".+##+$%%%&&**==-+.", ".+$+%%%&&*==--;;+.", ".+%%&&*==---;;>>+.", ".+&**=,---;>>'')+.", ".+=,---!>>>'))))+.", ".+--;!!>''))))))+.", ".+;>>>')))))))))+.", ".+>'))))))))))))+.", ".++++++++++++++++.", ".................."}; mrxvt-0.5.4/src/screen.c0000644000175000001440000047370611023632753012052 00000000000000/*--------------------------------*-C-*---------------------------------* * File: screen.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (C) 2000,2001 Teepanis Chachiyo * Copyright (c) 2001 Marius Gedminas * Copyright (c) 2003 David Hull * Copyright (c) 2003 Yamanobe Kiichiro * Copyright (c) 2003 Mamoru Komachi * Copyright (c) 2005 William P. Y. Hadisoeseno * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * Copyright (c) 2007 Jehan Hysseo * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #define INTERN_SCREEN #include "rxvt.h" #ifdef XFT_SUPPORT # include #endif #ifdef HAVE_WORDEXP_H # include #endif /* ------------------------------------------------------------------------- */ #ifdef MULTICHAR_SET #define RESET_CHSTAT(R, P) \ if (PVTS((R),(P))->chstat == WBYTE) \ PVTS((R),(P))->chstat = SBYTE, PVTS((R),(P))->lost_multi = 1 #else # define RESET_CHSTAT(R, P) #endif /* ------------------------------------------------------------------------- */ #define PROP_SIZE 16384 /* ------------------------------------------------------------------------- * * GENERAL SCREEN AND SELECTION UPDATE ROUTINES * * ------------------------------------------------------------------------- */ /* ** If inhibit scrolling on tty output, we should keep the view_start. ** Otherwise, we set it to zero. */ #define ZERO_SCROLLBACK(R, P) \ if (NOTSET_OPTION(R, Opt_scrollTtyOutputInhibit)) \ (R)->vts[(P)]->view_start = 0 #define CLEAR_SELECTION(R) \ (R)->selection.beg.row = \ (R)->selection.beg.col = \ (R)->selection.end.row = \ (R)->selection.end.col = 0 #define CLEAR_ALL_SELECTION(R) \ (R)->selection.beg.row = \ (R)->selection.beg.col = \ (R)->selection.mark.row = \ (R)->selection.mark.col = \ (R)->selection.end.row = \ (R)->selection.end.col = 0 #define ROW_AND_COL_IS_AFTER(A, B, C, D) \ (((A) > (C)) || (((A) == (C)) && ((B) > (D)))) #define ROW_AND_COL_IS_BEFORE(A, B, C, D) \ (((A) < (C)) || (((A) == (C)) && ((B) < (D)))) #define ROW_AND_COL_IN_ROW_AFTER(A, B, C, D) \ (((A) == (C)) && ((B) > (D))) #define ROW_AND_COL_IN_ROW_AT_OR_AFTER(A, B, C, D) \ (((A) == (C)) && ((B) >= (D))) #define ROW_AND_COL_IN_ROW_BEFORE(A, B, C, D) \ (((A) == (C)) && ((B) < (D))) #define ROW_AND_COL_IN_ROW_AT_OR_BEFORE(A, B, C, D) \ (((A) == (C)) && ((B) <= (D))) /* these must be row_col_t */ #define RC_AFTER(X, Y) \ ROW_AND_COL_IS_AFTER((X).row, (X).col, (Y).row, (Y).col) #define RC_BEFORE(X, Y) \ ROW_AND_COL_IS_BEFORE((X).row, (X).col, (Y).row, (Y).col) #define RC_ROW_AFTER(X, Y) \ ROW_AND_COL_IN_ROW_AFTER((X).row, (X).col, (Y).row, (Y).col) #define RC_ROW_BEFORE(X, Y) \ ROW_AND_COL_IN_ROW_BEFORE((X).row, (X).col, (Y).row, (Y).col) #define RC_ROW_ATAFTER(X, Y) \ ROW_AND_COL_IN_ROW_AT_OR_AFTER((X).row, (X).col, (Y).row, (Y).col) #define RC_ROW_ATBEFORE(X, Y) \ ROW_AND_COL_IN_ROW_AT_OR_BEFORE((X).row, (X).col, (Y).row, (Y).col) /* * CLEAR_ROWS : clear rows starting from row * CLEAR_CHARS: clear chars starting from pixel position * ERASE_ROWS : set rows starting from row to the foreground colour */ #define drawBuffer (PVTS(r, page)->vt) #define CLEAR_ROWS(row, num) \ if (r->TermWin.mapped) \ rxvt_clear_area (r, page, \ r->TermWin.int_bwidth, Row2Pixel(row), \ VT_WIDTH(r), (unsigned int)Height2Pixel(num)) /* * If already_cleared, then we got here during a clipped refresh. In this case, * areas we draw into are already cleared by the server. We don't need to clear * it ourself. (Doing so will cause problems under transparency: E.g. We want to * clear an entire character cell, but an expose event was generated for only * half the character cell. By our wonderful clippings, we redraw only half the * char cell. However requests to this function will clear an ENTIRE char cell, * causing problems. * * If garbage is found due to clipped refreshes, then we should explicitly call * XClearArea before generating a clipped refresh. */ #define CLEAR_CHARS(r, page, already_cleared, x, y, num) \ if( !already_cleared ) \ rxvt_clear_area( (r), (page), (x), (y), \ (unsigned) Width2Pixel((num)), \ (unsigned) Height2Pixel(1)); #define ERASE_ROWS(row, num) \ rxvt_fill_rectangle (r, page, \ r->TermWin.int_bwidth, Row2Pixel(row), \ VT_WIDTH(r), (unsigned int)Height2Pixel(num)) #ifdef DONT_SELECT_TRAILING_SPACES # define STRIP_TRAILING_SPACE(str, fence) \ while (str > fence && ' ' == str[-1]) \ str --; #endif /* Here are some simple macros for convenience */ #undef CURROW #undef CURCOL #undef SVLINES #undef VSTART #define CURROW (PSCR(r, page).cur.row) #define CURCOL (PSCR(r, page).cur.col) #define SVLINES (PVTS(r, page)->saveLines) #define VSTART (PVTS(r, page)->view_start) /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ void rxvt_blank_line (text_t*, rend_t*, unsigned int, rend_t); void rxvt_blank_screen_mem (rxvt_t*, int, text_t**, rend_t **, unsigned int, rend_t); void rxvt_scr_reset_realloc (rxvt_t*, int); void rxvt_scr_delete_row (rxvt_t*, int); void rxvt_scr_add_row (rxvt_t*, int, unsigned int, unsigned int); void static inline rxvt_clear_area (rxvt_t*, int page, int x, int y, unsigned int w, unsigned int h); void static inline rxvt_fill_rectangle (rxvt_t*, int page, int x, int y, unsigned int w, unsigned int h); void rxvt_scr_draw_string (rxvt_t* r, int page, int x, int y, char* str, int len, int drawfunc, uint16_t fore, uint16_t back, __attribute__((unused)) rend_t rend, Region refreshRegion); void rxvt_scr_adjust_col (rxvt_t*, int, unsigned int); void rxvt_set_font_style (rxvt_t*, int); int rxvt_scr_change_view (rxvt_t*, int, uint16_t); void rxvt_scr_reverse_selection (rxvt_t*, int); void rxvt_paste_str (rxvt_t*, int, const unsigned char*, unsigned int); int rxvt_selection_request_other (rxvt_t*, int, Atom, int); void rxvt_selection_start_colrow (rxvt_t*, int, int, int); void rxvt_selection_delimit_word (rxvt_t*, int, enum page_dirn, const row_col_t*, row_col_t*); #ifdef MULTICHAR_SET void rxvt_selection_adjust_kanji (rxvt_t*, int); #endif void rxvt_selection_extend_colrow (rxvt_t*, int, int32_t, int32_t, int, int, int); #ifndef NO_FRILLS void rxvt_selection_trim (rxvt_t*, int); #endif #ifdef TEXT_SHADOW # ifdef XFT_SUPPORT void rxvt_set_clipping (rxvt_t*, XftDraw*, GC, Region, int, int, unsigned, unsigned, int*, int*); void rxvt_free_clipping (rxvt_t*, XftDraw*, GC, Region); # else void rxvt_set_clipping (rxvt_t*, __attribute__((unused)) void*, GC, Region, int, int, unsigned, unsigned, int*, int*); void rxvt_free_clipping (rxvt_t*, __attribute__((unused)) void*, GC, Region); # endif #endif #ifdef XFT_SUPPORT #endif /* XFT_SUPPORT */ /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /* ------------------------------------------------------------------------- * * SCREEN `COMMON' ROUTINES * * ------------------------------------------------------------------------- */ /* Fill part/all of a line with blanks. */ /* INTPROTO */ void rxvt_blank_line(text_t *et, rend_t *er, unsigned int width, rend_t efs) { MEMSET(et, ' ', (size_t)width); efs &= ~RS_baseattrMask; for (; width--;) *er++ = efs; } /* ------------------------------------------------------------------------- */ /* Fill a full line with blanks - make sure it is allocated first */ /* INTPROTO */ void rxvt_blank_screen_mem(rxvt_t* r, int page, text_t **tp, rend_t **rp, unsigned int row, rend_t efs) { int width = r->TermWin.ncol; rend_t *er; assert ((tp[row] && rp[row]) || (tp[row] == NULL && rp[row] == NULL)); /* possible integer overflow? */ assert (width > 0); assert (sizeof (text_t) * width > 0); assert (sizeof (rend_t) * width > 0); if (tp[row] == NULL) { tp[row] = rxvt_malloc(sizeof(text_t) * width); rp[row] = rxvt_malloc(sizeof(rend_t) * width); } MEMSET(tp[row], ' ', width); efs &= ~RS_baseattrMask; for (er = rp[row]; width--;) *er++ = efs; } /* ------------------------------------------------------------------------- * * SCREEN INITIALISATION * * ------------------------------------------------------------------------- */ /* EXTPROTO */ void rxvt_init_screen (rxvt_t* r) { int p; int ncol = r->TermWin.ncol; /* first time, we don't have r->tabstop yet */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "allocate r->tabstop as %d\n", ncol)); assert (ncol > 0); /* possible integer overflow? */ r->tabstop = rxvt_malloc(ncol * sizeof(char)); for (p = 0; p < ncol; p++) r->tabstop[p] = (p % TABSTOP_SIZE == 0) ? 1 : 0; } void rxvt_scr_alloc (rxvt_t* r, int page) { unsigned int ncol, nrow, total_rows; unsigned int p, q; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_alloc %d ()\n", page)); ncol = r->TermWin.ncol; nrow = r->TermWin.nrow; total_rows = nrow + SVLINES; /* ** First time called so just malloc everything : don't rely on ** realloc ** Note: this is still needed so that all the scrollback lines ** are NULL */ PVTS(r, page)->buf_text = rxvt_calloc(total_rows, sizeof(text_t*)); PVTS(r, page)->buf_rend = rxvt_calloc(total_rows, sizeof(rend_t*)); PVTS(r, page)->drawn_text = rxvt_calloc(nrow, sizeof(text_t*)); PVTS(r, page)->drawn_rend = rxvt_calloc(nrow, sizeof(rend_t*)); PSCR(r, page).text = rxvt_calloc(total_rows, sizeof(text_t*)); PSCR(r, page).tlen = rxvt_calloc(total_rows, sizeof(int16_t)); PSCR(r, page).rend = rxvt_calloc(total_rows, sizeof(rend_t*)); #if NSCREENS PVTS(r, page)->swap.text = rxvt_calloc(nrow, sizeof(text_t*)); PVTS(r, page)->swap.tlen = rxvt_calloc(nrow, sizeof(int16_t)); PVTS(r, page)->swap.rend = rxvt_calloc(nrow, sizeof(rend_t*)); #endif for (p = 0; p < nrow; p++) { q = p + SVLINES; rxvt_blank_screen_mem (r, page, PSCR(r, page).text, PSCR(r, page).rend, q, DEFAULT_RSTYLE); PSCR(r, page).tlen[q] = 0; #if NSCREENS rxvt_blank_screen_mem (r, page, PVTS(r, page)->swap.text, PVTS(r, page)->swap.rend, p, DEFAULT_RSTYLE); PVTS(r, page)->swap.tlen[p] = 0; #endif rxvt_blank_screen_mem (r, page, PVTS(r, page)->drawn_text, PVTS(r, page)->drawn_rend, p, DEFAULT_RSTYLE); } PVTS(r, page)->nscrolled = 0; /* no saved lines */ PSCR(r, page).flags = Screen_DefaultFlags; PSCR(r, page).cur.row = 0; PSCR(r, page).cur.col = 0; PSCR(r, page).charset = 0; PVTS(r, page)->current_screen = PRIMARY; rxvt_scr_cursor(r, page, SAVE); #if NSCREENS PVTS(r, page)->swap.flags = Screen_DefaultFlags; PVTS(r, page)->swap.cur.row = 0; PVTS(r, page)->swap.cur.col = 0; PVTS(r, page)->swap.charset = 0; PVTS(r, page)->current_screen = SECONDARY; rxvt_scr_cursor(r, page, SAVE); PVTS(r, page)->current_screen = PRIMARY; #endif PVTS(r, page)->rstyle = DEFAULT_RSTYLE; PVTS(r, page)->rvideo = 0; MEMSET(&(PVTS(r, page)->charsets), 'B', sizeof(PVTS(r, page)->charsets)); #ifdef MULTICHAR_SET PVTS(r, page)->multi_byte = 0; PVTS(r, page)->lost_multi = 0; PVTS(r, page)->chstat = SBYTE; #endif /* Now set screen initialization flag */ PVTS(r, page)->init_screen = 1; } /* INTPROTO */ void rxvt_scr_reset_realloc(rxvt_t* r, int page) { unsigned int total_rows, nrow; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_reset_realloc %d ()\n", page)); nrow = r->TermWin.nrow; total_rows = nrow + SVLINES; PSCR(r, page).text = rxvt_realloc ( PSCR(r, page).text, total_rows * sizeof(text_t *)); PSCR(r, page).tlen = rxvt_realloc ( PSCR(r, page).tlen, total_rows * sizeof(int16_t)); PSCR(r, page).rend = rxvt_realloc ( PSCR(r, page).rend, total_rows * sizeof(rend_t *)); #if NSCREENS PVTS(r, page)->swap.text = rxvt_realloc ( PVTS(r, page)->swap.text, nrow * sizeof(text_t *)); PVTS(r, page)->swap.tlen = rxvt_realloc ( PVTS(r, page)->swap.tlen , total_rows * sizeof(int16_t)); PVTS(r, page)->swap.rend = rxvt_realloc ( PVTS(r, page)->swap.rend, nrow * sizeof(rend_t *)); #endif PVTS(r, page)->buf_text = rxvt_realloc ( PVTS(r, page)->buf_text, total_rows * sizeof(text_t *)); PVTS(r, page)->buf_rend = rxvt_realloc ( PVTS(r, page)->buf_rend, total_rows * sizeof(rend_t *)); PVTS(r, page)->drawn_text = rxvt_realloc ( PVTS(r, page)->drawn_text, nrow * sizeof(text_t *)); PVTS(r, page)->drawn_rend = rxvt_realloc ( PVTS(r, page)->drawn_rend, nrow * sizeof(rend_t *)); } /* INTPROTO */ void rxvt_scr_delete_row (rxvt_t* r, int page) { unsigned int nrow, prev_nrow; unsigned int p, q; register int i; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_delete_row %d ()\n", page)); nrow = r->TermWin.nrow; prev_nrow = PVTS(r, page)->prev_nrow; /* delete rows */ i = min(PVTS(r, page)->nscrolled, prev_nrow - nrow); rxvt_scroll_text(r, page, 0, (int)prev_nrow - 1, i, 1); for (p = nrow; p < prev_nrow; p++) { q = p + SVLINES; if (PSCR(r, page).text[q]) { assert(PSCR(r, page).rend[q]); rxvt_free(PSCR(r, page).text[q]); PSCR(r, page).text[q] = NULL; rxvt_free(PSCR(r, page).rend[q]); PSCR(r, page).rend[q] = NULL; } #if NSCREENS if (PVTS(r, page)->swap.text[p]) { assert(PVTS(r, page)->swap.rend[p]); rxvt_free(PVTS(r, page)->swap.text[p]); PVTS(r, page)->swap.text[p] = NULL; rxvt_free(PVTS(r, page)->swap.rend[p]); PVTS(r, page)->swap.rend[p] = NULL; } #endif assert (PVTS(r, page)->drawn_text[p]); assert (PVTS(r, page)->drawn_rend[p]); rxvt_free(PVTS(r, page)->drawn_text[p]); PVTS(r, page)->drawn_text[p] = NULL; rxvt_free(PVTS(r, page)->drawn_rend[p]); PVTS(r, page)->drawn_rend[p] = NULL; } /* we have fewer rows so fix up cursor position */ MIN_IT(PSCR(r, page).cur.row, (int32_t)nrow - 1); #if NSCREENS MIN_IT(PVTS(r, page)->swap.cur.row, (int32_t)nrow - 1); #endif rxvt_scr_reset_realloc (r, page); /* realloc _last_ */ } /* INTPROTO */ void rxvt_scr_add_row (rxvt_t* r, int page, unsigned int total_rows, unsigned int prev_total_rows) { unsigned int nrow, prev_nrow; unsigned int p; register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "%s( page=%d, total_rows=%u, prev_total_rows=%u )\n", __func__, page, total_rows, prev_total_rows )); nrow = r->TermWin.nrow; prev_nrow = PVTS(r, page)->prev_nrow; /* add rows */ rxvt_scr_reset_realloc(r, page); /* realloc _first_ */ i = min(PVTS(r, page)->nscrolled, nrow - prev_nrow); for (p = prev_total_rows; p < total_rows; p++) { PSCR(r, page).tlen[p] = 0; PSCR(r, page).text[p] = NULL; PSCR(r, page).rend[p] = NULL; } for (p = prev_total_rows; p < total_rows - i; p++) rxvt_blank_screen_mem (r, page, PSCR(r, page).text, PSCR(r, page).rend, p, DEFAULT_RSTYLE); for (p = prev_nrow; p < nrow; p++) { #if NSCREENS PVTS(r, page)->swap.tlen[p] = 0; PVTS(r, page)->swap.text[p] = NULL; PVTS(r, page)->swap.rend[p] = NULL; rxvt_blank_screen_mem (r, page, PVTS(r, page)->swap.text, PVTS(r, page)->swap.rend, p, DEFAULT_RSTYLE); #endif PVTS(r, page)->drawn_text[p] = NULL; PVTS(r, page)->drawn_rend[p] = NULL; rxvt_blank_screen_mem (r, page, PVTS(r, page)->drawn_text, PVTS(r, page)->drawn_rend, p, DEFAULT_RSTYLE); } if (i > 0) { rxvt_scroll_text(r, page, 0, (int)nrow - 1, -i, 1); PSCR(r, page).cur.row += i; PSCR(r, page).s_cur.row += i; PVTS(r, page)->nscrolled -= i; } assert(PSCR(r, page).cur.row < r->TermWin.nrow); MIN_IT(PSCR(r, page).cur.row, nrow - 1); #if NSCREENS assert(PVTS(r, page)->swap.cur.row < r->TermWin.nrow); MIN_IT(PVTS(r, page)->swap.cur.row, nrow - 1); #endif } /* INTPROTO */ void rxvt_scr_adjust_col (rxvt_t* r, int page, unsigned int total_rows) { unsigned int nrow, ncol, prev_ncol; unsigned int p; nrow = r->TermWin.nrow; ncol = r->TermWin.ncol; prev_ncol = PVTS(r, page)->prev_ncol; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "%s( r, page=%d, total_rows=%u ):" "ncol=%d, prev_ncol=%d, nrow=%d\n", __func__, page, total_rows, ncol, prev_ncol, nrow )); for (p = 0; p < total_rows; p++) { if (PSCR(r, page).text[p]) { PSCR(r, page).text[p] = rxvt_realloc ( PSCR(r, page).text[p], ncol * sizeof(text_t)); PSCR(r, page).rend[p] = rxvt_realloc ( PSCR(r, page).rend[p], ncol * sizeof(rend_t)); MIN_IT(PSCR(r, page).tlen[p], (int16_t)ncol); if (ncol > prev_ncol) rxvt_blank_line ( &(PSCR(r, page).text[p][prev_ncol]), &(PSCR(r, page).rend[p][prev_ncol]), ncol - prev_ncol, DEFAULT_RSTYLE); } } for (p = 0; p < nrow; p++) { PVTS(r, page)->drawn_text[p] = rxvt_realloc ( PVTS(r, page)->drawn_text[p], ncol * sizeof(text_t)); PVTS(r, page)->drawn_rend[p] = rxvt_realloc ( PVTS(r, page)->drawn_rend[p], ncol * sizeof(rend_t)); #if NSCREENS if (PVTS(r, page)->swap.text[p]) { PVTS(r, page)->swap.text[p] = rxvt_realloc ( PVTS(r, page)->swap.text[p], ncol * sizeof(text_t)); PVTS(r, page)->swap.rend[p] = rxvt_realloc ( PVTS(r, page)->swap.rend[p], ncol * sizeof(rend_t)); MIN_IT(PVTS(r, page)->swap.tlen[p], (int16_t)ncol); if (ncol > prev_ncol) rxvt_blank_line( &(PVTS(r, page)->swap.text[p][prev_ncol]), &(PVTS(r, page)->swap.rend[p][prev_ncol]), ncol - prev_ncol, DEFAULT_RSTYLE); } #endif if (ncol > prev_ncol) rxvt_blank_line( &(PVTS(r, page)->drawn_text[p][prev_ncol]), &(PVTS(r, page)->drawn_rend[p][prev_ncol]), ncol - prev_ncol, DEFAULT_RSTYLE); } MIN_IT(PSCR(r, page).cur.col, (int16_t)ncol - 1); #if NSCREENS MIN_IT(PVTS(r, page)->swap.cur.col, (int16_t)ncol - 1); #endif /* ** Only reset tabstop if expanding columns, save realloc in ** shrinking columns */ if (r->tabstop && ncol > prev_ncol) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "expand r->tabstop to %d\n", ncol)); r->tabstop = rxvt_realloc(r->tabstop, ncol * sizeof(char)); for (p = prev_ncol; p < ncol; p++) r->tabstop[p] = (p % TABSTOP_SIZE == 0) ? 1 : 0; } } /* EXTPROTO */ void rxvt_scr_reset(rxvt_t* r, int page) { unsigned int ncol, nrow, prev_ncol, prev_nrow, total_rows, prev_total_rows; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_reset %d ()\n", page)); VSTART = 0; RESET_CHSTAT(r, page); PVTS(r, page)->num_scr = 0; /* number of lines scrolled */ prev_ncol = PVTS(r, page)->prev_ncol; prev_nrow = PVTS(r, page)->prev_nrow; if (r->TermWin.ncol == 0) r->TermWin.ncol = 80; if (r->TermWin.nrow == 0) r->TermWin.nrow = 24; ncol = r->TermWin.ncol; nrow = r->TermWin.nrow; if (PVTS(r, page)->init_screen && ncol == prev_ncol && nrow == prev_nrow) return; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_reset %d () refresh screen\n", page)); PVTS(r, page)->want_refresh = 1; total_rows = nrow + SVLINES; prev_total_rows = prev_nrow + SVLINES; PSCR(r, page).tscroll = 0; PSCR(r, page).bscroll = nrow - 1; if (PVTS(r, page)->init_screen == 0) { /* Initialize the screen structures */ rxvt_scr_alloc (r, page); } else { /* B1: resize rows */ if (nrow < prev_nrow) { rxvt_scr_delete_row (r, page); } else if (nrow > prev_nrow) { rxvt_scr_add_row (r, page, total_rows, prev_total_rows); } /* B2: resize columns */ if (ncol != prev_ncol) { rxvt_scr_adjust_col (r, page, total_rows); } } PVTS(r, page)->prev_nrow = nrow; PVTS(r, page)->prev_ncol = ncol; rxvt_tt_winsize(PVTS(r, page)->cmd_fd, r->TermWin.ncol, r->TermWin.nrow, PVTS(r, page)->cmd_pid); } /* ------------------------------------------------------------------------- */ /* * Free everything. That way malloc debugging can find leakage. */ /* EXTPROTO */ void rxvt_scr_release(rxvt_t* r, int page) { unsigned int total_rows; int i; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_release %d ()\n", page)); total_rows = r->TermWin.nrow + SVLINES; for (i = 0; i < total_rows; i++) { if (PSCR(r, page).text[i]) { /* then so is PSCR(r, page).rend[i] */ rxvt_free(PSCR(r, page).text[i]); PSCR(r, page).text[i] = NULL; assert(PSCR(r, page).rend[i]); rxvt_free(PSCR(r, page).rend[i]); PSCR(r, page).rend[i] = NULL; } } for (i = 0; i < r->TermWin.nrow; i++) { /* if (PVTS(r, page)->drawn_text[i]) */ rxvt_free(PVTS(r, page)->drawn_text[i]); PVTS(r, page)->drawn_text[i] = NULL; /* if (PVTS(r, page)->drawn_rend[i]) */ rxvt_free(PVTS(r, page)->drawn_rend[i]); PVTS(r, page)->drawn_rend[i] = NULL; #if NSCREENS /* if (PVTS(r, page)->swap.text[i]) */ rxvt_free(PVTS(r, page)->swap.text[i]); PVTS(r, page)->swap.text[i] = NULL; /* if (PVTS(r, page)->swap.rend[i])) */ rxvt_free(PVTS(r, page)->swap.rend[i]); PVTS(r, page)->swap.rend[i] = NULL; #endif } rxvt_free(PSCR(r, page).text); PSCR(r, page).text = NULL; rxvt_free(PSCR(r, page).tlen); PSCR(r, page).tlen = NULL; rxvt_free(PSCR(r, page).rend); PSCR(r, page).rend = NULL; rxvt_free(PVTS(r, page)->drawn_text); PVTS(r, page)->drawn_text = NULL; rxvt_free(PVTS(r, page)->drawn_rend); PVTS(r, page)->drawn_rend = NULL; #if NSCREENS rxvt_free(PVTS(r, page)->swap.text); PVTS(r, page)->swap.text = NULL; rxvt_free(PVTS(r, page)->swap.tlen); PVTS(r, page)->swap.tlen = NULL; rxvt_free(PVTS(r, page)->swap.rend); PVTS(r, page)->swap.rend = NULL; #endif rxvt_free(PVTS(r, page)->buf_text); PVTS(r, page)->buf_text = NULL; rxvt_free(PVTS(r, page)->buf_rend); PVTS(r, page)->buf_rend = NULL; /* next rxvt_scr_reset will be the first time initialization */ PVTS(r, page)->init_screen = 0; /* clear selection if necessary */ if (page == r->selection.vt) { rxvt_process_selectionclear (r, page); } } /* ------------------------------------------------------------------------- */ /* * Hard reset */ /* EXTPROTO */ void rxvt_scr_poweron(rxvt_t* r, int page) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_poweron %d ()\n", page)); rxvt_scr_release(r, page); PVTS(r, page)->prev_nrow = PVTS(r, page)->prev_ncol = 0; rxvt_scr_reset(r, page); rxvt_scr_clear(r, page); rxvt_scr_refresh(r, page, SLOW_REFRESH); } /* ------------------------------------------------------------------------- * * PROCESS SCREEN COMMANDS * * ------------------------------------------------------------------------- */ /* * Save and Restore cursor * XTERM_SEQ: Save cursor : ESC 7 * XTERM_SEQ: Restore cursor: ESC 8 */ /* EXTPROTO */ void rxvt_scr_cursor(rxvt_t* r, int page, int mode) { screen_t *s; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_cursor %d (%c)\n", page, mode)); #if NSCREENS && !defined(NO_SECONDARY_SCREEN_CURSOR) if (PVTS(r, page)->current_screen == SECONDARY) s = &(PVTS(r, page)->swap); else #endif s = &(PSCR(r, page)); switch (mode) { case SAVE: s->s_cur.row = s->cur.row; s->s_cur.col = s->cur.col; s->s_rstyle = PVTS(r, page)->rstyle; s->s_charset = s->charset; s->s_charset_char = PVTS(r, page)->charsets[s->charset]; break; case RESTORE: PVTS(r, page)->want_refresh = 1; s->cur.row = s->s_cur.row; s->cur.col = s->s_cur.col; s->flags &= ~Screen_WrapNext; PVTS(r, page)->rstyle = s->s_rstyle; s->charset = s->s_charset; PVTS(r, page)->charsets[s->charset] = s->s_charset_char; rxvt_set_font_style(r, page); break; } /* boundary check in case screen size changed between SAVE and RESTORE */ MIN_IT(s->cur.row, r->TermWin.nrow - 1); MIN_IT(s->cur.col, r->TermWin.ncol - 1); assert(s->cur.row >= 0); assert(s->cur.col >= 0); MAX_IT(s->cur.row, 0); MAX_IT(s->cur.col, 0); } /* ------------------------------------------------------------------------- */ /* * Swap between primary and secondary screens * XTERM_SEQ: Primary screen : ESC [ ? 4 7 h * XTERM_SEQ: Secondary screen: ESC [ ? 4 7 l */ /* EXTPROTO */ int rxvt_scr_change_screen(rxvt_t* r, int page, int scrn) { #if NSCREENS unsigned int i, offset; #endif PVTS(r, page)->want_refresh = 1; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_change_screen %d (%d)\n", page, scrn)); VSTART = 0; RESET_CHSTAT(r, page); if (PVTS(r, page)->current_screen == scrn) return PVTS(r, page)->current_screen; rxvt_selection_check(r, page, 2); /* check for boundary cross */ SWAP_IT(PVTS(r, page)->current_screen, scrn, int); #if NSCREENS PVTS(r, page)->num_scr = 0; offset = SVLINES; for (i = PVTS(r, page)->prev_nrow; i--;) { SWAP_IT(PSCR(r, page).text[i + offset], PVTS(r, page)->swap.text[i], text_t *); SWAP_IT(PSCR(r, page).tlen[i + offset], PVTS(r, page)->swap.tlen[i], int16_t); SWAP_IT(PSCR(r, page).rend[i + offset], PVTS(r, page)->swap.rend[i], rend_t *); } SWAP_IT(CURROW, PVTS(r, page)->swap.cur.row, int16_t); SWAP_IT(CURCOL, PVTS(r, page)->swap.cur.col, int16_t); assert (CURROW >= 0); assert (CURROW < PVTS(r, page)->prev_nrow); assert (CURCOL >= 0); assert (CURCOL < PVTS(r, page)->prev_ncol); MAX_IT(CURROW, 0); MIN_IT(CURROW, (int32_t)PVTS(r, page)->prev_nrow - 1); MAX_IT(CURCOL, 0); MIN_IT(CURCOL, (int32_t)PVTS(r, page)->prev_ncol - 1); SWAP_IT(PSCR(r, page).charset, PVTS(r, page)->swap.charset, int16_t); SWAP_IT(PSCR(r, page).flags, PVTS(r, page)->swap.flags, int); PSCR(r, page).flags |= Screen_VisibleCursor; PVTS(r, page)->swap.flags |= Screen_VisibleCursor; #else # ifdef SCROLL_ON_NO_SECONDARY if (PVTS(r, page)->current_screen == PRIMARY) rxvt_scroll_text(r, page, 0, (PVTS(r, page)->prev_nrow - 1), PVTS(r, page)->prev_nrow, 0); # endif #endif /* Need to update tabbar buttons */ if (ISSET_OPTION(r, Opt2_protectSecondary)) rxvt_tabbar_draw_buttons (r); return scrn; } /* ------------------------------------------------------------------------- */ /* * Change the colour for following text */ /* EXTPROTO */ void rxvt_scr_color(rxvt_t* r, int page, unsigned int color, int fgbg) { color &= RS_fgMask; if (Color_fg == fgbg) PVTS(r, page)->rstyle=SET_FGCOLOR(PVTS(r, page)->rstyle, color); else PVTS(r, page)->rstyle=SET_BGCOLOR(PVTS(r, page)->rstyle, color); } /* ------------------------------------------------------------------------- */ /* * Change the rendition style for following text */ /* EXTPROTO */ void rxvt_scr_rendition(rxvt_t* r, int page, int set, int style) { if (set) PVTS(r, page)->rstyle |= style; else if (style == ~RS_None) PVTS(r, page)->rstyle = DEFAULT_RSTYLE | (PVTS(r, page)->rstyle & RS_fontMask); else PVTS(r, page)->rstyle &= ~style; } /* ------------------------------------------------------------------------- */ /* * Scroll text between and inclusive, by lines * count positive ==> scroll up * count negative ==> scroll down * spec == 0 for normal routines */ /* EXTPROTO */ int rxvt_scroll_text(rxvt_t* r, int page, int row1, int row2, int count, int spec) { int i, j, ret; unsigned int nscrolled; size_t size; if (count == 0 || (row1 > row2)) return 0; PVTS(r, page)->want_refresh = 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scroll_text %d (%d,%d,%d,%d): %s\n", page, row1, row2, count, spec, (PVTS(r, page)->current_screen == PRIMARY) ? "Primary" : "Secondary" )); if ( (count > 0) && (row1 == 0) && (PVTS(r, page)->current_screen == PRIMARY) ) { nscrolled = (unsigned int) PVTS(r, page)->nscrolled + (unsigned int) count; if (nscrolled > (unsigned int)SVLINES) PVTS(r, page)->nscrolled = SVLINES; else PVTS(r, page)->nscrolled = (uint16_t)nscrolled; } else if (!spec) row1 += SVLINES; row2 += SVLINES; if ( SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen ) { i = SEL(r).beg.row + SVLINES; j = SEL(r).end.row + SVLINES; if ( (i < row1 && j > row1) || (i < row2 && j > row2) || (i - count < row1 && i >= row1) || (i - count > row2 && i <= row2) || (j - count < row1 && j >= row1) || (j - count > row2 && j <= row2) ) { CLEAR_ALL_SELECTION(r); /* XXX: too aggressive? */ SEL(r).op = SELECTION_CLEAR; } else if (j >= row1 && j <= row2) { /* move selected region too */ SEL(r).beg.row -= count; SEL(r).end.row -= count; SEL(r).mark.row -= count; } } /* _after_ PVTS(r, page)->nscrolled update */ rxvt_selection_check(r, page, 0); PVTS(r, page)->num_scr += count; j = count; if (count < 0) count = -count; i = row2 - row1 + 1; MIN_IT(count, i); if (j > 0) { /* A: scroll up */ /* A1: Copy lines that will get clobbered by the rotation */ for (i = count - 1, j = row1; i >= 0; i--, j++) { PVTS(r, page)->buf_text[i] = PSCR(r, page).text[j]; PVTS(r, page)->buf_rend[i] = PSCR(r, page).rend[j]; } /* A2: Rotate lines */ size = sizeof(*PSCR(r, page).tlen); MEMMOVE(&(PSCR(r, page).tlen[row1]), &(PSCR(r, page).tlen[row1+count]), (row2 - row1 - count + 1) * size); size = sizeof(*PSCR(r, page).text); MEMMOVE(&(PSCR(r, page).text[row1]), &(PSCR(r, page).text[row1+count]), (row2 - row1 - count + 1) * size); size = sizeof(*PSCR(r, page).rend); MEMMOVE(&(PSCR(r, page).rend[row1]), &(PSCR(r, page).rend[row1+count]), (row2 - row1 - count + 1) * size); j = row2 - count + 1; ret = i = count; } else /* if (j < 0) */ { /* B: scroll down */ /* B1: Copy lines that will get clobbered by the rotation */ size = sizeof(*PSCR(r, page).text); MEMCPY(PVTS(r, page)->buf_text, &PSCR(r, page).text[row2 - count + 1], count * size); size = sizeof(*PSCR(r, page).rend); MEMCPY(PVTS(r, page)->buf_rend, &PSCR(r, page).rend[row2 - count + 1], count * size); /* B2: Rotate lines */ size = sizeof(*PSCR(r, page).tlen); MEMMOVE(&(PSCR(r, page).tlen[row1 + count]), &(PSCR(r, page).tlen[row1]), (row2 - row1 - count + 1) * size); size = sizeof(*PSCR(r, page).text); MEMMOVE(&(PSCR(r, page).text[row1 + count]), &(PSCR(r, page).text[row1]), (row2 - row1 - count + 1) * size); size = sizeof(*PSCR(r, page).rend); MEMMOVE(&(PSCR(r, page).rend[row1 + count]), &(PSCR(r, page).rend[row1]), (row2 - row1 - count + 1) * size); j = row1, i = count; ret = -count; } /* C: Resurrect lines */ size = sizeof(*PSCR(r, page).tlen); MEMSET(&PSCR(r, page).tlen[j], 0, count * size); size = sizeof(*PSCR(r, page).text); MEMCPY(&PSCR(r, page).text[j], PVTS(r, page)->buf_text, count * size); size = sizeof(*PSCR(r, page).rend); MEMCPY(&PSCR(r, page).rend[j], PVTS(r, page)->buf_rend, count * size); for (; i--; j++) { if (!spec) /* line length may not equal TermWin.ncol */ rxvt_blank_screen_mem(r, page, PSCR(r, page).text, PSCR(r, page).rend, (unsigned int)j, PVTS(r, page)->rstyle); } return ret; } /* ------------------------------------------------------------------------- */ /* * Adjust the PVTS(r, page)->view_start so that the if nlines of text are added, * the view will not change. */ void static inline adjust_view_start( rxvt_t *r, int page, int nlines) { if( ISSET_OPTION( r, Opt_scrollTtyOutputInhibit) && VSTART != 0 && VSTART + nlines <= PVTS( r, page)->nscrolled ) VSTART += nlines; } /* * Add text given in of length to screen struct */ /* EXTPROTO */ void rxvt_scr_add_lines(rxvt_t* r, int page, const unsigned char *str, int nlines, int len) { unsigned char checksel, clearsel; char c; int i, row, last_col; text_t *stp; rend_t *srp; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_add_lines( r, %d, %.*s, %d, %d)\n", page, min(len, 36), str, nlines, len )); if (len <= 0) /* sanity */ return; PVTS(r, page)->want_refresh = 1; last_col = r->TermWin.ncol; ZERO_SCROLLBACK(r, page); if (nlines > 0) { /* * 2006-09-02 gi1242 TODO: The code below is *horrible*. When we call * rxvt_scroll_text(), we might end up with a negative CURROW. We try * and be clever using this information, but rxvt_scr_gotorc() will * reset this information! */ nlines += (CURROW - PSCR(r, page).bscroll); if ( (nlines > 0) && (PSCR(r, page).tscroll == 0) && (PSCR(r, page).bscroll == (r->TermWin.nrow - 1)) ) { /* _at least_ this many lines need to be scrolled */ rxvt_scroll_text(r, page, PSCR(r, page).tscroll, PSCR(r, page).bscroll, nlines, 0); adjust_view_start(r, page, nlines ); CURROW -= nlines; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "\e[32mScrolling %d lines. CURROW=%d\e[0m\n", nlines, CURROW )); } } assert(CURCOL < last_col); assert(CURROW < r->TermWin.nrow); #if 0 /*{{{ Possibly incorrection assertion */ /* * XXX 2006-09-12 gi1242: I think this assertion is wrong! Note that a few * lines later we set CURROW to be the max of CURROW and -PVTS()->nscrolled */ assert(CURROW >= -(int32_t)PVTS(r, page)->nscrolled); #endif /*}}}*/ MIN_IT(CURCOL, last_col - 1); MIN_IT(CURROW, (int32_t)r->TermWin.nrow - 1); MAX_IT(CURROW, -(int32_t)PVTS(r, page)->nscrolled); row = CURROW + SVLINES; checksel = (SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen) ? 1 : 0; clearsel = 0; stp = PSCR(r, page).text[row]; srp = PSCR(r, page).rend[row]; #ifdef MULTICHAR_SET if( PVTS(r, page)->lost_multi && CURCOL > 0 && IS_MULTI1(srp[CURCOL - 1]) && *str != '\n' && *str != '\r' && *str != '\t' ) { PVTS(r, page)->chstat = WBYTE; } #endif for (i = 0; i < len;) { c = str[i++]; switch (c) { case '\t': rxvt_scr_tab(r, page, 1); continue; case '\n': /* XXX: think about this */ if( PSCR(r, page).tlen[row] != -1 ) MAX_IT(PSCR(r, page).tlen[row], CURCOL); PSCR(r, page).flags &= ~Screen_WrapNext; if (CURROW == PSCR(r, page).bscroll) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "%s:%d ", __FILE__, __LINE__ )); rxvt_scroll_text(r, page, PSCR(r, page).tscroll, PSCR(r, page).bscroll, 1, 0); adjust_view_start( r, page, 1 ); } else if (CURROW < (r->TermWin.nrow - 1)) row = (++CURROW) + SVLINES; stp = PSCR(r, page).text[row]; /* _must_ refresh */ srp = PSCR(r, page).rend[row]; /* _must_ refresh */ RESET_CHSTAT(r, page); continue; case '\r': /* XXX: think about this */ if (PSCR(r, page).tlen[row] != -1) MAX_IT(PSCR(r, page).tlen[row], CURCOL); PSCR(r, page).flags &= ~Screen_WrapNext; CURCOL = 0; RESET_CHSTAT(r, page); continue; default: #ifdef MULTICHAR_SET if (r->encoding_method == ENC_NOENC) { if (c == 127) continue; break; } PVTS(r, page)->rstyle &= ~RS_multiMask; /* multibyte 2nd byte */ if (PVTS(r, page)->chstat == WBYTE) { /* set flag of second byte in style */ PVTS(r, page)->rstyle |= RS_multi2; /* switch back to single byte for next char */ PVTS(r, page)->chstat = SBYTE; if ( (r->encoding_method == ENC_EUCJ) && ((char) stp[CURCOL-1] == (char) 0x8e) ) { PVTS(r, page)->rstyle &= ~RS_multiMask; CURCOL --; } else /* maybe overkill, but makes it selectable */ if ((r->encoding_method == ENC_EUCJ) || (r->encoding_method == ENC_GBK) || (r->encoding_method == ENC_GB)) c |= 0x80; } /* multibyte 1st byte */ else if (PVTS(r, page)->chstat == SBYTE) { if (r->encoding_method == ENC_SJIS) { if ( PVTS(r, page)->multi_byte || ( ( (unsigned char) c >= (unsigned char) 0x81 && (unsigned char) c <= (unsigned char) 0x9f ) || ( (unsigned char) c >= (unsigned char) 0xe0 && (unsigned char) c <= (unsigned char) 0xfc ) ) ) { PVTS(r, page)->rstyle |= RS_multi1; PVTS(r, page)->chstat = WBYTE; } } else if (PVTS(r, page)->multi_byte || (c & 0x80)) { /* set flag of first byte in style */ PVTS(r, page)->rstyle |= RS_multi1; /* switch to multiple byte for next char */ PVTS(r, page)->chstat = WBYTE; /* maybe overkill, but makes selectable */ if ( (r->encoding_method == ENC_EUCJ) || (r->encoding_method == ENC_GBK) || (r->encoding_method == ENC_GB) ) c |= 0x80; } } else #endif if (c == 127) continue; /* yummmm..... */ break; } /* switch */ if ( checksel /* see if we're writing within selection */ && !RC_BEFORE(PSCR(r, page).cur, SEL(r).beg) && RC_BEFORE(PSCR(r, page).cur, SEL(r).end) ) { checksel = 0; clearsel = 1; } if (PSCR(r, page).flags & Screen_WrapNext) { PSCR(r, page).tlen[row] = -1; if (CURROW == PSCR(r, page).bscroll) { rxvt_scroll_text(r, page, PSCR(r, page).tscroll, PSCR(r, page).bscroll, 1, 0); adjust_view_start( r, page, 1 ); } else if (CURROW < (r->TermWin.nrow - 1)) row = (++CURROW) + SVLINES; stp = PSCR(r, page).text[row]; /* _must_ refresh */ srp = PSCR(r, page).rend[row]; /* _must_ refresh */ CURCOL = 0; PSCR(r, page).flags &= ~Screen_WrapNext; } if (PSCR(r, page).flags & Screen_Insert) rxvt_scr_insdel_chars(r, page, 1, INSERT); #ifdef MULTICHAR_SET if ( IS_MULTI1(PVTS(r, page)->rstyle) && CURCOL > 0 && IS_MULTI1(srp[CURCOL - 1]) ) { stp[CURCOL - 1] = ' '; srp[CURCOL - 1] &= ~RS_multiMask; } else if ( IS_MULTI2(PVTS(r, page)->rstyle) && CURCOL < (last_col - 1) && IS_MULTI2(srp[CURCOL + 1]) ) { stp[CURCOL + 1] = ' '; srp[CURCOL + 1] &= ~RS_multiMask; } #endif stp[CURCOL] = c; srp[CURCOL] = PVTS(r, page)->rstyle; if (CURCOL < (last_col - 1)) CURCOL++; else { PSCR(r, page).tlen[row] = last_col; if (PSCR(r, page).flags & Screen_Autowrap) PSCR(r, page).flags |= Screen_WrapNext; } } /* for */ if (PSCR(r, page).tlen[row] != -1) /* XXX: think about this */ MAX_IT(PSCR(r, page).tlen[row], CURCOL); /* ** If we wrote anywhere in the selected area, kill the selection ** XXX: should we kill the mark too? Possibly, but maybe that ** should be a similar check. */ if (clearsel) CLEAR_SELECTION(r); assert(CURROW >= 0); MAX_IT(CURROW, 0); } /* ------------------------------------------------------------------------- */ /* * Process Backspace. Move back the cursor back a position, wrap if have to * XTERM_SEQ: CTRL-H */ /* EXTPROTO */ void rxvt_scr_backspace(rxvt_t* r, int page) { RESET_CHSTAT(r, page); PVTS(r, page)->want_refresh = 1; if (CURCOL == 0) { if (CURROW > 0) { #ifdef TERMCAP_HAS_BW CURCOL = r->TermWin.ncol - 1; CURROW--; return; #endif } } else if ((PSCR(r, page).flags & Screen_WrapNext) == 0) rxvt_scr_gotorc(r, page, 0, -1, RELATIVE); PSCR(r, page).flags &= ~Screen_WrapNext; } /* ------------------------------------------------------------------------- */ /* * Process Horizontal Tab * count: +ve = forward; -ve = backwards * XTERM_SEQ: CTRL-I */ /* EXTPROTO */ void rxvt_scr_tab(rxvt_t* r, int page, int count) { int i, x; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_tab %d (%d)\n", page, count)); PVTS(r, page)->want_refresh = 1; RESET_CHSTAT(r, page); i = x = CURCOL; if (count == 0) return; else if (count > 0) { for (; ++i < r->TermWin.ncol; ) if (r->tabstop[i]) { x = i; if (!--count) break; } ; if (count) x = r->TermWin.ncol - 1; } else /* if (count < 0) */ { for (; --i >= 0; ) if (r->tabstop[i]) { x = i; if (!++count) break; } ; if (count) x = 0; } #if 0 if (x != CURCOL) rxvt_scr_gotorc(r, page, 0, x, R_RELATIVE); #else /* * 2006-09-02 gi1242: Don't call rxvt_scr_gotorc() because that might change * CURROW (if it was negative). If we're adding lines to the screen * structure, then CURROW is allowed to be negative. */ CURCOL = x; #endif } /* ------------------------------------------------------------------------- */ /* * Process DEC Back Index * XTERM_SEQ: ESC 6 * Move cursor left in row. If we're at the left boundary, shift everything * in that row right. Clear left column. */ #ifndef NO_FRILLS /* EXTPROTO */ void rxvt_scr_backindex(rxvt_t* r, int page) { if (CURCOL > 0) rxvt_scr_gotorc(r, page, 0, -1, R_RELATIVE | C_RELATIVE); else { if (PSCR(r, page).tlen[CURROW + SVLINES] == 0) return; /* um, yeah? */ rxvt_scr_insdel_chars(r, page, 1, INSERT); } } #endif /* ------------------------------------------------------------------------- */ /* * Process DEC Forward Index * XTERM_SEQ: ESC 9 * Move cursor right in row. If we're at the right boundary, shift everything * in that row left. Clear right column. */ #ifndef NO_FRILLS /* EXTPROTO */ void rxvt_scr_forwardindex(rxvt_t* r, int page) { int row; if (CURCOL < r->TermWin.ncol - 1) rxvt_scr_gotorc(r, page, 0, 1, R_RELATIVE | C_RELATIVE); else { row = CURROW + SVLINES; if (PSCR(r, page).tlen[row] == 0) return; /* um, yeah? */ else if (PSCR(r, page).tlen[row] == -1) PSCR(r, page).tlen[row] = r->TermWin.ncol; rxvt_scr_gotorc(r, page, 0, 0, R_RELATIVE); rxvt_scr_insdel_chars(r, page, 1, DELETE); rxvt_scr_gotorc(r, 0, page, r->TermWin.ncol - 1, R_RELATIVE); } } #endif /* ------------------------------------------------------------------------- */ /* * Goto Row/Column */ /* EXTPROTO */ void rxvt_scr_gotorc(rxvt_t* r, int page, int row, int col, int relative) { PVTS(r, page)->want_refresh = 1; ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_gotorc %d (r:%s%d,c:%s%d): from (r:%d,c:%d)\n", page, (relative & R_RELATIVE ? "+" : ""), row, (relative & C_RELATIVE ? "+" : ""), col, CURROW, CURCOL)); CURCOL = ((relative & C_RELATIVE) ? (CURCOL + col) : col); MAX_IT(CURCOL, 0); MIN_IT(CURCOL, (int32_t)r->TermWin.ncol - 1); PSCR(r, page).flags &= ~Screen_WrapNext; if (relative & R_RELATIVE) { if (row > 0) { if (CURROW <= PSCR(r, page).bscroll && (CURROW + row) > PSCR(r, page).bscroll) CURROW = PSCR(r, page).bscroll; else CURROW += row; } else if (row < 0) { if (CURROW >= PSCR(r, page).tscroll && (CURROW + row) < PSCR(r, page).tscroll) CURROW = PSCR(r, page).tscroll; else CURROW += row; } } else { if (PSCR(r, page).flags & Screen_Relative) { /* relative origin mode */ CURROW = row + PSCR(r, page).tscroll; MIN_IT(CURROW, PSCR(r, page).bscroll); } else CURROW = row; } MAX_IT(CURROW, 0); MIN_IT(CURROW, (int32_t)r->TermWin.nrow - 1); } /* ------------------------------------------------------------------------- */ /* * direction should be UP or DN */ /* EXTPROTO */ void rxvt_scr_index(rxvt_t* r, int page, enum page_dirn direction) { int dirn; PVTS(r, page)->want_refresh = 1; dirn = ((direction == UP) ? 1 : -1); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_index %d (%d)\n", page, dirn)); ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); PSCR(r, page).flags &= ~Screen_WrapNext; if ((CURROW == PSCR(r, page).bscroll && direction == UP) || (CURROW == PSCR(r, page).tscroll && direction == DN)) rxvt_scroll_text(r, page, PSCR(r, page).tscroll, PSCR(r, page).bscroll, dirn, 0); else CURROW += dirn; MAX_IT(CURROW, 0); MIN_IT(CURROW, (int32_t)r->TermWin.nrow - 1); rxvt_selection_check(r, page, 0); } /* ------------------------------------------------------------------------- */ /* * Erase part or whole of a line * XTERM_SEQ: Clear line to right: ESC [ 0 K * XTERM_SEQ: Clear line to left : ESC [ 1 K * XTERM_SEQ: Clear whole line : ESC [ 2 K */ /* EXTPROTO */ void rxvt_scr_erase_line(rxvt_t* r, int page, int mode) { unsigned int row, col, num; PVTS(r, page)->want_refresh = 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_erase_line %d (%d) at screen row: %d\n", page, mode, CURROW)); ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); rxvt_selection_check(r, page, 1); PSCR(r, page).flags &= ~Screen_WrapNext; row = SVLINES + CURROW; switch (mode) { case 0: /* erase to end of line */ col = CURCOL; num = r->TermWin.ncol - col; MIN_IT(PSCR(r, page).tlen[row], (int16_t)col); if ( RC_ROW_ATAFTER(SEL(r).beg, PSCR(r, page).cur) || RC_ROW_ATAFTER(SEL(r).end, PSCR(r, page).cur) ) CLEAR_SELECTION(r); break; case 1: /* erase to beginning of line */ col = 0; num = CURCOL + 1; if ( RC_ROW_ATBEFORE(SEL(r).beg, PSCR(r, page).cur) || RC_ROW_ATBEFORE(SEL(r).end, PSCR(r, page).cur) ) CLEAR_SELECTION(r); break; case 2: /* erase whole line */ col = 0; num = r->TermWin.ncol; PSCR(r, page).tlen[row] = 0; if (SEL(r).beg.row <= CURROW && SEL(r).end.row >= CURROW) CLEAR_SELECTION(r); break; default: return; } if (PSCR(r, page).text[row]) rxvt_blank_line(&(PSCR(r, page).text[row][col]), &(PSCR(r, page).rend[row][col]), num, PVTS(r, page)->rstyle); else rxvt_blank_screen_mem(r, page, PSCR(r, page).text, PSCR(r, page).rend, row, PVTS(r, page)->rstyle); } /* ------------------------------------------------------------------------- */ /* * Erase part of whole of the screen * XTERM_SEQ: Clear screen after cursor : ESC [ 0 J * XTERM_SEQ: Clear screen before cursor: ESC [ 1 J * XTERM_SEQ: Clear whole screen : ESC [ 2 J */ /* EXTPROTO */ void rxvt_scr_erase_screen(rxvt_t* r, int page, int mode) { int num; int32_t row, row_offset; rend_t ren; XGCValues gcvalue; PVTS(r, page)->want_refresh = 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_erase_screen %d (%d) at screen row: %d\n", page, mode, CURROW)); ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); row_offset = (int32_t)SVLINES; switch (mode) { case 0: /* erase to end of screen */ rxvt_selection_check(r, page, 1); rxvt_scr_erase_line(r, page, 0); row = CURROW + 1; /* possible OOB */ num = r->TermWin.nrow - row; break; case 1: /* erase to beginning of screen */ rxvt_selection_check(r, page, 3); rxvt_scr_erase_line(r, page, 1); row = 0; num = CURROW; break; case 2: /* erase whole screen */ /* * 2006-02-15 gi1242: As pointed out by Sabit Sayeed, Gnome terminal * scrolls the text off screen, instead of wiping it out completely. * That's seems much better so let's do it here. */ if( PVTS(r, page)->current_screen == PRIMARY ) { /* * Only scroll if the primary screen is bieng cleared. */ int sr; /* * Find the last non-empty line to save. */ for( sr = SVLINES + r->TermWin.nrow - 1; sr >= SVLINES; sr--) { int non_empty = 0, sc; for( sc = 0; sc < PSCR( r, page).tlen[sr]; sc++) if ( PSCR( r, page).text[sr][sc] != '\0' && PSCR( r, page).text[sr][sc] != ' ' ) { non_empty = 1; break; } ; if( non_empty ) break; } sr -= SVLINES /* - 1 */; /* Dump last non-empty line */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "Saving %d lines\n", sr)); if( sr > 0) rxvt_scroll_text(r, page, PSCR(r, page).tscroll, PSCR(r, page).bscroll, sr, 0); } else rxvt_selection_check(r, page, 3); row = 0; num = r->TermWin.nrow; break; default: return; } r->h->refresh_type |= REFRESH_BOUNDS; if( SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen && ( (SEL(r).beg.row >= row && SEL(r).beg.row <= row + num) || (SEL(r).end.row >= row && SEL(r).end.row <= row + num) ) ) { CLEAR_SELECTION(r); } if (row >= r->TermWin.nrow) /* Out Of Bounds */ return; MIN_IT(num, (r->TermWin.nrow - row)); if (PVTS(r, page)->rstyle & (RS_RVid | RS_Uline)) ren = (rend_t) ~RS_None; else if (GET_BASEBG(PVTS(r, page)->rstyle) == Color_bg) { ren = DEFAULT_RSTYLE; CLEAR_ROWS(row, num); } else { ren = (PVTS(r, page)->rstyle & (RS_fgMask | RS_bgMask)); gcvalue.foreground = r->pixColors[GET_BGCOLOR(PVTS(r, page)->rstyle)]; XChangeGC(r->Xdisplay, r->TermWin.gc, GCForeground, &gcvalue); ERASE_ROWS(row, num); gcvalue.foreground = r->pixColors[Color_fg]; XChangeGC(r->Xdisplay, r->TermWin.gc, GCForeground, &gcvalue); } for (; num--; row++) { rxvt_blank_screen_mem(r, page, PSCR(r, page).text, PSCR(r, page).rend, (unsigned int)(row + row_offset), PVTS(r, page)->rstyle); PSCR(r, page).tlen[row + row_offset] = 0; rxvt_blank_line(PVTS(r, page)->drawn_text[row], PVTS(r, page)->drawn_rend[row], (unsigned int) r->TermWin.ncol, ren); } } /* ------------------------------------------------------------------------- */ /* * Fill the screen with `E's * XTERM_SEQ: Screen Alignment Test: ESC # 8 */ /* EXTPROTO */ void rxvt_scr_E(rxvt_t* r, int page) { int i, j, k; rend_t *r1, fs; PVTS(r, page)->want_refresh = 1; r->h->num_scr_allow = 0; ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); rxvt_selection_check(r, page, 3); fs = PVTS(r, page)->rstyle; for (k = SVLINES, i = r->TermWin.nrow; i--; k++) { /* make the `E's selectable */ PSCR(r, page).tlen[k] = r->TermWin.ncol; MEMSET(PSCR(r, page).text[k], 'E', r->TermWin.ncol); for (r1 = PSCR(r, page).rend[k], j = r->TermWin.ncol; j--; ) *r1++ = fs; } } /* ------------------------------------------------------------------------- */ /* * Insert/Delete lines */ /* EXTPROTO */ void rxvt_scr_insdel_lines(rxvt_t* r, int page, int count, int insdel) { int end; ZERO_SCROLLBACK(r, page); RESET_CHSTAT(r, page); rxvt_selection_check(r, page, 1); if (CURROW > PSCR(r, page).bscroll) return; end = PSCR(r, page).bscroll - CURROW + 1; if (count > end) { if (insdel == DELETE) return; else if (insdel == INSERT) count = end; } PSCR(r, page).flags &= ~Screen_WrapNext; rxvt_scroll_text(r, page, CURROW, PSCR(r, page).bscroll, insdel * count, 0); } /* ------------------------------------------------------------------------- */ /* * Insert/Delete characters from the current position */ /* EXTPROTO */ void rxvt_scr_insdel_chars(rxvt_t* r, int page, int count, int insdel) { int col, row; rend_t tr; text_t* stp; rend_t* srp; int16_t* slp; PVTS(r, page)->want_refresh = 1; ZERO_SCROLLBACK(r, page); #if 0 RESET_CHSTAT(r, page); #endif if (count <= 0) return; rxvt_selection_check(r, page, 1); MIN_IT(count, (r->TermWin.ncol - CURCOL)); row = CURROW + SVLINES; PSCR(r, page).flags &= ~Screen_WrapNext; stp = PSCR(r, page).text[row]; srp = PSCR(r, page).rend[row]; slp = &(PSCR(r, page).tlen[row]); switch (insdel) { case INSERT: for (col = r->TermWin.ncol - 1; (col - count) >= CURCOL; col--) { stp[col] = stp[col - count]; srp[col] = srp[col - count]; } if (*slp != -1) { *slp += count; MIN_IT(*slp, r->TermWin.ncol); } if ( SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen && RC_ROW_ATAFTER(SEL(r).beg, PSCR(r, page).cur) ) { if ( SEL(r).end.row != CURROW || (SEL(r).end.col + count >= r->TermWin.ncol) ) CLEAR_SELECTION(r); else /* shift selection */ { SEL(r).beg.col += count; SEL(r).mark.col += count; /* XXX: yes? */ SEL(r).end.col += count; } } rxvt_blank_line(&(stp[CURCOL]), &(srp[CURCOL]), (unsigned int)count, PVTS(r, page)->rstyle); break; case ERASE: CURCOL += count; /* don't worry if > r->TermWin.ncol */ rxvt_selection_check(r, page, 1); CURCOL -= count; rxvt_blank_line(&(stp[CURCOL]), &(srp[CURCOL]), (unsigned int)count, PVTS(r, page)->rstyle); break; case DELETE: tr = srp[r->TermWin.ncol - 1] & (RS_fgMask | RS_bgMask | RS_baseattrMask); for (col = CURCOL; (col + count) < r->TermWin.ncol; col++) { stp[col] = stp[col + count]; srp[col] = srp[col + count]; } rxvt_blank_line(&(stp[r->TermWin.ncol - count]), &(srp[r->TermWin.ncol - count]), (unsigned int)count, tr); if (*slp == -1) /* break line continuation */ *slp = r->TermWin.ncol; *slp -= count; MAX_IT(*slp, 0); if ( SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen && RC_ROW_ATAFTER(SEL(r).beg, PSCR(r, page).cur) ) { if ( SEL(r).end.row != CURROW || (CURCOL >= SEL(r).beg.col - count) || SEL(r).end.col >= r->TermWin.ncol ) CLEAR_SELECTION(r); else { /* shift selection */ SEL(r).beg.col -= count; SEL(r).mark.col -= count; /* XXX: yes? */ SEL(r).end.col -= count; } } break; } #if 0 if (IS_MULTI2(srp[0])) { srp[0] &= ~RS_multiMask; stp[0] = ' '; } if (IS_MULTI1(srp[r->TermWin.ncol - 1])) { srp[r->TermWin.ncol - 1] &= ~RS_multiMask; stp[r->TermWin.ncol - 1] = ' '; } #endif } /* ------------------------------------------------------------------------- */ /* * Set the scrolling region * XTERM_SEQ: Set region - inclusive: ESC [ ; r */ /* EXTPROTO */ void rxvt_scr_scroll_region(rxvt_t* r, int page, int top, int bot) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_scroll_region( %d, %d, %d)\n", page, top, bot)); MAX_IT(top, 0); MIN_IT(bot, (int)r->TermWin.nrow - 1); if (top > bot) return; PSCR(r, page).tscroll = top; PSCR(r, page).bscroll = bot; rxvt_scr_gotorc(r, page, 0, 0, 0); } /* ------------------------------------------------------------------------- */ /* * Make the cursor visible/invisible * XTERM_SEQ: Make cursor visible : ESC [ ? 25 h * XTERM_SEQ: Make cursor invisible: ESC [ ? 25 l */ /* EXTPROTO */ void rxvt_scr_cursor_visible(rxvt_t* r, int page, int mode) { PVTS(r, page)->want_refresh = 1; if (mode) PSCR(r, page).flags |= Screen_VisibleCursor; else PSCR(r, page).flags &= ~Screen_VisibleCursor; } /* ------------------------------------------------------------------------- */ /* * Set/unset automatic wrapping * XTERM_SEQ: Set Wraparound : ESC [ ? 7 h * XTERM_SEQ: Unset Wraparound: ESC [ ? 7 l */ /* EXTPROTO */ void rxvt_scr_autowrap(rxvt_t* r, int page, int mode) { if (mode) PSCR(r, page).flags |= Screen_Autowrap; else PSCR(r, page).flags &= ~(Screen_Autowrap | Screen_WrapNext); } /* ------------------------------------------------------------------------- */ /* * Set/unset margin origin mode * Absolute mode: line numbers are counted relative to top margin of screen * and the cursor can be moved outside the scrolling region. * Relative mode: line numbers are relative to top margin of scrolling region * and the cursor cannot be moved outside. * XTERM_SEQ: Set Absolute: ESC [ ? 6 h * XTERM_SEQ: Set Relative: ESC [ ? 6 l */ /* EXTPROTO */ void rxvt_scr_relative_origin(rxvt_t* r, int page, int mode) { if (mode) PSCR(r, page).flags |= Screen_Relative; else PSCR(r, page).flags &= ~Screen_Relative; rxvt_scr_gotorc(r, page, 0, 0, 0); } /* ------------------------------------------------------------------------- */ /* * Set insert/replace mode * XTERM_SEQ: Set Insert mode : ESC [ ? 4 h * XTERM_SEQ: Set Replace mode: ESC [ ? 4 l */ /* EXTPROTO */ void rxvt_scr_insert_mode(rxvt_t* r, int page, int mode) { if (mode) PSCR(r, page).flags |= Screen_Insert; else PSCR(r, page).flags &= ~Screen_Insert; } /* ------------------------------------------------------------------------- */ /* * Set/Unset tabs * XTERM_SEQ: Set tab at current column : ESC H * XTERM_SEQ: Clear tab at current column: ESC [ 0 g * XTERM_SEQ: Clear all tabs : ESC [ 3 g */ /* EXTPROTO */ void rxvt_scr_set_tab(rxvt_t* r, int page, int mode) { if (mode < 0) MEMSET(r->tabstop, 0, r->TermWin.ncol * sizeof(char)); else if (PSCR(r, page).cur.col < r->TermWin.ncol) r->tabstop[PSCR(r, page).cur.col] = (mode ? 1 : 0); } /* ------------------------------------------------------------------------- */ /* * Set reverse/normal video * XTERM_SEQ: Reverse video: ESC [ ? 5 h * XTERM_SEQ: Normal video : ESC [ ? 5 l */ /* EXTPROTO */ void rxvt_scr_rvideo_mode(rxvt_t* r, int page, int mode) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "%s(r, page=%d, mode=%d)\n", __func__, page, mode )); if (PVTS(r, page)->rvideo != mode) { PVTS(r, page)->rvideo = mode; SWAP_IT( PVTS(r, page)->p_fg, PVTS(r, page)->p_bg, unsigned long ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) SWAP_IT( PVTS(r, page)->p_xftfg, PVTS(r, page)->p_xftbg, XftColor ); #endif if( r->TermWin.fade ) { SWAP_IT( PVTS(r, page)->p_fgfade, PVTS(r, page)->p_bgfade, unsigned long ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) SWAP_IT( PVTS(r, page)->p_xftfgfade, PVTS(r, page)->p_xftbgfade, XftColor ); #endif } if( page == ATAB(r) ) { /* Background colors need to be forcibly reset */ r->fgbg_tabnum = -1; rxvt_set_vt_colors( r, ATAB(r) ); } rxvt_scr_clear( r, page ); rxvt_scr_touch( r, page, True ); } } /* ------------------------------------------------------------------------- */ /* * Report current cursor position * XTERM_SEQ: Report position: ESC [ 6 n */ /* EXTPROTO */ void rxvt_scr_report_position(rxvt_t* r, int page) { rxvt_tt_printf(r, page, "\033[%d;%dR", CURROW + 1, CURCOL + 1); } /* ------------------------------------------------------------------------- * * FONTS * * ------------------------------------------------------------------------- */ /* * Set font style */ /* INTPROTO */ void rxvt_set_font_style(rxvt_t *r, int page) { PVTS(r, page)->rstyle &= ~RS_fontMask; switch (PVTS(r, page)->charsets[PSCR(r, page).charset]) { case '0': /* DEC Special Character & Line Drawing Set */ PVTS(r, page)->rstyle |= RS_acsFont; break; case 'A': /* United Kingdom (UK) */ PVTS(r, page)->rstyle |= RS_ukFont; break; case 'B': /* United States (USASCII) */ break; case '<': /* Multinational character set */ break; case '5': /* Finnish character set */ break; case 'C': /* Finnish character set */ break; case 'K': /* German character set */ break; } } /* ------------------------------------------------------------------------- */ /* * Choose a font * XTERM_SEQ: Invoke G0 character set: CTRL-O * XTERM_SEQ: Invoke G1 character set: CTRL-N * XTERM_SEQ: Invoke G2 character set: ESC N * XTERM_SEQ: Invoke G3 character set: ESC O */ /* EXTPROTO */ void rxvt_scr_charset_choose(rxvt_t* r, int page, int set) { PSCR(r, page).charset = set; rxvt_set_font_style(r, page); } /* ------------------------------------------------------------------------- */ /* * Set a font * XTERM_SEQ: Set G0 character set: ESC ( * XTERM_SEQ: Set G1 character set: ESC ) * XTERM_SEQ: Set G2 character set: ESC * * XTERM_SEQ: Set G3 character set: ESC + * See set_font_style for possible values for */ /* EXTPROTO */ void rxvt_scr_charset_set(rxvt_t* r, int page, int set, unsigned int ch) { #ifdef MULTICHAR_SET PVTS(r, page)->multi_byte = !!(set < 0); set = abs(set); #endif PVTS(r, page)->charsets[set] = (unsigned char)ch; rxvt_set_font_style(r, page); } /* ------------------------------------------------------------------------- * * MAJOR SCREEN MANIPULATION * * ------------------------------------------------------------------------- */ /* * Refresh an area */ enum { PART_BEG = 0, PART_END, RC_COUNT }; /* EXTPROTO */ void rxvt_scr_expose(rxvt_t* r, int page, int x, int y, int width, int height, Bool refresh) { int i; row_col_t rc[RC_COUNT]; if (PVTS(r, page)->drawn_text == NULL) /* sanity check */ return; x = max(x, (int)r->TermWin.int_bwidth); x = min(x, (int)r->szHint.width); y = max(y, (int)r->TermWin.int_bwidth); y = min(y, (int)r->szHint.height); /* round down */ rc[PART_BEG].col = Pixel2Col(x); rc[PART_BEG].row = Pixel2Row(y); /* round up */ rc[PART_END].col = Pixel2Width(x + width + r->TermWin.fwidth - 1); rc[PART_END].row = Pixel2Row(y + height + r->TermWin.fheight - 1); /* sanity checks */ for (i = PART_BEG; i < RC_COUNT; i++) { MIN_IT(rc[i].col, r->TermWin.ncol - 1); MIN_IT(rc[i].row, r->TermWin.nrow - 1); } rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_expose %d (x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)\n", page, x, y, width, height, rc[PART_BEG].col, rc[PART_BEG].row, rc[PART_END].col, rc[PART_END].row)); { register int j = rc[PART_BEG].col; register int k = rc[PART_END].col - rc[PART_BEG].col + 1; for (i = rc[PART_BEG].row; i <= rc[PART_END].row; i++) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, " memset drawn_text[%d][%d], len=%d\n", i, j, k)); MEMSET(&(PVTS(r, page)->drawn_text[i][j]), 0, k); } } if (refresh) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "Forcing immediate screen refresh")); rxvt_scr_refresh(r, page, SLOW_REFRESH | REFRESH_BOUNDS); } } /* ------------------------------------------------------------------------- */ /* * Refresh the entire screen */ /* EXTPROTO */ void rxvt_scr_touch(rxvt_t* r, int page, Bool refresh) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_touch\n")); rxvt_scr_expose(r, page, 0, 0, VT_WIDTH(r), VT_HEIGHT(r), refresh); } /* ------------------------------------------------------------------------- */ /* * Move the display so that the line represented by scrollbar value Y is at * the top of the screen */ /* EXTPROTO */ int rxvt_scr_move_to(rxvt_t* r, int page, int y, int len) { long p = 0; uint16_t oldviewstart; oldviewstart = VSTART; if (y < len) { p = (r->TermWin.nrow + PVTS(r, page)->nscrolled) * (len - y) / len; p -= (long)(r->TermWin.nrow - 1); p = max(p, 0); } VSTART = (uint16_t)min(p, PVTS(r, page)->nscrolled); rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_move_to %d (%d, %d) view_start:%d\n", page, y, len, VSTART)); return rxvt_scr_change_view(r, page, oldviewstart); } /* ------------------------------------------------------------------------- */ /* * Page the screen up/down nlines * direction should be UP or DN */ /* EXTPROTO */ int rxvt_scr_page(rxvt_t* r, int page, enum page_dirn direction, int nlines) { int n; uint16_t oldviewstart; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_page %d (%s, %d) view_start:%d\n", page, ((direction == UP) ? "UP" : "DN"), nlines, VSTART)); oldviewstart = VSTART; if (direction == UP) { n = VSTART + nlines; VSTART = min(n, PVTS(r, page)->nscrolled); } else { n = VSTART - nlines; VSTART = max(n, 0); } return rxvt_scr_change_view(r, page, oldviewstart); } /* INTPROTO */ int rxvt_scr_change_view(rxvt_t* r, int page, uint16_t oldviewstart) { if (VSTART != oldviewstart) { PVTS(r, page)->want_refresh = 1; PVTS(r, page)->num_scr -= (VSTART - oldviewstart); } return (int)(VSTART - oldviewstart); } /* ------------------------------------------------------------------------- */ /* EXTPROTO */ void rxvt_scr_bell(rxvt_t *r, int page) { #ifndef NO_BELL #if defined(THROTTLE_BELL_MSEC) && THROTTLE_BELL_MSEC > 0 /* Maximal number of bell per pre-defined time interval */ static int bellcount = 0; static struct timeval lastBell = {0, 0}; struct timeval tvnow = {0, 0}; long tminterval; #ifdef HAVE_NANOSLEEP struct timespec rqt; rqt.tv_sec = r->TermWin.vBellDuration / 1000000000ul; rqt.tv_nsec = r->TermWin.vBellDuration % 1000000000ul; #endif if (gettimeofday (&tvnow, NULL) >= 0) { if (0 == lastBell.tv_sec && 0 == lastBell.tv_usec) /* first time bell, try avoid integer overflow */ tminterval = 0; else tminterval = (tvnow.tv_sec - lastBell.tv_sec) * 1000 + (tvnow.tv_usec - lastBell.tv_usec) / 1000; lastBell = tvnow; if (tminterval > THROTTLE_BELL_MSEC) bellcount = 1; else if (bellcount ++ >= THROTTLE_BELL_COUNT) return; } #endif /* THROTTLE_BELL_MSEC && THROTTLE_BELL_MSEC > 0 */ # ifndef NO_MAPALERT # ifdef MAPALERT_OPTION if (ISSET_OPTION(r, Opt_mapAlert)) # endif XMapWindow(r->Xdisplay, r->TermWin.parent); # endif if( ISSET_OPTION(r, Opt_visualBell) || ( ISSET_OPTION( r, Opt_currentTabVBell ) && APAGE(r) == page && r->TermWin.focus ) ) { /* * Visual bells don't need to be rung on windows which are not visible. */ if( APAGE(r) != page || r->h->refresh_type == NO_REFRESH ) return; #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) /* * Reverse video bell doesn't look so good with transparency or a * background pixmap. Flash screen ourselves. */ if ( # ifdef TRANSPARENT r->h->am_transparent || r->h->am_pixmap_trans # ifdef BACKGROUND_IMAGE || # endif # endif # ifdef BACKGROUND_IMAGE IS_PIXMAP(PVTS(r, page)->pixmap) # endif ) { XGCValues values; XGetGCValues( r->Xdisplay, r->TermWin.gc, GCForeground | GCFillStyle, &values); XSetForeground( r->Xdisplay, r->TermWin.gc, r->pixColors[Color_fg] ); XSetFillStyle( r->Xdisplay, r->TermWin.gc, FillSolid); XFillRectangle( r->Xdisplay, PVTS(r, page)->vt, r->TermWin.gc, Row2Pixel(0), Col2Pixel(0), Width2Pixel( r->TermWin.ncol), Height2Pixel( r->TermWin.nrow) ); XChangeGC( r->Xdisplay, r->TermWin.gc, GCForeground | GCFillStyle, &values); XSync( r->Xdisplay, False); #ifdef HAVE_NANOSLEEP if( r->TermWin.vBellDuration ) nanosleep(&rqt, NULL); #endif XClearArea( r->Xdisplay, PVTS(r, page)->vt, 0, 0, 0, 0, True); } else #endif /* TRANSPARENT || BACKGROUND_IMAGE */ { /* refresh also done */ rxvt_scr_rvideo_mode(r, page, !PVTS(r, page)->rvideo); #ifdef HAVE_NANOSLEEP rxvt_scr_refresh( r, page, r->h->refresh_type ); XSync( r->Xdisplay, False ); if( r->TermWin.vBellDuration ) nanosleep(&rqt, NULL); #endif rxvt_scr_rvideo_mode(r, page, !PVTS(r, page)->rvideo); } } else if( r->h->rs[Rs_bellCommand] && *r->h->rs[Rs_bellCommand] ) rxvt_async_exec( r, r->h->rs[Rs_bellCommand] ); else XBell(r->Xdisplay, 0); #endif /* NO_BELL */ } /* ------------------------------------------------------------------------- */ #ifdef PRINTPIPE /* * Generate escape sequences (not including the "\e[0") to reproduce screen * rendition attributes for the foreground / background color. If "fg" is true, * then sequences for the foreground color are generated, otherwise sequences * for setting the background color are generated. * * Returns a pointer to the character after the escape sequence written. If no * further attributes are to be added, strip the trailing ";". */ /* INTPROTO */ char * escSetColor( char *s, int color, int fg) { if( color >= minCOLOR && color < minCOLOR + 8 ) s += sprintf( s, "%c%d;", fg ? '3' : '4', color - minCOLOR ); #ifndef NO_BRIGHTCOLOR else if( color >= minBrightCOLOR && color <= maxBrightCOLOR ) s += sprintf( s, "%s%d;", fg ? "9" : "10", color - minBrightCOLOR ); #endif #ifdef TTY_256COLOR else if( color >= min256COLOR && color <= max256COLOR ) s += sprintf( s, "%c8;5;%d;", fg ? '3' : '4', color - min256COLOR + 16 ); #endif else assert(0); return s; } #endif /* * Print the screen into the printer pipe. If fullhist != 0, then the entire * scroll back buffer is also dumped. */ /* EXTPROTO */ void rxvt_scr_printscreen(rxvt_t* r, int page, int fullhist, int pretty, int linecont, const char *pipeName ) { #ifdef PRINTPIPE int row, col, nrows, row_offset; text_t *txt; rend_t *rnd; FILE* fd; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_printscreen( r, %d, %d, %d, %s )\n", page, fullhist, pretty, pipeName )); if ( ( fd = rxvt_popen_printer( r, pipeName ) ) == NULL ) return; nrows = r->TermWin.nrow; row_offset = SVLINES; if (!fullhist) row_offset -= VSTART; else { nrows += PVTS(r, page)->nscrolled; row_offset -= PVTS(r, page)->nscrolled; } for( row=0; row < nrows && !ferror( fd ); row++ ) { int lineEnd; txt = PSCR( r, page ).text[ row + row_offset ]; rnd = PSCR( r, page ).rend[ row + row_offset ]; if( linecont && PSCR(r, page).tlen[row+row_offset] == -1 ) /* Line continues over. Don't trim trailing spaces */ lineEnd = r->TermWin.ncol - 1; else { /* Trim trailing spaces */ for( lineEnd = r->TermWin.ncol - 1; lineEnd >= 0 && isspace( txt[lineEnd] ); lineEnd-- ) ; } if( pretty ) { /* Print colors as escape sequences */ for( col=0; col <= lineEnd; ) { char escsq[32]; /* Buffer to hold the escape sequence. 29 bytes are enough. */ char *s, *t; int start = col; int color; rend_t rend = rnd[start]; /* Get longest string with constant rendition attrs */ do { col++; } while( col <= lineEnd && rnd[col] == rend ); t = s = escsq + sprintf( escsq, "\e[" ); if( rend & RS_Bold ) s += sprintf( s, "1;" ); if( rend & RS_Uline ) s += sprintf( s, "4;" ); if( rend & RS_Blink ) s += sprintf( s, "5;" ); if( rend & RS_RVid ) s += sprintf( s, "7;" ); color = GET_BASEFG( rend ); if( color != Color_fg ) s = escSetColor( s, color, 1 ); color = GET_BASEBG( rend ); if( color != Color_bg ) s = escSetColor( s, color, 0 ); if( s != t ) { /* * Some esc seq has been set. Null terminate and Replace * trailing ';' with 'm' */ *(s--) = '\0'; *s = 'm'; fprintf( fd, "%s%.*s\e[0m", escsq, col-start, txt+start ); } else fprintf( fd, "%.*s", col - start, txt + start ); } } /* if( pretty ) */ else /* Vanilla text */ fprintf( fd, "%.*s", (lineEnd + 1), txt ); if( !linecont || PSCR(r, page).tlen[row+row_offset] != -1 ) fputc( '\n', fd ); } /* for( row ... ) */ rxvt_pclose_printer(fd); #endif } #ifdef TEXT_SHADOW /* * If refreshRegion is not None, then we should intersect our clipping with it. */ /* INTPROTO */ # ifdef XFT_SUPPORT void rxvt_set_clipping (rxvt_t* r, XftDraw *xftdraw, GC gc, Region refreshRegion, int x, int y, unsigned width, unsigned height, int* offx, int* offy) # else void rxvt_set_clipping (rxvt_t* r, __attribute__((unused)) void *xftdraw, GC gc, Region refreshRegion, int x, int y, unsigned width, unsigned height, int* offx, int* offy) # endif { /* * mfont is a flag whether the output string is multi-byte. if so, we need * to extend its length twice assuming string is 2-byte string */ XRectangle rect; Region region; /* Sanity check */ assert (offx); assert (offy); if (SHADOW_NONE == r->TermWin.shadow_mode) { *offx = *offy = 0; return; /* shortcut */ } switch (r->TermWin.shadow_mode) { case SHADOW_TOP: *offx = 0; *offy = -1; break; case SHADOW_BOTTOM: *offx = 0; *offy = 1; break; case SHADOW_LEFT: *offx = -1; *offy = 0; break; case SHADOW_RIGHT: *offx = 1; *offy = 0; break; case SHADOW_TOPLEFT: *offx = -1; *offy = -1; break; case SHADOW_TOPRIGHT: *offx = 1; *offy = -1; break; case SHADOW_BOTLEFT: *offx = -1; *offy = 1; break; case SHADOW_BOTRIGHT: *offx = 1; *offy = 1; break; default: assert (0); break; } #if 0 rect.width = Width2Pixel(1) * len * (mfont+1); rect.height = Height2Pixel(1) * 1; rect.x += x; rect.y += (y - rect.height); #endif /* * Left / right dropped pixels are cleaned up by pixel dropping avoidance * under Xft, so we can add that to our offset. */ rect.x = #ifdef XFT_SUPPORT (ISSET_OPTION(r, Opt_xft) && xftdraw) ? x + *offx : #endif x; rect.y = y; rect.width = width; rect.height = height; region = XCreateRegion(); XUnionRectWithRegion( &rect, region, region); if (IS_REGION(refreshRegion)) XIntersectRegion( region, refreshRegion, region); XSetRegion( r->Xdisplay, gc, region); /* * XSetClipRectangles (r->Xdisplay, gc, x, y-hy, &rectangle, 1, Unsorted); */ #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && xftdraw ) XftDrawSetClip( xftdraw, region); #endif XDestroyRegion( region ); } /* INTPROTO */ void # ifdef XFT_SUPPORT rxvt_free_clipping (rxvt_t* r, XftDraw* xftdraw, GC gc, Region refreshRegion) # else rxvt_free_clipping (rxvt_t* r, void* xftdraw, GC gc, Region refreshRegion) # endif { if (SHADOW_NONE == r->TermWin.shadow_mode) return; /* shortcut */ if (IS_REGION(refreshRegion)) XSetRegion( r->Xdisplay, gc, refreshRegion ); else XSetClipMask( r->Xdisplay, gc, None); # ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && xftdraw) XftDrawSetClip( xftdraw, refreshRegion ); # endif /* XFT_SUPPORT */ } #endif /* TEXT_SHADOW */ void static inline rxvt_clear_area (rxvt_t* r, int page, int x, int y, unsigned int w, unsigned int h) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "clear area (%d, %d, %d, %d)\n", x,y,w,h)); XClearArea (r->Xdisplay, drawBuffer, x, y, w, h, False); } void static inline rxvt_fill_rectangle (rxvt_t* r, int page, int x, int y, unsigned int w, unsigned int h) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "fill rectangle (%d, %d, %d, %d)\n", x,y,w,h)); XFillRectangle (r->Xdisplay, drawBuffer, r->TermWin.gc, x, y, w, h); } /* ------------------------------------------------------------------------- */ /* * Refresh the screen * PVTS(r, page)->drawn_text/PVTS(r, page)->drawn_rend contain the screen information before the update. * PSCR(r, page).text/PSCR(r, page).rend contain what the screen will change to. */ #define X11_DRAW_STRING_8 (1) #define X11_DRAW_STRING_16 (2) #define X11_DRAW_IMAGE_STRING_8 (3) #define X11_DRAW_IMAGE_STRING_16 (4) #define XFT_DRAW_STRING_8 (5) #define XFT_DRAW_STRING_16 (6) #define XFT_DRAW_STRING_32 (7) #define XFT_DRAW_STRING_UTF8 (8) #define XFT_DRAW_IMAGE_STRING_8 (9) #define XFT_DRAW_IMAGE_STRING_16 (10) #define XFT_DRAW_IMAGE_STRING_32 (11) #define XFT_DRAW_IMAGE_STRING_UTF8 (12) #ifdef XFT_SUPPORT #define XFTDRAW_STRING(xdraw, color, font, x, y, str, len) \ ( ( rend & RS_acsFont) ? \ (xftDrawACSString( r->Xdisplay, d, gc, \ xftdraw_string, \ (xdraw), (color), (font), (x), (y), \ (unsigned char*) (str), (len))) : \ (xftdraw_string( (xdraw), (color), (font), (x), (y), (str), (len)))) /* * len: number of characters to draw. for UTF-8 string, it is the * number of characters * 2 of the original 16-bits string * * pfont: Weather to use xftpfn (if defined) or not. * * refreshRegion: If set, then any changes made to clipping are undone by * resetting them to this. (Pass None for no region). */ /* EXTPROTO */ void rxvt_draw_string_xft (rxvt_t* r, Drawable d, GC gc, Region refreshRegion, rend_t rend, int pfont, XftDraw* win, XftColor* fore, int x, int y, char* str, int len, void (*xftdraw_string)()) { XftFont *font; /* * If "multichar" stuff is needed in tab titles etc, then xftpfont / * xftPfont must be multichar capable. If that's not an option, then set * xftpfont to NULL, and the correct multichar font will be used. */ if( pfont && r->TermWin.xftpfont ) { font = ( pfont == USE_BOLD_PFONT) ? r->TermWin.xftPfont : r->TermWin.xftpfont; } #ifdef MULTICHAR_SET else if( xftdraw_string == XftDrawStringUtf8 ) font = r->TermWin.xftmfont; #endif else font = r->TermWin.xftfont; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Draw: 0x%8x %p: '%.40s'\n", rend, font, str )); #ifdef MULTICHAR_SET if( xftdraw_string == XftDrawStringUtf8 ) len = STRLEN( str); #endif # ifdef TEXT_SHADOW if (r->h->rs[Rs_textShadow] && SHADOW_NONE != r->TermWin.shadow_mode) { /* * Get the bounding box of the rectangle we would draw, and clip to it. */ void (*xftTextExtents)() = NULL; /* Suppress compile warning */ XGlyphInfo extents; int sx, sy; /* Shadow offsets */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "handling text shadow for %s (%d)\n", str, len)); if( xftdraw_string == XftDrawString8 ) xftTextExtents = XftTextExtents8; else if( xftdraw_string == XftDrawString16) xftTextExtents = XftTextExtents16; else if( xftdraw_string == XftDrawString32) xftTextExtents = XftTextExtents32; else if( xftdraw_string == XftDrawStringUtf8) xftTextExtents = XftTextExtentsUtf8; else assert(0); /* Shouldn't happen */ xftTextExtents( r->Xdisplay, font, str, len, &extents); /* * We should ignore extents.height. The height of the drawn text might * be much smaller than the height of the font (which is really what * we've reserved space for. */ rxvt_set_clipping( r, win, gc, refreshRegion, x, y - font->ascent, extents.width - extents.x, font->height, &sx, &sy); XFTDRAW_STRING (win, &(r->TermWin.xftshadow), font, x+sx, y+sy, str, len); /* * We need to free clipping area, otherwise text on screen may be * clipped unexpectedly. Is there a better way to unset it, say, * XUnsetClipRectangles? */ rxvt_free_clipping (r, win, gc, refreshRegion); } # endif /* TEXT_SHADOW */ XFTDRAW_STRING (win, fore, font, x, y, str, len); } #undef XFTDRAW_STRING #endif /* XFT_SUPPORT */ /* * len : number of characters in the string */ /* EXTPROTO */ void rxvt_draw_string_x11 (rxvt_t* r, Window win, GC gc, Region refreshRegion, int x, int y, char* str, int len, int (*draw_string)()) { # ifdef TEXT_SHADOW while (r->h->rs[Rs_textShadow] && SHADOW_NONE != r->TermWin.shadow_mode) { int sx, sy; XGCValues gcvalue; int (*xtextextents)(); int unused_dir, ascent, descent; XCharStruct charstruct; GContext gid = XGContextFromGC( gc ); XFontStruct *font = XQueryFont( r->Xdisplay, gid); if( font == NULL ) break; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "handling text shadow for %s (%d)\n", str, len)); /* * Save the old GC values foreground. */ XGetGCValues (r->Xdisplay, gc, GCForeground | GCBackground | GCFillStyle, &gcvalue); /* * Get the bounding box of the rectangle we would draw, and clip to it. */ if( draw_string == XDrawImageString || draw_string == XDrawString) xtextextents = XTextExtents; else if ( draw_string == XDrawImageString16 || draw_string == XDrawString16) xtextextents = XTextExtents16; else assert(0); /* Shouldn't happen */ xtextextents( font, str, len, &unused_dir, &ascent, &descent, &charstruct); /* * If we're using XDrawImageString, then when we draw the actual text, * the shadow will be erased. Clear the rectangle ourselves, and change * to XDrawString. */ if( draw_string == XDrawImageString || draw_string == XDrawImageString16) { XSetForeground( r->Xdisplay, gc, gcvalue.background); XSetFillStyle( r->Xdisplay, gc, FillSolid); XFillRectangle( r->Xdisplay, win, gc, x, y - font->ascent, charstruct.width, font->ascent + font->descent); if( draw_string == XDrawImageString ) draw_string = XDrawString; else draw_string = XDrawString16; } /* * Restrict output to the above bounding box. */ rxvt_set_clipping( r, NULL, gc, refreshRegion, x, y - font->ascent, charstruct.width, font->ascent + font->descent, &sx, &sy); /* * Draw the shadow at the appropriate offset. */ XSetForeground (r->Xdisplay, gc, r->TermWin.shadow); draw_string (r->Xdisplay, win, gc, x+sx, y+sy, str, len); /* * Restore old GC values. */ XChangeGC( r->Xdisplay, gc, GCForeground | GCBackground | GCFillStyle, &gcvalue); /* * Unclip drawing for remaining drawing. */ rxvt_free_clipping (r, NULL, gc, refreshRegion); XFreeFontInfo( NULL, font, 1); break; } # endif /* TEXT_SHADOW */ rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "output entire string: %s\n", str)); draw_string (r->Xdisplay, win, gc, x, y, str, len); } /* ** Draw the string: ** x, y: top left corner of the string ** str : actual string to draw ** len : actual number of characters in the string. It is NOT ** the byte length! ** drawfunc: function to draw string ** fore, back: color index to r->pixColors array. It is only ** used by the XFT drawing, not X11 drawing ** rend: rendition value (text attributes). Only used for the RS_acsFont ** attribute with Xft for correct drawing of ACS graphics characters. */ /* INTPROTO */ void rxvt_scr_draw_string (rxvt_t* r, int page, int x, int y, char* str, int len, int drawfunc, uint16_t fore, uint16_t back, __attribute__((unused)) rend_t rend, Region refreshRegion) { #ifdef XFT_SUPPORT int fillback = 0; int adjust; void (*xftdraw_string) () = NULL; switch (drawfunc) { case XFT_DRAW_IMAGE_STRING_8: fillback = 1; case XFT_DRAW_STRING_8: xftdraw_string = XftDrawString8; break; case XFT_DRAW_IMAGE_STRING_16: fillback = 1; case XFT_DRAW_STRING_16: xftdraw_string = XftDrawString16; break; } /* * adjust is a variable that records whether each character of the string is * 8 bits or 16 bits */ adjust = (XftDrawString8 == xftdraw_string) ? 0 : 1; if (ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt && xftdraw_string) { register int loop; /* loop iteration number */ register int loopitem; /* each iteration increasing # */ register int i; /* ** xft_draw_string_xft should call these two parameters */ register char* pstr; /* string to print */ register int plen; /* string length */ char* newstr; #ifdef MULTICHAR_SET # ifdef HAVE_ICONV_H char pbuf[1024]; /* buffer to save UTF-8 string */ # endif #endif /* * Xft does not support XDrawImageString, so we need to clear the * background of text by ourselves. */ if (fillback) XftDrawRect( PVTS(r, page)->xftvt, &(r->xftColors[back]), x, y, Width2Pixel(len * (1 + adjust)), Height2Pixel(1)); /* We use TermWin.xftfont->ascent here */ y += r->TermWin.xftfont->ascent; /* * Xft does not support XftDrawString16, so we need to convert the * string to UTF-8. Here we reencode the string before conversion */ # ifdef MULTICHAR_SET # ifdef HAVE_ICONV_H if (adjust && (iconv_t) -1 != r->TermWin.xfticonv) { register int j, newlen = (len << 1); switch (r->encoding_method) { case ENC_EUCJ: case ENC_GB: for (j = 0; j < newlen; j ++) str[j] |= 0x80; break; case ENC_GBK: /* need to do nothing */ case ENC_BIG5: /* need to do nothing */ default: break; } /* we will use utf8 routine to draw string */ xftdraw_string = XftDrawStringUtf8; } # endif # endif /* MULTICHAR_SET */ /* ** If the font is monospace, we print the entire string once, ** otherwise, print the characters one by one */ if (r->TermWin.xftmono) { /* print string once for mono font */ loop = 1; loopitem = len; /* ** If XftDrawString8 == xftdraw_string ** string length == character number ** If XftDrawString16 == xftdraw_string ** string length == 2 * character number, but we do ** not need to multiply loopitem by 2 because the ** XftDrawString16 takes character numbers. ** ** If XftDrawStringUtf8 == xftdraw_string ** string length == 2 * character number, but we need ** to multiply loopitem by 2 because iconv need string ** length as parameter, not character number. */ if (XftDrawStringUtf8 == xftdraw_string) loopitem <<= 1; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "output entire mono string\n")); } /* ** Non monospace font, but still we can improve the performance ** by print it once under certain conditions */ # ifdef MULTICHAR_SET else if ( NOTSET_OPTION(r, Opt2_xftSlowOutput) && (XftDrawStringUtf8 == xftdraw_string) && ( r->TermWin.xftmfont->max_advance_width == (r->TermWin.fwidth << 1) ) ) { /* print string once for multichar string */ loop = 1; /* ** If XftDrawStringUtf8 == xftdraw_string ** string length == 2 * character number, but we need ** to multiply loopitem by 2 because iconv need string ** length as parameter, not character number. */ loopitem = (len << 1); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "output entire UTF-8 string\n")); } else if ( NOTSET_OPTION(r, Opt2_xftSlowOutput) && (XftDrawString16 == xftdraw_string) && ( r->TermWin.xftmfont->max_advance_width == (r->TermWin.fwidth << 1) ) ) { /* print string once for 16-bits string */ loop = 1; loopitem = len; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "output entire 16-bits string\n")); } # endif /* MULTICHAR_SET */ else if ( r->TermWin.xftfnmono && (XftDrawString8 == xftdraw_string) && (r->TermWin.xftfont->max_advance_width == r->TermWin.fwidth) ) { /* print string once for 8-bits string */ loop = 1; loopitem = len; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "output entire 8-bits string\n")); } else { /* print string one by one character */ loop = len; loopitem = 1 + adjust; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "output characters one by one\n")); } newstr = str; /* string beginning in each iteration */ for (i = 0; i < loop; i ++) { # ifdef MULTICHAR_SET # ifdef HAVE_ICONV_H if (XftDrawStringUtf8 == xftdraw_string) { /* We should convert the string to UTF-8 */ char* buf = pbuf; /* always init it */ int buflen = sizeof(pbuf)-1;/* always init it */ int newlen = loopitem; /* always init it */ char* oldstr = newstr; iconv (r->TermWin.xfticonv, (char**)(&newstr), (size_t*) &newlen, &buf, (size_t*) &buflen); *buf = (char) 0; /* set end of string */ pstr = pbuf; /* * we should use the length of original string, not UTF-8 string * here!!! */ plen = loopitem; /* * reset newstr to old position, we will increase it later */ newstr = oldstr; } else # endif # endif /* MULTICHAR_SET */ { /* We do not need to convert the string to UTF-8 */ pstr = newstr; plen = loopitem; } rxvt_draw_string_xft(r, PVTS( r, page)->vt, r->TermWin.gc, refreshRegion, rend, NO_PFONT, PVTS(r, page)->xftvt, &(r->xftColors[fore]), x, y, pstr, plen, xftdraw_string); x += Width2Pixel (loopitem); newstr += loopitem; /* next string to display */ } } else #endif /* XFT_SUPPORT */ { int (*draw_string) (); switch (drawfunc) { case X11_DRAW_STRING_8: draw_string = XDrawString; break; case X11_DRAW_STRING_16: draw_string = XDrawString16; break; case X11_DRAW_IMAGE_STRING_8: draw_string = XDrawImageString; break; case X11_DRAW_IMAGE_STRING_16: draw_string = XDrawImageString16; break; case XFT_DRAW_STRING_8: /* fall back to X11 */ draw_string = XDrawString; break; case XFT_DRAW_STRING_16: /* fall back to X11 */ case XFT_DRAW_STRING_32: /* fall back to X11 */ case XFT_DRAW_STRING_UTF8: /* fall back to X11 */ draw_string = XDrawString16; break; case XFT_DRAW_IMAGE_STRING_8: /* fall back to X11 */ draw_string = XDrawImageString; break; case XFT_DRAW_IMAGE_STRING_16: /* fall back to X11 */ case XFT_DRAW_IMAGE_STRING_32: /* fall back to X11 */ case XFT_DRAW_IMAGE_STRING_UTF8: /* fall back to X11 */ draw_string = XDrawImageString16; break; default: draw_string = NULL; break; } /* We use TermWin.font->ascent here */ y += r->TermWin.font->ascent; /* Now draw the string */ if (draw_string) rxvt_draw_string_x11 (r, PVTS(r, page)->vt, r->TermWin.gc, refreshRegion, x, y, str, len, draw_string); } } /* * 2006-08-19 gi1242: Don't display blinking text with the bold attribute. This * causes problems all over the code: When we unset the bold attribute, thinking * "we've taken care of it", the blink attribute might cause us to do over * striking. Plus it causes trouble in the pixel dropping avoidance stuff. */ #define MONO_BOLD(x) \ (ISSET_OPTION(r, Opt2_veryBold) ? \ ((x) & RS_Bold) : \ (((x) & (RS_Bold | RS_fgMask)) == (RS_Bold | Color_fg)) \ ) #define MONO_BOLD_FG(x, fg) \ (ISSET_OPTION(r, Opt2_veryBold) ? \ ((x) & RS_Bold) : \ (((x) & RS_Bold) && (fg) == Color_fg) \ ) #define FONT_WIDTH(X, Y) \ (X)->per_char[(Y) - (X)->min_char_or_byte2].width #define FONT_RBEAR(X, Y) \ (X)->per_char[(Y) - (X)->min_char_or_byte2].rbearing #define FONT_LBEAR(X, Y) \ (X)->per_char[(Y) - (X)->min_char_or_byte2].lbearing #define IS_FONT_CHAR(X, Y) \ ((Y) >= (X)->min_char_or_byte2 && (Y) <= (X)->max_char_or_byte2) /* * This function needs to be optimized and sped up more * * 2006-02-11 gi1242: Added a CLIPPED_REFRESH option. If set, only clipped areas * are redrawn. This adds a TREMENDOUS speedup when dragging some window over * mrxvt's window. (Not to mention got rid of that annoying flicker). */ /* EXTPROTO */ void rxvt_scr_refresh(rxvt_t* r, int page, unsigned char refresh_type) { unsigned char clearfirst, /* first character writes before cell */ clearlast, /* last character writes beyond cell */ must_clear, /* use drawfunc not image_drawfunc */ already_cleared=0, /* Use XClearArea or no-op */ #ifndef NO_BOLDFONT usingBoldFt, /* we've changed font to bold font */ loadedBoldFt, /* If a bold font is loaded */ #endif rvid, /* reverse video this position */ wbyte, /* we're in multibyte */ showcursor; /* show the cursor */ signed char morecur = 0;/* */ #ifdef TTY_256COLOR uint16_t fore, back; /* desired foreground/background */ #else unsigned char fore, back; /* desired foreground/background */ #endif int16_t col, row, /* column/row we're processing */ ocrow, /* old cursor row */ len, wlen; /* text length screen/buffer */ int i, /* tmp */ row_offset; /* basic offset in screen structure */ #ifndef NO_CURSORCOLOR rend_t cc1 = 0; /* store colours at cursor position(s) */ # ifdef MULTICHAR_SET rend_t cc2 = 0; /* store colours at cursor position(s) */ /* 2007-07-30 gi1242: NULL assignment to suppress * compile warning. */ # endif #endif XGCValues gcvalue; /* Graphics Context values */ XFontStruct* wf; /* font structure */ rend_t* drp; /* drawn_rend pointer */ rend_t* srp; /* screen-rend-pointer */ text_t* dtp; /* drawn-text pointer */ text_t* stp; /* screen-text-pointer */ char* buffer; /* local copy of r->h->buffer */ /* int (*drawfunc) () = XDrawString; int (*image_drawfunc) () = XDrawImageString; */ int drawfunc, image_drawfunc; struct rxvt_hidden *h = r->h; if( !(refresh_type & CLIPPED_REFRESH) ) PVTS( r, page)->scrolled_lines = 0; if (refresh_type == NO_REFRESH || !PVTS(r, page)->mapped) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Skipping refresh (%d, %d)\n", refresh_type, PVTS(r, page)->mapped)); return; } rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_refresh %d ()\n", page)); /* ** A: set up vars */ #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt) { drawfunc = XFT_DRAW_STRING_8; image_drawfunc = XFT_DRAW_IMAGE_STRING_8; } else #endif { drawfunc = X11_DRAW_STRING_8; image_drawfunc = X11_DRAW_IMAGE_STRING_8; } clearfirst = clearlast = must_clear = wbyte = 0; #ifndef NO_BOLDFONT usingBoldFt = 0; /* Determine if we have a bold font loaded or not */ if( # ifdef XFT_SUPPORT ISSET_OPTION( r, Opt_xft ) ? NOT_NULL( r->TermWin.xftbfont ) : NOT_NULL( r->TermWin.bfont ) # else NOT_NULL( r->TermWin.bfont ) # endif ) loadedBoldFt = 1; else loadedBoldFt = 0; #endif /* NO_BOLDFONT */ if (h->currmaxcol < r->TermWin.ncol) { h->currmaxcol = r->TermWin.ncol; h->buffer = rxvt_realloc(h->buffer, sizeof(char) * (h->currmaxcol + 1)); } buffer = h->buffer; row_offset = SVLINES - VSTART; #ifdef XFT_SUPPORT if (!(ISSET_OPTION(r, Opt_xft) && r->TermWin.xftfont)) #endif { /* always go back to the base font - it's much safer */ XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.font->fid); wf = r->TermWin.font; } if ((refresh_type & REFRESH_BOUNDS)) { clearfirst = clearlast = 1; h->refresh_type &= ~REFRESH_BOUNDS; } #ifdef BACKGROUND_IMAGE must_clear |= IS_PIXMAP(PVTS(r, page)->bg.pixmap); #endif #ifdef TRANSPARENT must_clear |= ( h->am_transparent || h->am_pixmap_trans ); #endif /* is there an old outline cursor on screen? */ ocrow = h->oldcursor.row; /* * set base colours to avoid check in "single glyph writing" below */ gcvalue.foreground = r->pixColors[Color_fg]; gcvalue.background = r->pixColors[Color_bg]; /* * Set clippings on our XftDrawables and GC's to make sure we don't waste * time drawing pixels outside this clipping. (This probably happened * because of an expose event). */ if( (refresh_type & CLIPPED_REFRESH) && IS_REGION(h->refreshRegion)) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Doing clipped refresh (Region %p)\n", h->refreshRegion)); /* * We must wait till refresh is complete before destroying the * region because the clipping is reset when text shadow is used. */ XSetRegion( r->Xdisplay, r->TermWin.gc, h->refreshRegion); #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt ) XftDrawSetClip( PVTS(r, page)->xftvt, h->refreshRegion); #endif /* Remember we don't need to call XClearArea on exposed regions */ if( must_clear ) already_cleared = 1; } /* ** B: reverse any characters which are selected */ rxvt_scr_reverse_selection(r, page); /* ** C: set the cursor character(s) */ { unsigned char setoldcursor; rend_t ccol1, /* Cursor colour */ ccol2; /* Cursor colour2 */ showcursor = (PSCR(r, page).flags & Screen_VisibleCursor); #ifdef CURSOR_BLINK if (h->hidden_cursor) showcursor = 0; #endif if (showcursor && r->TermWin.focus) { int currow = CURROW + SVLINES; srp = &(PSCR(r, page).rend[currow][CURCOL]); rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Setting solid cursor\n")); *srp ^= RS_RVid; #ifndef NO_CURSORCOLOR cc1 = *srp & (RS_fgMask | RS_bgMask); if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_cursor)) ccol1 = Color_cursor; else #ifdef CURSOR_COLOR_IS_RENDITION_COLOR ccol1 = GET_FGCOLOR( PVTS(r, page)->drawn_rend[CURROW][CURCOL]); /* ccol1 = GET_FGCOLOR(PVTS(r, page)->rstyle); */ #else ccol1 = Color_fg; #endif if( XDEPTH > 2 && ISSET_PIXCOLOR( h, Color_cursor ) && ISSET_PIXCOLOR( h, Color_cursor2 ) ) ccol2 = Color_cursor2; else { #ifdef CURSOR_COLOR_IS_RENDITION_COLOR # ifdef SIMULATE_LINUX_CONSOLE_CURSOR_COLOR ccol2 = GET_FGCOLOR(PVTS(r, page)->drawn_rend[CURROW][CURCOL]); # else ccol2 = GET_BGCOLOR(PVTS(r, page)->drawn_rend[CURROW][CURCOL]); # endif /* SIMULATE_LINUX_CONSOLE_CURSOR_COLOR */ /* ccol2 = GET_BGCOLOR(PVTS(r, page)->rstyle); */ #else ccol2 = Color_bg; #endif } *srp = SET_FGCOLOR(*srp, ccol1); *srp = SET_BGCOLOR(*srp, ccol2); #endif /* NO_CURSORCOLOR */ #ifdef MULTICHAR_SET if (IS_MULTI1(*srp)) { if (CURCOL < r->TermWin.ncol - 2 && IS_MULTI2(*++srp)) morecur = 1; } else if (IS_MULTI2(*srp)) { if (CURCOL > 0 && IS_MULTI1(*--srp)) morecur = -1; } if (morecur) { *srp ^= RS_RVid; # ifndef NO_CURSORCOLOR cc2 = *srp & (RS_fgMask | RS_bgMask); *srp = SET_FGCOLOR(*srp, ccol1); *srp = SET_BGCOLOR(*srp, ccol2); # endif } #endif } /* make sure no outline cursor is left around */ setoldcursor = 0; if (ocrow != -1) { if (CURROW + VSTART != ocrow || CURCOL != h->oldcursor.col) { if ( ocrow < r->TermWin.nrow && h->oldcursor.col < r->TermWin.ncol ) { PVTS(r, page)->drawn_rend[ocrow][h->oldcursor.col] ^= (RS_RVid | RS_Uline); #ifdef MULTICHAR_SET if (h->oldcursormulti) { col = h->oldcursor.col + h->oldcursormulti; if (col < r->TermWin.ncol) PVTS(r, page)->drawn_rend[ocrow][col] ^= (RS_RVid | RS_Uline); } #endif } if (r->TermWin.focus || !showcursor) h->oldcursor.row = -1; else setoldcursor = 1; } } else if (!r->TermWin.focus) setoldcursor = 1; if (setoldcursor) { if (CURROW + VSTART >= r->TermWin.nrow) h->oldcursor.row = -1; else { h->oldcursor.row = CURROW + VSTART; h->oldcursor.col = CURCOL; #ifdef MULTICHAR_SET h->oldcursormulti = morecur; #endif } } } /* End of C */ #ifndef NO_SLOW_LINK_SUPPORT /* ** D: CopyArea pass - very useful for slower links ** This has been deliberately kept simple. */ i = PVTS(r, page)->num_scr; if (refresh_type == FAST_REFRESH && h->num_scr_allow && i && abs(i) < r->TermWin.nrow && !must_clear) { int16_t nits; int j; rend_t *drp2; text_t *dtp2; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "Trying slowlink copyarea pass\n")); j = r->TermWin.nrow; wlen = len = -1; row = i > 0 ? 0 : j - 1; for (; j-- >= 0; row += (i > 0 ? 1 : -1)) { if (row + i >= 0 && row + i < r->TermWin.nrow && row + i != ocrow) { stp = PSCR(r, page).text[row + row_offset]; srp = PSCR(r, page).rend[row + row_offset]; dtp = PVTS(r, page)->drawn_text[row]; dtp2 = PVTS(r, page)->drawn_text[row + i]; drp = PVTS(r, page)->drawn_rend[row]; drp2 = PVTS(r, page)->drawn_rend[row + i]; for (nits = 0, col = r->TermWin.ncol; col--; ) if (stp[col] != dtp2[col] || srp[col] != drp2[col]) nits--; else if (stp[col] != dtp[col] || srp[col] != drp[col]) nits++; if (nits > 8) /* XXX: arbitrary choice */ { for (col = r->TermWin.ncol; col--; ) { *dtp++ = *dtp2++; *drp++ = *drp2++; } if (len == -1) len = row; wlen = row; continue; } } if (len != -1) { /* also comes here at end if needed because of >= above */ if (wlen < len) SWAP_IT(wlen, len, int); rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_scr_refresh %d (): " "XCopyArea: %d -> %d (height: %d)\n", page, len + i, len, wlen - len + 1)); XCopyArea(r->Xdisplay, PVTS(r, page)->vt, PVTS(r, page)->vt, r->TermWin.gc, 0, Row2Pixel(len + i), TWIN_WIDTH(r), (unsigned int)Height2Pixel(wlen-len+1), 0, Row2Pixel(len)); len = -1; } } } /* End of D */ #endif /* !NO_SLOW_LINK_SUPPORT */ /* ** E: main pass across every character */ for (row = 0; row < r->TermWin.nrow; row++) { unsigned char clear_next = 0; int j, /* x offset for start of drawing (font) */ xpixel, /* y offset for top of drawing */ ypixelc; unsigned long gcmask; /* Graphics Context mask */ stp = PSCR(r, page).text[row + row_offset]; srp = PSCR(r, page).rend[row + row_offset]; dtp = PVTS(r, page)->drawn_text[row]; drp = PVTS(r, page)->drawn_rend[row]; #ifndef NO_PIXEL_DROPPING_AVOIDANCE /* * E1: Pixel dropping avoidance. Do this before the main refresh on the * line. Require a refresh where pixels may have been dropped into our * area by a neighbour character which has now changed * * TODO: This could be integrated into E2 but might be too messy */ for (col = 0; col < r->TermWin.ncol; col++) { unsigned char is_font_char, is_same_char; text_t t; t = dtp[col]; is_same_char = (t == stp[col] && drp[col] == srp[col]); if (!clear_next && (is_same_char || t == 0 || t == ' ')) /* screen cleared elsewhere */ continue; if (clear_next) { /* previous char caused change here */ clear_next = 0; dtp[col] = 0; /* don't cascade into next char */ if (is_same_char) continue; } #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) ) { /* * Only text drawn by over striking needs to be watched for * "dropped pixels". * * XXX This does not take into account Color_BD */ if( !loadedBoldFt && ( drp[col] & RS_Bold ) ) { if( col == r->TermWin.ncol - 1 ) clearlast = 1; else clear_next = 1; } # ifdef TEXT_SHADOW /* * Xft with shadow drops pixels into the next / prev char. */ else if ( h->rs[Rs_textShadow] && r->TermWin.shadow_mode != SHADOW_NONE ) { switch( r->TermWin.shadow_mode ) { case SHADOW_TOPRIGHT: case SHADOW_RIGHT: case SHADOW_BOTRIGHT: /* Clear next char */ if( col == r->TermWin.ncol - 1) clearlast = 1; else clear_next = 1; break; case SHADOW_TOPLEFT: case SHADOW_LEFT: case SHADOW_BOTLEFT: /* Clear prev char */ if( col == 0 ) clearfirst = 1; else dtp[col-1] = 0; break; default: /* Nothing to be done here */ break; } } # endif /* TEXT_SHADOW */ } else #endif { j = MONO_BOLD(drp[col]) ? 1 : 0; # ifndef NO_BOLDFONT wf = (j && r->TermWin.bfont) ? r->TermWin.bfont : r->TermWin.font; # endif /* ** TODO: consider if anything special needs to happen ** with: ** #if defined(MULTICHAR_SET) && ** !defined(NO_BOLDOVERSTRIKE_MULTI) */ is_font_char = (wf->per_char && IS_FONT_CHAR(wf, t)) ? 1:0; if (!is_font_char || FONT_LBEAR(wf, t) < 0) { if (col == 0) clearfirst = 1; else dtp[col - 1] = 0; } if (!is_font_char || (FONT_WIDTH(wf, t) < (FONT_RBEAR(wf, t) + j))) { if (col == r->TermWin.ncol - 1) clearlast = 1; else clear_next = 1; } } } #endif /* NO_PIXEL_DROPPING_AVOIDANCE */ /* End of E1 */ /* ** E2: OK, now the real pass */ ypixelc = (int)Row2Pixel(row); for (col = 0; col < r->TermWin.ncol; col++) { /* current font size != base font size */ unsigned char fontdiff, /* proportional font used */ fprop; /* rendition value */ rend_t rend; /* screen rendition (target rendtion) */ rend = srp[col]; /* * compare new text with old - if exactly the same then continue */ if ( /* Must match characters to skip. */ stp[col] == dtp[col] && /* Either rendition the same or */ ( rend == drp[col] || /* space w/ no background change */ ( stp[col] == ' ' && GET_BGATTR(rend) == GET_BGATTR(drp[col]) ) ) ) /* if */ { if (!IS_MULTI1(rend)) continue; #ifdef MULTICHAR_SET else { /* first byte is Kanji so compare second bytes */ if (stp[col + 1] == dtp[col + 1]) { /* assume no corrupt characters on the screen */ col++; continue; } } #endif } /* redraw one or more characters */ fontdiff = 0; len = 0; buffer[len++] = dtp[col] = stp[col]; drp[col] = rend; xpixel = Col2Pixel(col); /* * Find out the longest string we can write out at once */ #ifndef NO_BOLDFONT if (MONO_BOLD(rend) && r->TermWin.bfont != NULL) fprop = (r->TermWin.propfont & PROPFONT_BOLD); else #endif fprop = (r->TermWin.propfont & PROPFONT_NORMAL); #ifdef MULTICHAR_SET if ( IS_MULTI1(rend) && col < r->TermWin.ncol - 1 && IS_MULTI2(srp[col + 1]) ) { if (!wbyte && r->TermWin.mfont) { wbyte = 1; XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.mfont->fid); fontdiff = (r->TermWin.propfont & PROPFONT_MULTI); #ifdef XFT_SUPPORT if ( ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt ) { drawfunc = XFT_DRAW_STRING_16; image_drawfunc = XFT_DRAW_IMAGE_STRING_16; } else #endif { drawfunc = X11_DRAW_STRING_16; image_drawfunc = X11_DRAW_IMAGE_STRING_16; } } if (r->TermWin.mfont == NULL) { buffer[0] = buffer[1] = ' '; len = 2; col++; } else { /* double stepping - we're in multibyte font mode */ for (; ++col < r->TermWin.ncol;) { /* XXX: could check sanity on 2nd byte */ dtp[col] = stp[col]; drp[col] = srp[col]; buffer[len++] = stp[col]; col++; /* proportional multibyte font mode */ if (fprop) break; if ((col == r->TermWin.ncol) || (srp[col] != rend)) break; if ((stp[col] == dtp[col]) && (srp[col] == drp[col]) && (stp[col + 1] == dtp[col + 1])) break; if (len == h->currmaxcol) break; dtp[col] = stp[col]; drp[col] = srp[col]; buffer[len++] = stp[col]; } col--; } if (buffer[0] & 0x80) (h->multichar_decode)( (unsigned char*) buffer, len); wlen = len / 2; } else { if (rend & RS_multi1) { /* corrupt character - you're outta there */ rend &= ~RS_multiMask; drp[col] = rend; /* TODO check: may also want */ dtp[col] = ' '; /* to poke into stp/srp */ buffer[0] = ' '; } if (wbyte) { wbyte = 0; #ifdef XFT_SUPPORT if (!(ISSET_OPTION(r, Opt_xft) && r->TermWin.xftfont)) #endif XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.font->fid); #ifdef XFT_SUPPORT if ( ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt ) { drawfunc = XFT_DRAW_STRING_8; image_drawfunc = XFT_DRAW_IMAGE_STRING_8; } else #endif { drawfunc = X11_DRAW_STRING_8; image_drawfunc = X11_DRAW_IMAGE_STRING_8; } } /* if (wbyte) */ #else { /* add } for correct % bouncing */ #endif if (!fprop) { int echars; /* single stepping - `normal' mode */ for (i = 0, echars=0; ++col < r->TermWin.ncol - 1;) { /* * Instead of simply getting the longest string that * needs to be refreshed, we do some caching. * * i is the number of trailing chars that we read (in an * attempt to cache) that DO NOT need to be refreshed. * These had better be dumped. * * echars are the number of extra chars we drew that did * not need to be drawn. When echars get's too high, * then we should break out. */ if (rend != srp[col]) /* Different attributes. */ break; buffer[len++] = stp[col]; if ( (stp[col] != dtp[col]) || (srp[col] != drp[col]) ) { /* This position needed to be refreshed anyway */ /* if (must_clear && (i++ > (len / 2))) break; */ dtp[col] = stp[col]; drp[col] = srp[col]; i = 0; /* Set trailing chars to 0 */ } else /* if (must_clear || (stp[col] != ' ' && ++i > 32)) */ { /* * This position did not require a refresh. Let's do * some caching. */ i++; /* * 25% (arbitarily choosen) of our drawn string can * be extra chars. */ if( ++echars > (len >> 2) ) break; } } /* for */ col--; /* went one too far. move back */ len -= i; /* dump any matching trailing chars */ rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Drawing %d(%d) chars: %.*s\n", len, echars-i, (len > 55) ? 55 : len, buffer)); } /* if (!fprop) */ wlen = len; } buffer[len] = '\0'; /* * Determine the attributes for the string */ fore = GET_FGCOLOR(rend); back = GET_BGCOLOR(rend); rend = GET_ATTR(rend); switch (rend & RS_fontMask) { case RS_acsFont: for (i = 0; i < len; i++) /* * Xterm leaves 0x5f (_) unchanged in graphics mode. */ if (buffer[i] > 0x5f && buffer[i] < 0x7f) buffer[i] -= 0x5f; break; case RS_ukFont: for (i = 0; i < len; i++) if (buffer[i] == '#') buffer[i] = 0x1e; /* pound sign */ break; } #ifndef NO_BOLD_UNDERLINE_REVERSE /* * Bold / underline fonts. We use Color_BD / Color_UL only if we're * displaying the font with normal colors. */ if( fore == Color_fg && back == Color_bg ) { /* * TODO: Should probably add a Color_BDUL here. */ if ( rend & RS_Bold ) { if ( XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_BD) && r->pixColors[fore] != r->pixColors[Color_BD] && r->pixColors[back] != r->pixColors[Color_BD] ) { fore = Color_BD; /* * 2006-03-27 gi1242: Ignore veryBold when Color_BD is * set. veryBold will only be used when displaying * colored / blinking text. */ #if 0 if (NOTSET_OPTION(r, Opt2_veryBold)) #endif rend &= ~RS_Bold; /* we've taken care of it */ } } else if ( rend & RS_Uline ) { if ( XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_UL) && r->pixColors[fore] != r->pixColors[Color_UL] && r->pixColors[back] != r->pixColors[Color_UL] ) { fore = Color_UL; rend &= ~RS_Uline; /* we've taken care of it */ } } } #endif rvid = (rend & RS_RVid) ? 1 : 0; #ifdef OPTION_HC /* * Use Color_HC for anything blinking. TODO: Add a seperate * attribute for the XSelection, so that the user can distinguish * blinking text from the selection. (XTerm does this) */ if ( (rend & RS_Blink)) { if ( XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_HC) && r->pixColors[fore] != r->pixColors[Color_HC] && r->pixColors[back] != r->pixColors[Color_HC] # ifndef NO_CURSORCOLOR /* Don't do this for the cursor */ && ( !ISSET_PIXCOLOR(h, Color_cursor) || !r->TermWin.focus || !showcursor || CURROW != row || CURCOL != col ) # endif ) { if( rvid) rvid = 0; back = Color_HC; } else rvid = 1; /* fall back */ } #endif /* * Reverse Video. If defined, Color_RV for background and leave * foreground untouched. Done last so that RV-BD text will have * Color_BD background if set (like in XTerm). */ if( rvid ) { #ifndef NO_BOLD_UNDERLINE_REVERSE if ( XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_RV) && r->pixColors[fore] != r->pixColors[Color_RV] && r->pixColors[back] != r->pixColors[Color_RV] # ifndef NO_CURSORCOLOR /* Don't do this for the cursor */ && ( !ISSET_PIXCOLOR(h, Color_cursor) || !r->TermWin.focus || !showcursor || CURROW != row || CURCOL != col ) # endif ) back = Color_RV; else #endif { #ifdef TTY_256COLOR SWAP_IT(fore, back, uint16_t); #else SWAP_IT(fore, back, unsigned char); #endif } } #ifndef NO_BRIGHTCOLOR /* Use bright colors for bold primary colors */ if( (rend & RS_Bold) && NOTSET_OPTION( r, Opt2_boldColors ) ) { if( fore >= minCOLOR && fore < minBrightCOLOR ) { fore += minBrightCOLOR - minCOLOR; if( NOTSET_OPTION( r, Opt_veryBright ) ) rend &= ~RS_Bold; } #if defined(TTY_256COLOR) && defined(BOLD_BRIGHTENS_256_COLORS) /* If fore is in the 6x6x6 color cube, try and brighten it */ else if( fore >= min256COLOR && fore <= min256COLOR + 4*36 + 4*6 + 4 && (fore - min256COLOR) % 6 < 5 && ((fore - min256COLOR)/6) % 6 < 5 ) { fore += 36 + 6 + 1; if( NOTSET_OPTION( r, Opt_veryBright ) ) rend &= ~RS_Bold; } /* Brighten up colors in the grey-scale ramp. */ else if( fore >= min256COLOR + 6*6*6 && fore <= max256COLOR - 3 ) { if( fore == max256COLOR -3 ) fore = min256COLOR + 6*6*6 - 1; else fore += 4; if( NOTSET_OPTION( r, Opt_veryBright ) ) rend &= ~RS_Bold; } #endif /*TTY_256COLOR && BOLD_BRIGHTENS_256_COLORS*/ } #endif /*NO_BRIGHTCOLOR*/ /* * fore and back should now have the correct colors. */ gcmask = 0; if (back != Color_bg) { gcvalue.background = r->pixColors[back]; gcmask = GCBackground; } if (fore != Color_fg) { gcvalue.foreground = r->pixColors[fore]; gcmask |= GCForeground; } #ifndef NO_BOLD_UNDERLINE_REVERSE else if (rend & RS_Bold && ISSET_PIXCOLOR( h, Color_BD) ) { # ifdef XFT_SUPPORT /* * XFT won't use the colors from the GC, so we need to set * fore. */ if( ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt ) fore = Color_BD; else # endif { gcvalue.foreground = r->pixColors[Color_BD]; gcmask |= GCForeground; } /* * If veryBold is not set, then don't render colored text in * bold. */ if (NOTSET_OPTION(r, Opt2_veryBold)) rend &= ~RS_Bold; } else if (rend & RS_Uline && ISSET_PIXCOLOR( h, Color_UL) ) { # ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt ) fore = Color_UL; else # endif { gcvalue.foreground = r->pixColors[Color_UL]; gcmask |= GCForeground; } rend &= ~RS_Uline; /* we've taken care of it */ } #endif if (gcmask) XChangeGC(r->Xdisplay, r->TermWin.gc, gcmask, &gcvalue); #ifndef NO_BOLDFONT /* * Switch to the bold font if we are rendering bold text. * * NOTE: We only deal with bold fonts for non-multichar text. * Multichar bold text will have to be done by over striking (or * some other shmuck must code it) -- gi1242 2006-08-19. */ if ( MONO_BOLD_FG(rend, fore) && !wbyte ) { if( usingBoldFt ) rend &= ~RS_Bold; /* We've taken care of it */ else if( loadedBoldFt ) { usingBoldFt = 1; # ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) ) { SWAP_IT( r->TermWin.xftfont, r->TermWin.xftbfont, XftFont*); } else # endif { XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.bfont->fid); } fontdiff = (r->TermWin.propfont & PROPFONT_BOLD); rend &= ~RS_Bold; /* we've taken care of it */ } } /* * If we are using the bold font, but don't want to render bold * text, then we should restore the original font. */ else if( usingBoldFt && !MONO_BOLD_FG( rend, fore ) ) { usingBoldFt = 0; /* * If we're not showing a multi byte char, then we reset * fontdiff to 0. If we're showing a multi byte char, then font * diff will have been set elsewhere, and we should not reset * it. */ if( !wbyte ) fontdiff = 0; # ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) ) { SWAP_IT( r->TermWin.xftfont, r->TermWin.xftbfont, XftFont*); } else # endif { XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.font->fid); } } #endif /* * Actually do the drawing of the string here */ if (back == Color_bg && must_clear) { CLEAR_CHARS( r, page, already_cleared, xpixel, ypixelc, len); for (i = 0; i < len; i++) /* don't draw empty strings */ if (buffer[i] != ' ') { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "CL Drawing '%.60s' (%d)\n", buffer, len)); rxvt_scr_draw_string (r, page, xpixel, ypixelc, buffer, wlen, drawfunc, fore, back, rend, ((refresh_type & CLIPPED_REFRESH) ? r->h->refreshRegion : None )); break; } } else if (fprop || fontdiff) { /* single glyph writing */ unsigned long pixel; pixel = gcvalue.foreground; gcvalue.foreground = gcvalue.background; XChangeGC(r->Xdisplay, r->TermWin.gc, GCForeground, &gcvalue); rxvt_fill_rectangle (r, page, xpixel, ypixelc, (unsigned int) Width2Pixel(len), (unsigned int) (Height2Pixel(1) /* - r->TermWin.lineSpace */)); gcvalue.foreground = pixel; XChangeGC(r->Xdisplay, r->TermWin.gc, GCForeground, &gcvalue); rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "PF Drawing '%.60s' (%d)\n", buffer, len)); rxvt_scr_draw_string (r, page, xpixel, ypixelc, buffer, wlen, drawfunc, fore, back, rend, ((refresh_type & CLIPPED_REFRESH) ? r->h->refreshRegion : None )); } else { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "NC Drawing '%.60s' (%d)\n", buffer, len)); rxvt_scr_draw_string (r, page, xpixel, ypixelc, buffer, wlen, image_drawfunc, fore, back, rend, ((refresh_type & CLIPPED_REFRESH) ? r->h->refreshRegion : None )); } #ifndef NO_BOLDOVERSTRIKE # ifdef NO_BOLDOVERSTRIKE_MULTI if (!wbyte) # endif if (MONO_BOLD_FG(rend, fore)) { /* * If we still need to draw a bold chars, then all else has * failed. Fall back to overstriking. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "Overstriking %s\n", buffer )); rxvt_scr_draw_string (r, page, xpixel + 1, ypixelc, buffer, wlen, drawfunc, fore, back, rend, ((refresh_type & CLIPPED_REFRESH) ? r->h->refreshRegion : None )); } #endif if (rend & RS_Uline) { #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && PVTS(r, page)->xftvt) { if (r->TermWin.xftfont->descent > 1) XDrawLine(r->Xdisplay, drawBuffer, r->TermWin.gc, xpixel, ypixelc + r->TermWin.xftfont->ascent + 1, xpixel + Width2Pixel(len) - 1, ypixelc + r->TermWin.xftfont->ascent + 1); } else #endif if (r->TermWin.font->descent > 1) XDrawLine(r->Xdisplay, drawBuffer, r->TermWin.gc, xpixel, ypixelc + r->TermWin.font->ascent + 1, xpixel + Width2Pixel(len) - 1, ypixelc + r->TermWin.font->ascent + 1); } if (gcmask) /* restore normal colours */ { gcvalue.foreground = r->pixColors[Color_fg]; gcvalue.background = r->pixColors[Color_bg]; XChangeGC(r->Xdisplay, r->TermWin.gc, gcmask, &gcvalue); } } /* for (col....) */ /* End of E2 */ } /* for (row....) */ /* * If we've completed our refresh, and are using the bold font, we need to * reset it. Only needed when using XFT. */ if( usingBoldFt ) { usingBoldFt = 0; #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) ) { SWAP_IT( r->TermWin.xftfont, r->TermWin.xftbfont, XftFont*); } else # endif { XSetFont(r->Xdisplay, r->TermWin.gc, r->TermWin.font->fid); } } /* End of E */ /* ** G: cleanup cursor and display outline cursor in necessary */ if (showcursor) { if (r->TermWin.focus) { int currow = CURROW + SVLINES; srp = &(PSCR(r, page).rend[currow][CURCOL]); *srp ^= RS_RVid; #ifndef NO_CURSORCOLOR *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc1; #endif #ifdef MULTICHAR_SET if (morecur) { assert (0 == morecur || -1 == morecur || 1 == morecur); srp += morecur; *srp ^= RS_RVid; # ifndef NO_CURSORCOLOR *srp = (*srp & ~(RS_fgMask | RS_bgMask)) | cc2; # endif } #endif } else if (h->oldcursor.row >= 0) { #ifndef NO_CURSORCOLOR unsigned long gcmask; /* Graphics Context mask */ gcmask = 0; if (XDEPTH > 2 && ISSET_PIXCOLOR(h, Color_cursor)) { gcvalue.foreground = r->pixColors[Color_cursor]; gcmask = GCForeground; XChangeGC(r->Xdisplay, r->TermWin.gc, gcmask, &gcvalue); gcvalue.foreground = r->pixColors[Color_fg]; } #endif XDrawRectangle(r->Xdisplay, drawBuffer, r->TermWin.gc, Col2Pixel(h->oldcursor.col + morecur), Row2Pixel(h->oldcursor.row), (unsigned int)(Width2Pixel(1 + (morecur?1:0)) - 1), (unsigned int)(Height2Pixel(1) /* - r->TermWin.lineSpace*/ - 1)); #ifndef NO_CURSORCOLOR if (gcmask) /* restore normal colours */ XChangeGC(r->Xdisplay, r->TermWin.gc, gcmask, &gcvalue); #endif } } /* End of G */ /* ** H: cleanup selection */ rxvt_scr_reverse_selection(r, page); /* ** I: other general cleanup */ /* ** clear the whole screen height, note that width == 0 is treated ** specially by XClearArea */ if (clearfirst && r->TermWin.int_bwidth) rxvt_clear_area (r, page, 0, 0, (unsigned int)r->TermWin.int_bwidth, VT_HEIGHT(r)); /* ** clear the whole screen height, note that width == 0 is treated ** specially by XClearArea */ if (clearlast && r->TermWin.int_bwidth) rxvt_clear_area (r, page, TWIN_WIDTH(r) + r->TermWin.int_bwidth, 0, (unsigned int)r->TermWin.int_bwidth, VT_HEIGHT(r)); if (refresh_type & SMOOTH_REFRESH) XSync(r->Xdisplay, False); if( (refresh_type & CLIPPED_REFRESH) && IS_REGION(h->refreshRegion)) { /* * A clipped refresh is complete. Don't restrict future refreshes. */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "Completed clipped refresh\n")); /* * XSetRegion( r->Xdisplay, r->TermWin.gc, None) causes a segfault. * Probably because GC's dont' accept the None region as gracefully. */ XSetClipMask( r->Xdisplay, r->TermWin.gc, None); #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && PVTS( r, page)->xftvt) XftDrawSetClip( PVTS( r, page)->xftvt, None); #endif } else /* If we performed an unclipped refresh, then the screen is current */ PVTS(r, page)->want_refresh = 0; h->refresh_type &= ~CLIPPED_REFRESH; h->want_clip_refresh = 0; /* clipping is current (regardless of wether we performed a clipped refresh or not. */ /* Clipping regions will now carry stale information. */ if (IS_REGION(h->refreshRegion)) { XDestroyRegion( h->refreshRegion ); UNSET_REGION(h->refreshRegion); } PVTS(r, page)->num_scr = 0; h->num_scr_allow = 1; } #undef X11_DRAW_STRING_8 #undef X11_DRAW_STRING_16 #undef X11_DRAW_IMAGE_STRING_8 #undef X11_DRAW_IMAGE_STRING_16 #undef XFT_DRAW_STRING_8 #undef XFT_DRAW_STRING_16 #undef XFT_DRAW_STRING_32 #undef XFT_DRAW_STRING_UTF8 /* ------------------------------------------------------------------------- */ /* EXTPROTO */ void rxvt_scr_clear(rxvt_t* r, int page) { if (!PVTS(r, page)->mapped) return; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_scr_clear()\n")); r->h->num_scr_allow = 0; PVTS(r, page)->want_refresh = 1; #ifdef TRANSPARENT if( ISSET_OPTION(r, Opt_transparent) ) { if (IS_WIN(r->TermWin.parent)) XClearWindow(r->Xdisplay, r->TermWin.parent); } #endif XClearWindow(r->Xdisplay, PVTS(r, page)->vt); } /* ------------------------------------------------------------------------- */ /* INTPROTO */ void rxvt_scr_reverse_selection(rxvt_t* r, int page) { int i, col, row, end_row; rend_t *srp; if ( SEL(r).op && SEL(r).vt == page && PVTS(r, page)->current_screen == SEL(r).screen ) { end_row = SVLINES - VSTART; i = SEL(r).beg.row + SVLINES; row = SEL(r).end.row + SVLINES; if (i >= end_row) col = SEL(r).beg.col; else { col = 0; i = end_row; } end_row += r->TermWin.nrow; for (; i < row && i < end_row; i++, col = 0) for (srp = PSCR(r, page).rend[i]; col < r->TermWin.ncol; col++) #ifndef OPTION_HC srp[col] ^= RS_RVid; #else srp[col] ^= RS_Blink; #endif if (i == row && i < end_row) for (srp = PSCR(r, page).rend[i]; col < SEL(r).end.col; col++) #ifndef OPTION_HC srp[col] ^= RS_RVid; #else srp[col] ^= RS_Blink; #endif } } /* ------------------------------------------------------------------------- */ /* * Dump the whole scrollback and screen to the passed filedescriptor. The * invoking routine must close the fd. */ #if 0 /* EXTPROTO */ void rxvt_scr_dump(rxvt_t* r, int fd) { int row, wrote; unsigned int width, towrite; char r1[] = "\n"; for ( row = SVLINES - PVTS(r, page)->nscrolled; row < SVLINES + r->TermWin.nrow - 1; row++ ) { width = PSCR(r, page).tlen[row] >= 0 ? PSCR(r, page).tlen[row] : r->TermWin.ncol; for (towrite = width; towrite; towrite -= wrote) { wrote = write(fd, &(PSCR(r, page).text[row][width - towrite]), towrite); if (wrote < 0) return; /* XXX: death, no report */ } if (PSCR(r, page).tlen[row] >= 0) if (write(fd, r1, 1) <= 0) return; /* XXX: death, no report */ } } #endif /* ------------------------------------------------------------------------- * * CHARACTER SELECTION * * ------------------------------------------------------------------------- */ /* * -PVTS(r, page)->nscrolled <= (selection row) <= r->TermWin.nrow - 1 */ /* EXTPROTO */ void rxvt_selection_check(rxvt_t* r, int page, int check_more) { row_col_t pos; if (!SEL(r).op || SEL(r).vt != page || SEL(r).screen != PVTS(r, page)->current_screen) return; pos.row = pos.col = 0; if ( (SEL(r).beg.row < -(int32_t)PVTS(r, page)->nscrolled) || (SEL(r).beg.row >= r->TermWin.nrow) || (SEL(r).mark.row < -(int32_t)PVTS(r, page)->nscrolled) || (SEL(r).mark.row >= r->TermWin.nrow) || (SEL(r).end.row < -(int32_t)PVTS(r, page)->nscrolled) || (SEL(r).end.row >= r->TermWin.nrow) || ( check_more == 1 && PVTS(r, page)->current_screen == SEL(r).screen && !RC_BEFORE(PSCR(r, page).cur, SEL(r).beg) && RC_BEFORE(PSCR(r, page).cur, SEL(r).end)) || ( check_more == 2 && RC_BEFORE(SEL(r).beg, pos) && RC_AFTER(SEL(r).end, pos)) || ( check_more == 3 && RC_AFTER(SEL(r).end, pos)) || ( check_more == 4 /* screen width change */ && ( SEL(r).beg.row != SEL(r).end.row || SEL(r).end.col > r->TermWin.ncol)) ) { CLEAR_SELECTION(r); } } /* ------------------------------------------------------------------------- */ /* * Paste a selection direct to the command fd */ /* INTPROTO */ void rxvt_paste_str(rxvt_t* r, int page, const unsigned char *data, unsigned int nitems) { unsigned int i, j, n; unsigned char *ds = rxvt_malloc(PROP_SIZE); /* * Convert normal newline chars into common keyboard Return key sequence */ for (i = 0; i < nitems; i += PROP_SIZE) { n = min(nitems - i, PROP_SIZE); MEMCPY(ds, data + i, n); for (j = 0; j < n; j++) if (ds[j] == '\n') ds[j] = '\r'; rxvt_tt_write(r, page, ds, (int)n); } rxvt_free(ds); } /* ------------------------------------------------------------------------- */ /* * Respond to a notification that a primary selection has been sent * EXT: SelectionNotify */ /* EXTPROTO */ int rxvt_selection_paste(rxvt_t* r, Window win, Atom prop, Bool delete_prop) { long nread = 0; unsigned long bytes_after; XTextProperty ct; #ifdef MULTICHAR_SET int dummy_count; char** cl; #endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_paste (%08lx, %lu, %d), wait=%2x\n", win, (unsigned long)prop, (int)delete_prop, r->h->selection_wait)); if (NOT_ATOM(prop)) /* check for failed XConvertSelection */ { #ifdef MULTICHAR_SET if ((r->h->selection_type & Sel_CompoundText)) { int selnum = r->h->selection_type & Sel_whereMask; r->h->selection_type = 0; if (selnum != Sel_direct) rxvt_selection_request_other(r, ATAB(r), XA_STRING, selnum); } #endif return 0; } for (;;) { if( XGetWindowProperty( r->Xdisplay, win, prop, (long) (nread/4), (long) (PROP_SIZE / 4), delete_prop, AnyPropertyType, &ct.encoding, &ct.format, &ct.nitems, &bytes_after, &ct.value) != Success ) break; if( ct.encoding == None ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_paste: property didn't exist!\n")); break; } if (ct.value == NULL) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_paste: property shooting blanks!\n")); continue; } if (ct.nitems == 0) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_paste: property empty - also INCR end\n")); if( r->h->selection_wait == Sel_normal && nread == 0 ) { /* * pass through again trying CUT_BUFFER0 if we've come from * XConvertSelection() but nothing was presented */ rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request: pasting CUT_BUFFER0\n")); rxvt_selection_paste(r, XROOT, XA_CUT_BUFFER0, False); } nread = -1; /* discount any previous stuff */ break; } nread += ct.nitems; #ifdef MULTICHAR_SET if ( XmbTextPropertyToTextList(r->Xdisplay, &ct, &cl, &dummy_count) == Success && cl ) { rxvt_paste_str(r, ATAB(r), (const unsigned char*) cl[0], STRLEN(cl[0])); XFreeStringList(cl); } else #endif rxvt_paste_str(r, ATAB(r), ct.value, (unsigned int) ct.nitems); if( bytes_after == 0 ) break; XFree(ct.value); ct.value = 0; } if (ct.value) XFree(ct.value); if (r->h->selection_wait == Sel_normal) r->h->selection_wait = Sel_none; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_paste: bytes written: %ld\n", nread)); return (int)nread; } /* * INCR support originally provided by Paul Sheer */ /* EXTPROTO */ void rxvt_selection_property(rxvt_t* r, Window win, Atom prop) { int reget_time = 0; if (NOT_ATOM(prop)) return; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_property(%08lx, %lu)\n", win, (unsigned long)prop)); if (r->h->selection_wait == Sel_normal) { int a, afmt; Atom atype; unsigned long bytes_after, nitems; unsigned char *s = NULL; a = XGetWindowProperty(r->Xdisplay, win, prop, 0L, 1L, False, r->h->xa[XA_INCR], &atype, &afmt, &nitems, &bytes_after, &s); if (s) XFree(s); if (a != Success) return; #ifndef OS_CYGWIN if (atype == r->h->xa[XA_INCR]) /* start an INCR transfer */ { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_property: INCR: starting transfer\n")); XDeleteProperty(r->Xdisplay, win, prop); XFlush(r->Xdisplay); reget_time = 1; r->h->selection_wait = Sel_incr; } #endif } else if (r->h->selection_wait == Sel_incr) { reget_time = 1; if (rxvt_selection_paste(r, win, prop, True) == -1) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_property: INCR: clean end\n")); r->h->selection_wait = Sel_none; r->h->timeout[TIMEOUT_INCR].tv_sec = 0; /* turn off timer */ } } if (reget_time) /* received more data so reget time */ { gettimeofday( &(r->h->timeout[TIMEOUT_INCR]), NULL); /* ten seconds wait */ r->h->timeout[TIMEOUT_INCR].tv_sec += 10; } } /* ------------------------------------------------------------------------- */ /* * Request the content of a selection buffer: * * EXT: button 2 release */ /* EXTPROTO */ void rxvt_selection_request_by_sel(rxvt_t* r, int page, Time tm, int x, int y,int sel) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request %d (%lu, %d, %d)\n", page, tm, x, y )); if (x < 0 || x >= VT_WIDTH(r) || y < 0 || y >= VT_HEIGHT(r)) return; /* outside window */ r->h->selection_request_time = tm; r->h->selection_wait = Sel_normal; #ifdef MULTICHAR_SET r->h->selection_type = Sel_CompoundText; #else r->h->selection_type = 0; #endif rxvt_selection_request_other(r, page, #ifdef MULTICHAR_SET r->h->xa[XA_COMPOUND_TEXT], #else XA_STRING, #endif sel); } /* ------------------------------------------------------------------------- */ /* * Request the current selection: * Order: > internal selection if available * > PRIMARY, SECONDARY, CLIPBOARD if ownership is claimed (+) * > CUT_BUFFER0 * (+) if ownership is claimed but property is empty, rxvt_selection_paste() * will auto fallback to CUT_BUFFER0 * EXT: button 2 release */ /* EXTPROTO */ void rxvt_selection_request(rxvt_t* r, int page, Time tm, int x, int y) { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request %d (%lu, %d, %d)\n", page, tm, x, y )); if (x < 0 || x >= VT_WIDTH(r) || y < 0 || y >= VT_HEIGHT(r)) return; /* outside window */ if( SEL(r).text != NULL ) /* internal selection */ { rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request %d: pasting internal\n", page )); rxvt_paste_str( r, page, SEL(r).text, SEL(r).len ); return; } else { int i; r->h->selection_request_time = tm; r->h->selection_wait = Sel_normal; for (i = Sel_Primary; i <= Sel_Clipboard; i++) { #ifdef MULTICHAR_SET r->h->selection_type = Sel_CompoundText; #else r->h->selection_type = 0; #endif if (rxvt_selection_request_other(r, page, #ifdef MULTICHAR_SET r->h->xa[XA_COMPOUND_TEXT], #else XA_STRING, #endif i)) return; } } /* don't loop in rxvt_selection_paste() */ r->h->selection_wait = Sel_none; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request %d: pasting CUT_BUFFER0\n", page )); rxvt_selection_paste(r, XROOT, XA_CUT_BUFFER0, False); } /* INTPROTO */ int rxvt_selection_request_other(rxvt_t* r, int page, Atom target, int selnum) { Atom sel; #ifdef DEBUG char *debug_xa_names[] = { "PRIMARY", "SECONDARY", "CLIPBOARD" }; #endif r->h->selection_type |= selnum; if (selnum == Sel_Primary) sel = XA_PRIMARY; else if (selnum == Sel_Secondary) sel = XA_SECONDARY; else sel = r->h->xa[XA_CLIPBOARD]; if (XGetSelectionOwner(r->Xdisplay, sel) != None) { rxvt_dbgmsg(( DBG_DEBUG, DBG_SCREEN, "rxvt_selection_request_other %d: " "pasting %s\n", page, debug_xa_names[selnum] )); XConvertSelection(r->Xdisplay, sel, target, r->h->xa[XA_VT_SELECTION], PVTS(r, page)->vt, r->h->selection_request_time); return 1; } return 0; } /* ------------------------------------------------------------------------- */ /* * Paste the content of the file specified by filename to the * currently active tab * EXT: button 2 release */ /* EXTPROTO */ void rxvt_paste_file(rxvt_t* r, int page, Time tm, int x, int y, char* filename) { rxvt_dbgmsg(( DBG_DEBUG, DBG_SCREEN, "rxvt_paste_file %d (%lu, %d, %d) %s\n", page, tm, x, y, filename )); if (x < 0 || x >= VT_WIDTH(r) || y < 0 || y >= VT_HEIGHT(r)) return; /* outside window */ char buffer[BUFSIZ]; char TAINTED * str; FILE * fdpaste; #ifdef HAVE_WORDEXP_H wordexp_t p; int wordexp_result; /* perform a shell-like expansion of the provided filename */ wordexp_result = wordexp(filename, &p, 0); if( wordexp_result == 0 && p.we_wordc == 1 ) filename = *p.we_wordv; else { rxvt_msg( DBG_ERROR, DBG_SCREEN, "Error expanding %s, or possibly ambiguous expansion\n", filename ); rxvt_msg( DBG_INFO, DBG_SCREEN, "wordexp_result=%i\n", wordexp_result ); } #endif if (NOT_NULL(fdpaste = fopen( filename , "r"))) { while (NOT_NULL(str = fgets(buffer, sizeof(buffer), fdpaste))) rxvt_paste_str( r, page, (const unsigned char*) str , STRLEN(str)); fclose(fdpaste); } else { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_paste_file : unable to open file '%s'\n", filename)); } #ifdef HAVE_WORDEXP_H wordfree(&p); #endif return; } /* ------------------------------------------------------------------------- */ /* * Clear all selected text * EXT: SelectionClear */ /* EXTPROTO */ void rxvt_process_selectionclear(rxvt_t* r, int page) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_process_selectionclear %d ()\n", page)); PVTS(r, page)->want_refresh = 1; if (SEL(r).text) rxvt_free(SEL(r).text); SEL(r).text = NULL; SEL(r).len = 0; CLEAR_SELECTION(r); SEL(r).vt = -1; SEL(r).op = SELECTION_CLEAR; SEL(r).screen = PRIMARY; SEL(r).clicks = 0; } /* ------------------------------------------------------------------------- */ /* * Copy a selection into the cut buffer * EXT: button 1 or 3 release */ /* EXTPROTO */ void rxvt_selection_make(rxvt_t* r, int page, Time tm) { int i, col, end_col, row, end_row; unsigned char* new_selection_text; unsigned char* str; text_t* t; #ifdef MULTICHAR_SET rend_t* tr; #endif #ifdef ACS_ASCII rend_t* re; #endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_make %d (): sel.op=%d, sel.clicks=%d\n", page, SEL(r).op, SEL(r).clicks)); switch (SEL(r).op) { case SELECTION_CONT: break; case SELECTION_INIT: CLEAR_SELECTION(r); /* FALLTHROUGH */ case SELECTION_BEGIN: SEL(r).op = SELECTION_DONE; /* FALLTHROUGH */ default: return; } SEL(r).op = SELECTION_DONE; SEL(r).vt = page; /* update selection vt */ if (SEL(r).clicks == 4) return; /* nothing selected, go away */ assert ((SEL(r).end.row - SEL(r).beg.row + 1) > 0); assert ((r->TermWin.ncol + 1) > 0); i = (SEL(r).end.row - SEL(r).beg.row + 1) * (r->TermWin.ncol + 1) + 1; /* possible integer overflow? */ assert (i > 0); str = rxvt_malloc(i * sizeof(char)); new_selection_text = (unsigned char *)str; col = SEL(r).beg.col; MAX_IT(col, 0); row = SEL(r).beg.row + SVLINES; end_row = SEL(r).end.row + SVLINES; /* ** A: rows before end row */ for (; row < end_row; row++, col = 0) { t = &(PSCR(r, page).text[row][col]); #ifdef MULTICHAR_SET tr = &(PSCR(r, page).rend[row][col]); #endif /* MULTICHAR_SET */ #ifdef ACS_ASCII re = &(PSCR(r, page).rend[row][col]); #endif if ((end_col = PSCR(r, page).tlen[row]) == -1) end_col = r->TermWin.ncol; /* ** Looks like a completely mess. Think about the logic here ** carefully. ;-) ** Patch source: ** http://gentoo.nedlinux.nl/distfiles/rxvt-2.7.10-rk.patch */ for (; col < end_col; col++, str++, t++) { #ifdef MULTICHAR_SET if ( (ENC_EUCJ == r->encoding_method) && (*t & 0x80) && !(*tr & RS_multiMask) ) { *str++ = 0x8E; } tr ++; #endif /* MULTICHAR_SET */ #ifdef ACS_ASCII if ((*re++ & RS_acsFont) && *t >= 0x60 && *t < 0x80) *str = r->h->rs[Rs_acs_chars][(*t) - 0x60]; else #endif /* ACS_ASCII */ *str = *t; } if (PSCR(r, page).tlen[row] != -1) { #ifdef DONT_SELECT_TRAILING_SPACES STRIP_TRAILING_SPACE(str, new_selection_text); #endif *str++ = '\n'; } } /* ** B: end row */ t = &(PSCR(r, page).text[row][col]); #ifdef MULTICHAR_SET tr = &(PSCR(r, page).rend[row][col]); #endif /* MULTICHAR_SET */ #ifdef ACS_ASCII re = &(PSCR(r, page).rend[row][col]); #endif end_col = PSCR(r, page).tlen[row]; if (end_col == -1 || SEL(r).end.col <= end_col) end_col = SEL(r).end.col; MIN_IT(end_col, r->TermWin.ncol); /* CHANGE */ /* ** Looks like a completely mess. Think about the logic here ** carefully. ;-) ** Patch source: ** http://gentoo.nedlinux.nl/distfiles/rxvt-2.7.10-rk.patch */ for (; col < end_col; col++, str++, t++) { #ifdef MULTICHAR_SET if ( (ENC_EUCJ == r->encoding_method) && (*t & 0x80) && !(*tr & RS_multiMask) ) { *str++ = 0x8E; } tr ++; #endif /* MULTICHAR_SET */ #ifdef ACS_ASCII if ((*re++ & RS_acsFont) && *t >= 0x60 && *t < 0x80) *str = r->h->rs[Rs_acs_chars][(*t) - 0x60]; else #endif /* ACS_ASCII */ *str = *t; } #ifdef DONT_SELECT_TRAILING_SPACES STRIP_TRAILING_SPACE(str, new_selection_text); #endif #ifndef NO_OLD_SELECTION if (r->selection_style == OLD_SELECT) if (end_col == r->TermWin.ncol) { *str++ = '\n'; } #endif #ifndef NO_NEW_SELECTION if (r->selection_style != OLD_SELECT) if (end_col != SEL(r).end.col) { *str++ = '\n'; } #endif *str = '\0'; if ((i = STRLEN((char *)new_selection_text)) == 0) { rxvt_free(new_selection_text); return; } SEL(r).len = i; if (SEL(r).text) rxvt_free(SEL(r).text); SEL(r).text = new_selection_text; XSetSelectionOwner(r->Xdisplay, XA_PRIMARY, PVTS(r, page)->vt, tm); if (XGetSelectionOwner(r->Xdisplay, XA_PRIMARY) != PVTS(r, page)->vt) rxvt_msg (DBG_ERROR, DBG_SCREEN, "can't get primary selection"); XChangeProperty(r->Xdisplay, XROOT, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, SEL(r).text, (int)SEL(r).len); r->h->selection_time = tm; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_make %d (): sel.len=%d\n", page, SEL(r).len)); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "sel.text=%s\n", SEL(r).text)); } /* ------------------------------------------------------------------------- */ /* * Mark or select text based upon number of clicks: 1, 2, or 3 * EXT: button 1 press */ /* EXTPROTO */ void rxvt_selection_click(rxvt_t* r, int page, int clicks, int x, int y) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_click %d (%d, %d, %d)\n", page, clicks, x, y)); SEL(r).vt = page; clicks = ((clicks - 1) % 3) + 1; SEL(r).clicks = clicks; /* save clicks so extend will work */ rxvt_selection_start_colrow(r, page, Pixel2Col(x), Pixel2Row(y)); if (clicks == 2 || clicks == 3) rxvt_selection_extend_colrow(r, page, SEL(r).mark.col, SEL(r).mark.row + VSTART, 0, /* button 3 */ 1, /* button press */ 0); /* click change */ } /* ------------------------------------------------------------------------- */ /* * Mark a selection at the specified col/row */ /* INTPROTO */ void rxvt_selection_start_colrow(rxvt_t* r, int page, int col, int row) { PVTS(r, page)->want_refresh = 1; SEL(r).mark.col = col; SEL(r).mark.row = row - VSTART; MAX_IT(SEL(r).mark.row, -(int32_t)PVTS(r, page)->nscrolled); MIN_IT(SEL(r).mark.row, (int32_t)r->TermWin.nrow - 1); MAX_IT(SEL(r).mark.col, 0); MIN_IT(SEL(r).mark.col, (int32_t)r->TermWin.ncol - 1); if (SEL(r).op) { /* clear the old selection */ SEL(r).beg.row = SEL(r).end.row = SEL(r).mark.row; SEL(r).beg.col = SEL(r).end.col = SEL(r).mark.col; } SEL(r).op = SELECTION_INIT; SEL(r).screen = PVTS(r, page)->current_screen; r->selection.vt = page; } /* ------------------------------------------------------------------------- */ /* * Word select: select text for 2 clicks * We now only find out the boundary in one direction */ /* what do we want: spaces/tabs are delimiters or cutchars or non-cutchars */ #define DELIMIT_TEXT(x) \ (((x) == ' ' || (x) == '\t') ? 2 : (STRCHR(r->h->rs[Rs_cutchars], (x)) != NULL)) #ifdef MULTICHAR_SET # define DELIMIT_REND(x) (((x) & RS_multiMask) ? 1 : 0) #else # define DELIMIT_REND(x) 1 #endif /* INTPROTO */ void rxvt_selection_delimit_word(rxvt_t* r, int page, enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) { int col, row, dirnadd, tcol, trow, w1, w2; row_col_t bound; text_t *stp; rend_t *srp; r->selection.vt = page; /* update selection vt */ if (dirn == UP) { bound.row = SVLINES - PVTS(r, page)->nscrolled - 1; bound.col = 0; dirnadd = -1; } else { bound.row = SVLINES + r->TermWin.nrow; bound.col = r->TermWin.ncol - 1; dirnadd = 1; } row = mark->row + SVLINES; col = mark->col; MAX_IT(col, 0); /* find the edge of a word */ stp = &(PSCR(r, page).text[row][col]); w1 = DELIMIT_TEXT(*stp); if (r->selection_style != NEW_SELECT) { if (w1 == 1) { stp += dirnadd; if (DELIMIT_TEXT(*stp) == 1) goto Old_Word_Selection_You_Die; col += dirnadd; } w1 = 0; } srp = (&PSCR(r, page).rend[row][col]); w2 = DELIMIT_REND(*srp); for (;;) { for (; col != bound.col; col += dirnadd) { stp += dirnadd; if (DELIMIT_TEXT(*stp) != w1) break; srp += dirnadd; if (DELIMIT_REND(*srp) != w2) break; } if ((col == bound.col) && (row != bound.row)) { if (PSCR(r, page).tlen[(row - (dirn == UP ? 1 : 0))] == -1) { trow = row + dirnadd; tcol = dirn == UP ? r->TermWin.ncol - 1 : 0; if (PSCR(r, page).text[trow] == NULL) break; stp = &(PSCR(r, page).text[trow][tcol]); srp = &(PSCR(r, page).rend[trow][tcol]); if (DELIMIT_TEXT(*stp) != w1 || DELIMIT_REND(*srp) != w2) break; row = trow; col = tcol; continue; } } break; } Old_Word_Selection_You_Die: rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_delimit_word %d (%s,...) @ (r:%3d, c:%3d) has boundary (r:%3d, c:%3d)\n", page, (dirn == UP ? "up " : "down"), mark->row, mark->col, row - SVLINES, col)); if (dirn == DN) col++; /* put us on one past the end */ /* Poke the values back in */ ret->row = row - SVLINES; ret->col = col; } /* ------------------------------------------------------------------------- */ /* * Extend the selection to the specified x/y pixel location * EXT: button 3 press; button 1 or 3 drag * flag == 0 ==> button 1 * flag == 1 ==> button 3 press * flag == 2 ==> button 3 motion */ /* EXTPROTO */ void rxvt_selection_extend(rxvt_t* r, int page, int x, int y, int flag) { int col, row; col = Pixel2Col(x); row = Pixel2Row(y); MAX_IT(row, 0); MIN_IT(row, (int)r->TermWin.nrow - 1); MAX_IT(col, 0); MIN_IT(col, (int)r->TermWin.ncol); #ifndef NO_NEW_SELECTION /* * If we're selecting characters (single click) then we must check first * if we are at the same place as the original mark. If we are then * select nothing. Otherwise, if we're to the right of the mark, you have to * be _past_ a character for it to be selected. */ if (r->selection_style != OLD_SELECT) { if ( ((SEL(r).clicks % 3) == 1) && !flag && ( col == SEL(r).mark.col && (row == SEL(r).mark.row + VSTART) ) ) { /* select nothing */ SEL(r).beg.row = SEL(r).end.row = 0; SEL(r).beg.col = SEL(r).end.col = 0; SEL(r).clicks = 4; PVTS(r, page)->want_refresh = 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_SCREEN, "rxvt_selection_extend %d () sel.clicks = 4\n", page)); return; } } #endif if (SEL(r).clicks == 4) SEL(r).clicks = 1; rxvt_selection_extend_colrow(r, page, col, row, !!flag, /* ? button 3 */ flag == 1 ? 1 : 0, /* ? button press */ 0); /* no click change */ } #ifdef MULTICHAR_SET /* INTPROTO */ void rxvt_selection_adjust_kanji(rxvt_t* r, int page) { int c1, r1; if (SEL(r).beg.col > 0) { r1 = SEL(r).beg.row + SVLINES; c1 = SEL(r).beg.col; if (IS_MULTI2(PSCR(r, page).rend[r1][c1]) && IS_MULTI1(PSCR(r, page).rend[r1][c1 - 1])) SEL(r).beg.col--; } if (SEL(r).end.col < r->TermWin.ncol) { r1 = SEL(r).end.row + SVLINES; c1 = SEL(r).end.col; if (IS_MULTI1(PSCR(r, page).rend[r1][c1 - 1]) && IS_MULTI2(PSCR(r, page).rend[r1][c1])) SEL(r).end.col++; } } #endif /* MULTICHAR_SET */ /* ------------------------------------------------------------------------- */ /* * Extend the selection to the specified col/row */ /* INTPROTO */ void rxvt_selection_extend_colrow(rxvt_t* r, int page, int32_t col, int32_t row, int button3, int buttonpress, int clickchange) { unsigned int ncol = r->TermWin.ncol; row_col_t pos; #ifndef NO_NEW_SELECTION int end_col; enum { LEFT, RIGHT } closeto = RIGHT; #endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_extend_colrow %d (c:%d, r:%d, %d, %d) clicks:%d, op:%d\n", page, col, row, button3, buttonpress, SEL(r).clicks, SEL(r).op)); rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_extend_colrow %d () ENT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)\n", page, SEL(r).beg.row, SEL(r).beg.col, SEL(r).mark.row, SEL(r).mark.col, SEL(r).end.row, SEL(r).end.col)); PVTS(r, page)->want_refresh = 1; switch (SEL(r).op) { case SELECTION_INIT: CLEAR_SELECTION(r); SEL(r).op = SELECTION_BEGIN; /* FALLTHROUGH */ case SELECTION_BEGIN: if (row != SEL(r).mark.row || col != SEL(r).mark.col || (!button3 && buttonpress)) SEL(r).op = SELECTION_CONT; break; case SELECTION_DONE: SEL(r).op = SELECTION_CONT; /* FALLTHROUGH */ case SELECTION_CONT: break; case SELECTION_CLEAR: rxvt_selection_start_colrow(r, page, col, row); /* FALLTHROUGH */ default: return; } if ( SEL(r).beg.col == SEL(r).end.col && SEL(r).beg.col != SEL(r).mark.col && SEL(r).beg.row == SEL(r).end.row && SEL(r).beg.row != SEL(r).mark.row ) { SEL(r).beg.col = SEL(r).end.col = SEL(r).mark.col; SEL(r).beg.row = SEL(r).end.row = SEL(r).mark.row; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_extend_colrow %d () " "ENT2 b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)\n", page, SEL(r).beg.row, SEL(r).beg.col, SEL(r).mark.row, SEL(r).mark.col, SEL(r).end.row, SEL(r).end.col)); } pos.col = col; pos.row = row; pos.row -= VSTART; /* adjust for scroll */ #ifndef NO_OLD_SELECTION /* ** This mimics some of the selection behaviour of version 2.20 ** and before. ** There are no ``selection modes'', button3 is always character ** extension. ** Note: button3 drag is always available, c.f. v2.20 ** Selection always terminates (left or right as appropriate) at ** the mark. */ if (r->selection_style == OLD_SELECT) { if (SEL(r).clicks == 1 || button3) { if (r->h->hate_those_clicks) { r->h->hate_those_clicks = 0; if (SEL(r).clicks == 1) { SEL(r).beg.row = SEL(r).mark.row; SEL(r).beg.col = SEL(r).mark.col; } else { SEL(r).mark.row = SEL(r).beg.row; SEL(r).mark.col = SEL(r).beg.col; } } if (RC_BEFORE(pos, SEL(r).mark)) { SEL(r).end.row = SEL(r).mark.row; SEL(r).end.col = SEL(r).mark.col + 1; SEL(r).beg.row = pos.row; SEL(r).beg.col = pos.col; } else { SEL(r).beg.row = SEL(r).mark.row; SEL(r).beg.col = SEL(r).mark.col; SEL(r).end.row = pos.row; SEL(r).end.col = pos.col + 1; } # ifdef MULTICHAR_SET rxvt_selection_adjust_kanji(r, page); # endif /* MULTICHAR_SET */ } else if (SEL(r).clicks == 2) { rxvt_selection_delimit_word(r, page, UP, &(SEL(r).mark), &(SEL(r).beg)); rxvt_selection_delimit_word(r, page, DN, &(SEL(r).mark), &(SEL(r).end)); r->h->hate_those_clicks = 1; } else if (SEL(r).clicks == 3) { SEL(r).beg.row = SEL(r).end.row = SEL(r).mark.row; SEL(r).beg.col = 0; SEL(r).end.col = ncol; r->h->hate_those_clicks = 1; } rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_extend_colrow %d () EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)\n", page, SEL(r).beg.row, SEL(r).beg.col, SEL(r).mark.row, SEL(r).mark.col, SEL(r).end.row, SEL(r).end.col)); return; } #endif /* ! NO_OLD_SELECTION */ #ifndef NO_NEW_SELECTION /* selection_style must not be OLD_SELECT to get here */ /* ** This is mainly xterm style selection with a couple of ** differences, mainly in the way button3 drag extension ** works. ** We're either doing: button1 drag; button3 press; or ** button3 drag ** a) button1 drag : select around a midpoint/word/line - ** that point/word/line is always at the left/right edge ** of the SEL(r). ** b) button3 press: extend/contract character/word/line ** at whichever edge of the selection we are closest to. ** c) button3 drag : extend/contract character/word/line ** - we select around a point/word/line which is either ** the start or end of the selection and it was decided ** by whichever point/word/line was `fixed' at the time ** of the most recent button3 press */ if (button3 && buttonpress) /* button3 press */ { /* first determine which edge of the selection we are ** closest to */ if (RC_BEFORE(pos, SEL(r).beg) || (!RC_AFTER(pos, SEL(r).end) && (((pos.col - SEL(r).beg.col) + ((pos.row - SEL(r).beg.row) * ncol)) < ((SEL(r).end.col - pos.col) + ((SEL(r).end.row - pos.row) * ncol))))) closeto = LEFT; if (closeto == LEFT) { SEL(r).beg.row = pos.row; SEL(r).beg.col = pos.col; SEL(r).mark.row = SEL(r).end.row; SEL(r).mark.col = SEL(r).end.col - (SEL(r).clicks == 2); } else { SEL(r).end.row = pos.row; SEL(r).end.col = pos.col; SEL(r).mark.row = SEL(r).beg.row; SEL(r).mark.col = SEL(r).beg.col; } } else /* button1 drag or button3 drag */ { if (RC_AFTER(SEL(r).mark, pos)) { if ((SEL(r).mark.row == SEL(r).end.row) && (SEL(r).mark.col == SEL(r).end.col) && clickchange && SEL(r).clicks == 2) SEL(r).mark.col--; SEL(r).beg.row = pos.row; SEL(r).beg.col = pos.col; SEL(r).end.row = SEL(r).mark.row; SEL(r).end.col = SEL(r).mark.col + (SEL(r).clicks == 2); } else { SEL(r).beg.row = SEL(r).mark.row; SEL(r).beg.col = SEL(r).mark.col; SEL(r).end.row = pos.row; SEL(r).end.col = pos.col; } } if (SEL(r).clicks == 1) { end_col = PSCR(r, page).tlen[SEL(r).beg.row + SVLINES]; if (end_col != -1 && SEL(r).beg.col > end_col) { #if 1 SEL(r).beg.col = ncol; #else if (SEL(r).beg.row != SEL(r).end.row) SEL(r).beg.col = ncol; else SEL(r).beg.col = SEL(r).mark.col; #endif } end_col = PSCR(r, page).tlen[SEL(r).end.row + SVLINES]; if (end_col != -1 && SEL(r).end.col > end_col) SEL(r).end.col = ncol; # ifdef MULTICHAR_SET rxvt_selection_adjust_kanji(r, page); # endif /* MULTICHAR_SET */ } else if (SEL(r).clicks == 2) { if (RC_AFTER(SEL(r).end, SEL(r).beg)) SEL(r).end.col--; rxvt_selection_delimit_word(r, page, UP, &(SEL(r).beg), &(SEL(r).beg)); rxvt_selection_delimit_word(r, page, DN, &(SEL(r).end), &(SEL(r).end)); } else if (SEL(r).clicks == 3) { #ifndef NO_FRILLS if (ISSET_OPTION(r, Opt_tripleclickwords)) { int end_row; rxvt_selection_delimit_word(r, page, UP, &(SEL(r).beg), &(SEL(r).beg)); end_row = PSCR(r, page).tlen[SEL(r).mark.row + SVLINES]; for ( end_row = SEL(r).mark.row; end_row < r->TermWin.nrow; end_row++ ) { end_col = PSCR(r, page).tlen[end_row + SVLINES]; if (end_col != -1) { SEL(r).end.row = end_row; SEL(r).end.col = end_col; rxvt_selection_trim(r, page); break; } } /* for */ } else #endif { if (RC_AFTER(SEL(r).mark, SEL(r).beg)) SEL(r).mark.col++; SEL(r).beg.col = 0; SEL(r).end.col = ncol; } } /* if (ISSET_OPTION(r, Opt_tripleclickwords)) */ if (button3 && buttonpress) { /* mark may need to be changed */ if (closeto == LEFT) { SEL(r).mark.row = SEL(r).end.row; SEL(r).mark.col = SEL(r).end.col - (SEL(r).clicks == 2); } else { SEL(r).mark.row = SEL(r).beg.row; SEL(r).mark.col = SEL(r).beg.col; } } rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCREEN, "rxvt_selection_extend_colrow %d () EXIT b:(r:%d,c:%d) m:(r:%d,c:%d), e:(r:%d,c:%d)\n", page, SEL(r).beg.row, SEL(r).beg.col, SEL(r).mark.row, SEL(r).mark.col, SEL(r).end.row, SEL(r).end.col)); #endif /* ! NO_NEW_SELECTION */ } #ifndef NO_FRILLS /* INTPROTO */ void rxvt_selection_trim(rxvt_t* r, int page) { int32_t end_col, end_row; text_t *stp; end_col = SEL(r).end.col; end_row = SEL(r).end.row; for ( ; end_row >= SEL(r).beg.row; ) { stp = PSCR(r, page).text[end_row + SVLINES]; while (--end_col >= 0) { if (stp[end_col] != ' ' && stp[end_col] != '\t') break; } if (end_col >= 0 || PSCR(r, page).tlen[end_row - 1 + SVLINES] != -1) { SEL(r).end.col = end_col + 1; SEL(r).end.row = end_row; break; } end_row--; end_col = r->TermWin.ncol; } if (SEL(r).mark.row > SEL(r).end.row) { SEL(r).mark.row = SEL(r).end.row; SEL(r).mark.col = SEL(r).end.col; } else if (SEL(r).mark.row == SEL(r).end.row && SEL(r).mark.col > SEL(r).end.col) SEL(r).mark.col = SEL(r).end.col; } #endif /* ------------------------------------------------------------------------- */ /* * Double click on button 3 when already selected * EXT: button 3 double click */ /* EXTPROTO */ void rxvt_selection_rotate(rxvt_t* r, int page, int x, int y) { SEL(r).clicks = SEL(r).clicks % 3 + 1; rxvt_selection_extend_colrow (r, page, Pixel2Col(x), Pixel2Row(y), 1, 0, 1); } /* ------------------------------------------------------------------------- */ /* * Respond to a request for our current selection * EXT: SelectionRequest */ /* EXTPROTO */ void rxvt_process_selectionrequest (rxvt_t* r, int page, const XSelectionRequestEvent *rq) { XSelectionEvent ev; #ifdef USE_XIM Atom target_list[4]; #else Atom target_list[3]; #endif Atom target; XTextProperty ct; XICCEncodingStyle style; char *cl[2], dummy[1]; ev.type = SelectionNotify; ev.property = None; ev.display = rq->display; ev.requestor = rq->requestor; ev.selection = rq->selection; ev.target = rq->target; ev.time = rq->time; if (rq->target == r->h->xa[XA_TARGETS]) { target_list[0] = r->h->xa[XA_TARGETS]; target_list[1] = XA_STRING; target_list[2] = r->h->xa[XA_TEXT]; #ifdef USE_XIM target_list[3] = r->h->xa[XA_COMPOUND_TEXT]; #endif XChangeProperty(r->Xdisplay, rq->requestor, rq->property, XA_ATOM, 32, PropModeReplace, (unsigned char *)target_list, (sizeof(target_list) / sizeof(target_list[0]))); ev.property = rq->property; } else if (rq->target == r->h->xa[XA_MULTIPLE]) { /* TODO: Handle MULTIPLE */ } else if (rq->target == r->h->xa[XA_TIMESTAMP] && SEL(r).text) { XChangeProperty(r->Xdisplay, rq->requestor, rq->property, XA_INTEGER, sizeof(Time) > 4 ? 32 : (8 * sizeof(Time)), PropModeReplace, (unsigned char*)&r->h->selection_time, sizeof(Time) > 4 ? sizeof(Time)/4 : 1); ev.property = rq->property; } else if ( rq->target == XA_STRING || rq->target == r->h->xa[XA_COMPOUND_TEXT] || rq->target == r->h->xa[XA_TEXT] ) { #ifdef USE_XIM short freect = 0; #endif int selectlen; #ifdef USE_XIM if (rq->target != XA_STRING) { target = r->h->xa[XA_COMPOUND_TEXT]; style = (rq->target == r->h->xa[XA_COMPOUND_TEXT]) ? XCompoundTextStyle : XStdICCTextStyle; } else #endif { target = XA_STRING; style = XStringStyle; } if (SEL(r).text) { cl[0] = (char *)SEL(r).text; selectlen = SEL(r).len; } else { cl[0] = dummy; *dummy = '\0'; selectlen = 0; } #ifdef USE_XIM if (XmbTextListToTextProperty(r->Xdisplay, cl, 1, style, &ct) == Success) /* if we failed to convert then send it raw */ freect = 1; else #endif { ct.value = (unsigned char *)cl[0]; ct.nitems = selectlen; } XChangeProperty(r->Xdisplay, rq->requestor, rq->property, target, 8, PropModeReplace, ct.value, (int)ct.nitems); ev.property = rq->property; #ifdef USE_XIM if (freect) XFree(ct.value); #endif } XSendEvent(r->Xdisplay, rq->requestor, False, 0L, (XEvent *)&ev); } /* ------------------------------------------------------------------------- * * MOUSE ROUTINES * * ------------------------------------------------------------------------- */ /* * return col/row values corresponding to x/y pixel values */ /* EXTPROTO */ void rxvt_pixel_position(rxvt_t* r, int *x, int *y) { *x = Pixel2Col(*x); /* MAX_IT(*x, 0); MIN_IT(*x, (int)r->TermWin.ncol - 1); */ *y = Pixel2Row(*y); /* MAX_IT(*y, 0); MIN_IT(*y, (int)r->TermWin.nrow - 1); */ } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/Makefile.am0000644000175000001440000001155510756127602012455 00000000000000# All portions of code are copyright by their respective author/s. # # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. DEFS = -DPKG_CONF_DIR=\"$(sysconfdir)/$(PACKAGE_NAME)\" bin_PROGRAMS = mrxvt mrxvt_SOURCES = command.h \ debug.h \ encoding.h \ feature.h \ init.h \ menubar.h \ protos.h \ rxvt.h \ rxvtlib.h \ rxvtmem.h mrxvt_SOURCES += command.c \ debug.c \ encoding.c \ init.c \ macros.c \ main.c \ menubar.c \ misc.c \ netdisp.c \ pixmap.c \ ptytty.c \ rxvt.c \ rxvtmem.c \ screen.c \ scrollbar.c \ strings.c \ tabbar.c \ transparent.c \ xdefaults.c mrxvt_SOURCES += close_term.xbm \ left.xbm \ right.xbm \ term.xbm mrxvt_SOURCES += close_term.xpm \ close_term_d.xpm \ left.xpm \ left_d.xpm \ right.xpm \ right_d.xpm \ term.xpm \ term_d.xpm #install-exec-hook: # -chown root $(DESTDIR)$(bindir)/mrxvt # -chmod go-r $(DESTDIR)$(bindir)/mrxvt # -chmod u+s $(DESTDIR)$(bindir)/mrxvt if USE_JPEG JPEG_SRC = mjpg.c else JPEG_SRC = endif if USE_PNG PNG_SRC = mpng.c else PNG_SRC = endif if PLAIN_SCROLLBAR SCROLLBAR_PLAIN_SRC = scrollbar-plain.c else SCROLLBAR_PLAIN_SRC = endif if XTERM_SCROLLBAR SCROLLBAR_XTERM_SRC = scrollbar-xterm.c else SCROLLBAR_XTERM_SRC = endif if NEXT_SCROLLBAR SCROLLBAR_NEXT_SRC = scrollbar-next.c else SCROLLBAR_NEXT_SRC = endif if RXVT_SCROLLBAR SCROLLBAR_RXVT_SRC = scrollbar-rxvt.c else SCROLLBAR_RXVT_SRC = endif if SGI_SCROLLBAR SCROLLBAR_SGI_SRC = scrollbar-sgi.c else SCROLLBAR_SGI_SRC = endif if UTMP_SUPPORT UTMP_SRC = logging.c else UTMP_SRC = endif if GREEK GREEK_SRC = grkelot.c grkelot.h else GREEK_SRC = endif if SESSION_SUPPORT SESSION_SRC = session.c else SESSION_SRC = endif if XFT_SUPPORT XFTACS_SRC = xftacs.c xftacs.h XFTACS_H = xftacs.h else XFTACS_SRC = XFTACS_H = endif mrxvt_SOURCES += $(SCROLLBAR_PLAIN_SRC) \ $(SCROLLBAR_XTERM_SRC) \ $(SCROLLBAR_NEXT_SRC) \ $(SCROLLBAR_RXVT_SRC) \ $(SCROLLBAR_SGI_SRC) \ $(UTMP_SRC) \ $(GREEK_SRC) \ $(JPEG_SRC) \ $(PNG_SRC) \ $(SESSION_SRC) \ $(XFTACS_SRC) MRXVT_H = ../config.h \ command.h \ debug.h \ feature.h \ menubar.h \ protos.h \ rxvt.h \ rxvtlib.h MRXVT_PIXMAPS = left.xbm \ right.xbm \ close_term.xbm \ term.xbm \ left.xpm \ left_d.xpm \ right.xpm \ right_d.xpm \ close_term.xpm \ close_term_d.xpm \ term.xpm \ term_d.xpm AUTOMAKE_OPTIONS = no-dependencies # set dependencies $(bin_PROGRAMS) : command.o: $(MRXVT_H) command.c encoding.o: $(MRXVT_H) encoding.h encoding.c grkelot.o: $(MRXVT_H) grkelot.h grkelot.c macros.o: $(MRXVT_H) macros.c init.o: $(MRXVT_H) $(XFTACS_H) init.h init.c logging.o: $(MRXVT_H) logging.c main.o: $(MRXVT_H) $(XFTACS_H) main.c menubar.o: $(MRXVT_H) menubar.c misc.o: $(MRXVT_H) misc.c mjpg.o: $(MRXVT_H) mjpg.c mpng.o: $(MRXVT_H) mpng.c netdisp.o: $(MRXVT_H) netdisp.c pixmap.o: $(MRXVT_H) pixmap.c ptytty.o: $(MRXVT_H) ptytty.c rxvt.o: $(MRXVT_H) rxvt.c rxvtmem.o: $(MRXVT_H) rxvtmem.h rxvtmem.c screen.o: $(MRXVT_H) $(XFTACS_H) screen.c scrollbar-next.o: $(MRXVT_H) scrollbar-next.c scrollbar-plain.o: $(MRXVT_H) scrollbar-plain.c scrollbar-rxvt.o: $(MRXVT_H) scrollbar-rxvt.c scrollbar-sgi.o: $(MRXVT_H) scrollbar-sgi.c scrollbar-xterm.o: $(MRXVT_H) scrollbar-xterm.c scrollbar.o: $(MRXVT_H) scrollbar.c session.o: $(MRXVT_H) session.c strings.o: $(MRXVT_H) strings.c tabbar.o: $(MRXVT_H) $(MRXVT_PIXMAPS) tabbar.c xdefaults.o: $(MRXVT_H) xdefaults.c transparent.o: $(MRXVT_H) transparent.c xftacs.o: xftacs.h xftacs.c mrxvt-0.5.4/src/Makefile.in0000644000175000001440000004347611012076342012463 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # All portions of code are copyright by their respective author/s. # # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = mrxvt$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am__mrxvt_SOURCES_DIST = command.h debug.h encoding.h feature.h init.h \ menubar.h protos.h rxvt.h rxvtlib.h rxvtmem.h command.c \ debug.c encoding.c init.c macros.c main.c menubar.c misc.c \ netdisp.c pixmap.c ptytty.c rxvt.c rxvtmem.c screen.c \ scrollbar.c strings.c tabbar.c transparent.c xdefaults.c \ close_term.xbm left.xbm right.xbm term.xbm close_term.xpm \ close_term_d.xpm left.xpm left_d.xpm right.xpm right_d.xpm \ term.xpm term_d.xpm scrollbar-plain.c scrollbar-xterm.c \ scrollbar-next.c scrollbar-rxvt.c scrollbar-sgi.c logging.c \ grkelot.c grkelot.h mjpg.c mpng.c session.c xftacs.c xftacs.h @PLAIN_SCROLLBAR_TRUE@am__objects_1 = scrollbar-plain.$(OBJEXT) @XTERM_SCROLLBAR_TRUE@am__objects_2 = scrollbar-xterm.$(OBJEXT) @NEXT_SCROLLBAR_TRUE@am__objects_3 = scrollbar-next.$(OBJEXT) @RXVT_SCROLLBAR_TRUE@am__objects_4 = scrollbar-rxvt.$(OBJEXT) @SGI_SCROLLBAR_TRUE@am__objects_5 = scrollbar-sgi.$(OBJEXT) @UTMP_SUPPORT_TRUE@am__objects_6 = logging.$(OBJEXT) @GREEK_TRUE@am__objects_7 = grkelot.$(OBJEXT) @USE_JPEG_TRUE@am__objects_8 = mjpg.$(OBJEXT) @USE_PNG_TRUE@am__objects_9 = mpng.$(OBJEXT) @SESSION_SUPPORT_TRUE@am__objects_10 = session.$(OBJEXT) @XFT_SUPPORT_TRUE@am__objects_11 = xftacs.$(OBJEXT) am_mrxvt_OBJECTS = command.$(OBJEXT) debug.$(OBJEXT) \ encoding.$(OBJEXT) init.$(OBJEXT) macros.$(OBJEXT) \ main.$(OBJEXT) menubar.$(OBJEXT) misc.$(OBJEXT) \ netdisp.$(OBJEXT) pixmap.$(OBJEXT) ptytty.$(OBJEXT) \ rxvt.$(OBJEXT) rxvtmem.$(OBJEXT) screen.$(OBJEXT) \ scrollbar.$(OBJEXT) strings.$(OBJEXT) tabbar.$(OBJEXT) \ transparent.$(OBJEXT) xdefaults.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) $(am__objects_7) \ $(am__objects_8) $(am__objects_9) $(am__objects_10) \ $(am__objects_11) mrxvt_OBJECTS = $(am_mrxvt_OBJECTS) mrxvt_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(mrxvt_SOURCES) DIST_SOURCES = $(am__mrxvt_SOURCES_DIST) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = -DPKG_CONF_DIR=\"$(sysconfdir)/$(PACKAGE_NAME)\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ mrxvt_SOURCES = command.h debug.h encoding.h feature.h init.h \ menubar.h protos.h rxvt.h rxvtlib.h rxvtmem.h command.c \ debug.c encoding.c init.c macros.c main.c menubar.c misc.c \ netdisp.c pixmap.c ptytty.c rxvt.c rxvtmem.c screen.c \ scrollbar.c strings.c tabbar.c transparent.c xdefaults.c \ close_term.xbm left.xbm right.xbm term.xbm close_term.xpm \ close_term_d.xpm left.xpm left_d.xpm right.xpm right_d.xpm \ term.xpm term_d.xpm $(SCROLLBAR_PLAIN_SRC) \ $(SCROLLBAR_XTERM_SRC) $(SCROLLBAR_NEXT_SRC) \ $(SCROLLBAR_RXVT_SRC) $(SCROLLBAR_SGI_SRC) $(UTMP_SRC) \ $(GREEK_SRC) $(JPEG_SRC) $(PNG_SRC) $(SESSION_SRC) \ $(XFTACS_SRC) @USE_JPEG_FALSE@JPEG_SRC = #install-exec-hook: # -chown root $(DESTDIR)$(bindir)/mrxvt # -chmod go-r $(DESTDIR)$(bindir)/mrxvt # -chmod u+s $(DESTDIR)$(bindir)/mrxvt @USE_JPEG_TRUE@JPEG_SRC = mjpg.c @USE_PNG_FALSE@PNG_SRC = @USE_PNG_TRUE@PNG_SRC = mpng.c @PLAIN_SCROLLBAR_FALSE@SCROLLBAR_PLAIN_SRC = @PLAIN_SCROLLBAR_TRUE@SCROLLBAR_PLAIN_SRC = scrollbar-plain.c @XTERM_SCROLLBAR_FALSE@SCROLLBAR_XTERM_SRC = @XTERM_SCROLLBAR_TRUE@SCROLLBAR_XTERM_SRC = scrollbar-xterm.c @NEXT_SCROLLBAR_FALSE@SCROLLBAR_NEXT_SRC = @NEXT_SCROLLBAR_TRUE@SCROLLBAR_NEXT_SRC = scrollbar-next.c @RXVT_SCROLLBAR_FALSE@SCROLLBAR_RXVT_SRC = @RXVT_SCROLLBAR_TRUE@SCROLLBAR_RXVT_SRC = scrollbar-rxvt.c @SGI_SCROLLBAR_FALSE@SCROLLBAR_SGI_SRC = @SGI_SCROLLBAR_TRUE@SCROLLBAR_SGI_SRC = scrollbar-sgi.c @UTMP_SUPPORT_FALSE@UTMP_SRC = @UTMP_SUPPORT_TRUE@UTMP_SRC = logging.c @GREEK_FALSE@GREEK_SRC = @GREEK_TRUE@GREEK_SRC = grkelot.c grkelot.h @SESSION_SUPPORT_FALSE@SESSION_SRC = @SESSION_SUPPORT_TRUE@SESSION_SRC = session.c @XFT_SUPPORT_FALSE@XFTACS_SRC = @XFT_SUPPORT_TRUE@XFTACS_SRC = xftacs.c xftacs.h @XFT_SUPPORT_FALSE@XFTACS_H = @XFT_SUPPORT_TRUE@XFTACS_H = xftacs.h MRXVT_H = ../config.h \ command.h \ debug.h \ feature.h \ menubar.h \ protos.h \ rxvt.h \ rxvtlib.h MRXVT_PIXMAPS = left.xbm \ right.xbm \ close_term.xbm \ term.xbm \ left.xpm \ left_d.xpm \ right.xpm \ right_d.xpm \ close_term.xpm \ close_term_d.xpm \ term.xpm \ term_d.xpm AUTOMAKE_OPTIONS = no-dependencies all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) mrxvt$(EXEEXT): $(mrxvt_OBJECTS) $(mrxvt_DEPENDENCIES) @rm -f mrxvt$(EXEEXT) $(LINK) $(mrxvt_OBJECTS) $(mrxvt_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c $< .c.obj: $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # set dependencies $(bin_PROGRAMS) : command.o: $(MRXVT_H) command.c encoding.o: $(MRXVT_H) encoding.h encoding.c grkelot.o: $(MRXVT_H) grkelot.h grkelot.c macros.o: $(MRXVT_H) macros.c init.o: $(MRXVT_H) $(XFTACS_H) init.h init.c logging.o: $(MRXVT_H) logging.c main.o: $(MRXVT_H) $(XFTACS_H) main.c menubar.o: $(MRXVT_H) menubar.c misc.o: $(MRXVT_H) misc.c mjpg.o: $(MRXVT_H) mjpg.c mpng.o: $(MRXVT_H) mpng.c netdisp.o: $(MRXVT_H) netdisp.c pixmap.o: $(MRXVT_H) pixmap.c ptytty.o: $(MRXVT_H) ptytty.c rxvt.o: $(MRXVT_H) rxvt.c rxvtmem.o: $(MRXVT_H) rxvtmem.h rxvtmem.c screen.o: $(MRXVT_H) $(XFTACS_H) screen.c scrollbar-next.o: $(MRXVT_H) scrollbar-next.c scrollbar-plain.o: $(MRXVT_H) scrollbar-plain.c scrollbar-rxvt.o: $(MRXVT_H) scrollbar-rxvt.c scrollbar-sgi.o: $(MRXVT_H) scrollbar-sgi.c scrollbar-xterm.o: $(MRXVT_H) scrollbar-xterm.c scrollbar.o: $(MRXVT_H) scrollbar.c session.o: $(MRXVT_H) session.c strings.o: $(MRXVT_H) strings.c tabbar.o: $(MRXVT_H) $(MRXVT_PIXMAPS) tabbar.c xdefaults.o: $(MRXVT_H) xdefaults.c transparent.o: $(MRXVT_H) transparent.c xftacs.o: xftacs.h xftacs.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mrxvt-0.5.4/src/scrollbar-plain.c0000644000175000001440000001103010756127602013635 00000000000000/*--------------------------------*-C-*---------------------------------* * File: scrollbar-plain.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Marc Lehmann * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ #ifdef HAVE_SCROLLBARS #ifdef PLAIN_SCROLLBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL)) /* EXTPROTO */ void rxvt_scrollbar_init_plain (rxvt_t* r) { XGCValues gcvalue; unsigned long gcmask; UNSET_GC(r->scrollBar.gc); /* Initialize the colors */ #ifdef KEEP_SCROLLCOLOR r->scrollBar.plain_fg = ISSET_PIXCOLOR( r->h, Color_scroll) ? r->pixColorsFocus[Color_scroll] : r->pixColorsFocus[Color_bg]; r->scrollBar.plain_bg = ISSET_PIXCOLOR( r->h, Color_scroll) ? r->pixColorsFocus[Color_trough] : r->pixColorsFocus[Color_bg]; #else /* * Draw in uglyass reverse video */ r->scrollBar.plain_fg = r->pixColorsFocus[Color_bg]; r->scrollBar.plain_bg = r->pixColorsFocus[Color_fg]; #endif /* Create GC */ gcmask = GCForeground; gcvalue.foreground = r->scrollBar.plain_fg; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif { gcmask |= GCBackground; gcvalue.background = r->scrollBar.plain_bg; XSetWindowBackground (r->Xdisplay, r->scrollBar.win, r->scrollBar.plain_bg); } r->scrollBar.gc = XCreateGC (r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(r->scrollBar.gc)); } void rxvt_scrollbar_exit_plain (rxvt_t* r) { /* No resources to free */ } /* EXTPROTO */ int rxvt_scrollbar_show_plain(rxvt_t *r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len) { int xsb = 0; int sbwidth = r->scrollBar.width - 1; int clear = 0; /* Call XClearArea? */ /* scrollbar slider */ #ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) clear = 1; else #endif #ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->scrollBar.pixmap)) clear = 1; else #endif clear = 0; scroller_len -= 1; xsb = ISSET_OPTION(r, Opt_scrollBar_right) ? 1 : 0; if (last_top < r->scrollBar.top) XClearArea(r->Xdisplay, r->scrollBar.win, r->sb_shadow + xsb, last_top, sbwidth + 1-xsb, (r->scrollBar.top - last_top), False); if (r->scrollBar.bot < last_bot) XClearArea(r->Xdisplay, r->scrollBar.win, r->sb_shadow + xsb, r->scrollBar.bot, sbwidth + 1-xsb, (last_bot - r->scrollBar.bot + clear), False); CHOOSE_GC_FG(r, r->scrollBar.plain_fg); if (clear) { /* transparent background or background image */ XClearArea (r->Xdisplay, r->scrollBar.win, r->sb_shadow + xsb, r->scrollBar.top, sbwidth, scroller_len, False); XDrawRectangle(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, r->sb_shadow + xsb, r->scrollBar.top, sbwidth - xsb, scroller_len); } else { XFillRectangle(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, r->sb_shadow + xsb, r->scrollBar.top, sbwidth, scroller_len); } return 1; } #endif /* PLAIN_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/tabbar.c0000644000175000001440000020110711032075500011775 00000000000000/*--------------------------------*-C-*---------------------------------* * File: tabbar.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 2002 Alexis * Copyright (c) 2004 Terry Griffin * Copyright (c) 2004 Sergey Popov * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005 Mark Olesen * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef HAVE_WORDEXP_H # include #endif #ifdef HAVE_LIBXPM #include "close_term.xpm" #include "term.xpm" #include "right.xpm" #include "left.xpm" #include "close_term_d.xpm" #include "term_d.xpm" #include "right_d.xpm" #include "left_d.xpm" #else #include "close_term.xbm" #include "term.xbm" #include "right.xbm" #include "left.xbm" #endif /* HAVE_LIBXPM */ #ifdef XFT_SUPPORT # define FHEIGHT pheight # define FWIDTH pwidth #else # define FHEIGHT fheight # define FWIDTH fwidth #endif /* border between the tabs */ #define TAB_BORDER ((int) 1) /* margin around the text of the tab */ #define TXT_MARGIN ((int) 3) /* * Parameters to draw top tabbar */ /* space between top window border and tab top */ #define TAB_TOPOFF ((int) 0) /* Extra height of the active tab. */ #define ATAB_EXTRA ((int) (ATAB_EXTRA_PERCENT * r->TermWin.FHEIGHT / 100)) /* space between top window border and tab bottom */ #define TAB_BOTOFF ((int) (r->TermWin.FHEIGHT + 2*TXT_MARGIN) + ATAB_EXTRA) /* Radius of tab corners */ #define TAB_RADIUS (TAB_RADIUS_PERCENT * TXT_XOFF / 100 ) /* X offset of text in tab */ #define TXT_XOFF ((int) (r->TermWin.FWIDTH - TAB_BORDER)) /* height of text in tab */ #define TXT_YOFF ((int) (r->TermWin.FHEIGHT + TXT_MARGIN + TAB_BORDER)) /* width of No. idx tab */ #define TAB_WIDTH(idx) ((int) (TAB_BORDER + r->vts[idx]->tab_width)) /* size of button */ #define BTN_WIDTH ((int) 18) #define BTN_HEIGHT ((int) 18) /* space between top window border and button top */ #define BTN_TOPOFF (max (0, ((TAB_BOTOFF - BTN_HEIGHT)/2))) /* space between buttons */ #define BTN_SPACE ((int) 5) /* width of tabbar that can be used to draw tabs */ #define TAB_SPACE (TWIN_WIDTH(r)- \ (ISSET_OPTION(r, Opt2_hideButtons) ? 0 : 1) * \ (4 * (BTN_WIDTH+BTN_SPACE) + TAB_BORDER)) #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->tabBar.gc, (PIXCOL)) /****************************************************************************** * Begin internal routine prototypes. * ******************************************************************************/ /****************************************************************************** * End internal routine prototypes. * ******************************************************************************/ enum {XPM_TERM,XPM_CLOSE,XPM_LEFT,XPM_RIGHT,NB_XPM}; #ifdef HAVE_LIBXPM static char** xpm_name[] = { term_xpm,close_term_xpm, left_xpm,right_xpm }; static char** xpm_d_name[] = { term_d_xpm,close_term_d_xpm, left_d_xpm,right_d_xpm }; #else static unsigned char *xbm_name[] = { term_bits,close_term_bits, left_bits,right_bits }; #endif static Pixmap img[NB_XPM]; #ifdef HAVE_LIBXPM static Pixmap img_e[NB_XPM]; /* enable image */ static Pixmap img_emask[NB_XPM]; /* shape mask image */ static Pixmap img_d[NB_XPM]; /* disable image */ static Pixmap img_dmask[NB_XPM]; /* shape mask image */ #endif extern char **cmd_argv; /* * Width between two tabs: * From the left of the first tab to the right of the second tab */ /* INTPROTO */ static int width_between (rxvt_t* r, int start, int end) { register int i, w=0; for (i = start; i <= end; i++) w += TAB_WIDTH(i); return w; } /* * Find most left tab within specified distance. Note that the * distance does not include the width of tab[start]. It means * distance = (beginning of tab[start] - 0) */ /* INTPROTO */ static int find_left_tab (rxvt_t* r, int start, int distance) { register int i, left; /* Sanatization */ if (0 == start) return 0; /* BUG: tab overlap with button */ if (distance < 0) return start; left = distance; for (i = start - 1; i >= 0; i --) { if (left < TAB_WIDTH(i)) break; left -= (TAB_WIDTH(i)); } return (i + 1); } /* * Find most right tab within specified distance. Note that the * distance does not include the width of tab[start]. It means * distance = (beginning of first button - end of tab[start]) */ /* INTPROTO */ static int find_right_tab (rxvt_t* r, int start, int distance) { register int i, left; /* Sanatization */ if (LTAB(r) == start) return start; /* BUG: tab overlap with button */ if (distance < 0) return start; left = distance; for (i = start + 1; i <= LTAB(r); i ++) { if (left < TAB_WIDTH(i)) break; left -= (TAB_WIDTH(i)); } return (i - 1); } /* EXTPROTO */ /* * If refresh is true, then the respective parts of the tabbar are redrawn. * NOTE: This function redraws parts of the tabbar soley based on wether the tab * position / width has changed. It does not check to see if the tab titles / * etc has changed. */ void rxvt_tabbar_set_visible_tabs (rxvt_t* r, Bool refresh) { assert( LTAB(r) >= 0 ); /* * For Firefox style tabs, we should recompute all tabwidths. */ #ifdef XFT_SUPPORT if( ISSET_OPTION(r, Opt_xft) && r->TermWin.xftpfont ) { int i; short tabWidth = rxvt_tab_width( r, NULL); /* Firefox style tabs don't need the tab title */ int numVisible = (TAB_SPACE - TAB_BORDER) / (TAB_BORDER + tabWidth); int oldTabWidth = PVTS(r,0)->tab_width, oldFVtab = FVTAB(r), oldLVtab = LVTAB(r); /* * Reset the widths of all tabs (visible or not). */ for (i = 0; i <= LTAB(r); i ++) PVTS(r, i)->tab_width = tabWidth; /* * Set visible tabs. First make sure the active tab is visible */ if( numVisible == 1 ) FVTAB(r) = LVTAB(r) = ATAB(r); else { if( ATAB(r) < FVTAB(r) ) /* Make ATAB second last tab that's visible */ FVTAB(r) = max( ATAB(r) - numVisible + 2, 0); else if ( ATAB(r) >= FVTAB(r) + numVisible ) /* Make ATAB the second tab that's visible */ FVTAB(r) = max( ATAB(r) - 1, 0); /* * Active tab is now visible. Try and make as many other tabs * visible. */ if( FVTAB(r) + numVisible - 1 > LTAB(r) ) { LVTAB(r) = LTAB(r); FVTAB(r) = max( LVTAB(r) - numVisible + 1, 0); } else LVTAB(r) = FVTAB(r) + numVisible - 1; } if( refresh && IS_WIN(r->tabBar.win)) { /* Clear out the parts of the tabbar that have changed. Expose * events will be sent to the tabbar. */ if( tabWidth != oldTabWidth || FVTAB(r) != oldFVtab ) /* Refresh all tabs */ XClearArea( r->Xdisplay, r->tabBar.win, 0, 0, TAB_SPACE, 0, True); else if( oldLVtab != LVTAB(r) ) { int x = TAB_BORDER + (TAB_BORDER + tabWidth) * min( oldLVtab, LVTAB(r)); XClearArea( r->Xdisplay, r->tabBar.win, x, 0, TAB_SPACE - x + 1, 0, True); } } } else #endif { /* set first visible tab to active tab */ FVTAB(r) = ATAB(r); /* always try visualize the right tabs */ LVTAB(r) = find_right_tab (r, FVTAB(r), TAB_SPACE - TAB_WIDTH(FVTAB(r))); if (LVTAB(r) == LTAB(r) && 0 != FVTAB(r)) { /* now try to visualize the left tabs */ register int size = TAB_SPACE - width_between (r, FVTAB(r), LVTAB(r)); FVTAB(r) = find_left_tab (r, FVTAB(r), size); } if( refresh && IS_WIN(r->tabBar.win)) XClearArea( r->Xdisplay, r->tabBar.win, 0, 0, TAB_SPACE, 0, True); } } /* * x, y : starting position of string, no need to adjust y * str : string to draw * len : byte length of the string, not number of characters! * multichar : whether the string is multichar string * active : active or inactive tab * * Returns the pixel width of the string drawn. */ /* INTPROTO */ static int draw_string (rxvt_t* r, Region clipRegion, int x, int y, char* str, int len, __attribute__((unused)) int multichar, int active) { #ifdef XFT_SUPPORT XGlyphInfo ginfo; #endif #ifdef MULTICHAR_SET if (multichar) { /* * Draw the multichar string */ # ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && (NULL != r->tabBar.xftwin)) { # ifdef HAVE_ICONV_H if ( ENC_NOENC != r->encoding_method && (iconv_t) -1 != r->TermWin.xfticonv ) { char buf[1024]; int plen = 1023; char* pstr = buf; int olen = len; char* ostr = str; /* convert to UTF-8 */ iconv (r->TermWin.xfticonv, (char**) &ostr, (size_t*) &olen, &pstr, (size_t*) &plen); *pstr = (char) 0; /* set end of string */ rxvt_draw_string_xft (r, r->tabBar.win, r->tabBar.gc, clipRegion, RS_None, active ? USE_BOLD_PFONT : USE_PFONT, r->tabBar.xftwin, active ? &(r->tabBar.xftfg) : &(r->tabBar.xftifg), x, y, buf, len, XftDrawStringUtf8); if( r->TermWin.xftpfont ) { XftTextExtentsUtf8( r->Xdisplay, r->TermWin.xftpfont, (unsigned char*) buf, pstr - buf, &ginfo); return ginfo.width; } else return Width2Pixel( pstr - buf ); } else # endif { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR, "XFT non-iconv tab title\n")); rxvt_draw_string_xft (r, r->tabBar.win, r->tabBar.gc, clipRegion, RS_None, active ? USE_BOLD_PFONT : USE_PFONT, r->tabBar.xftwin, active ? &(r->tabBar.xftfg) : &(r->tabBar.xftifg), x, y, str, len, XftDrawString8); if( r->TermWin.xftpfont ) { XftTextExtents8( r->Xdisplay, r->TermWin.xftpfont, (unsigned char*) str, len, &ginfo); return ginfo.width; } else return Width2Pixel( len ); } } else # endif /* XFT_SUPPORT */ { if (ENC_NOENC != r->encoding_method) { XSetFont (r->Xdisplay, r->tabBar.gc, r->TermWin.mfont->fid); r->h->multichar_decode ( (unsigned char*) str, len); rxvt_draw_string_x11 (r, r->tabBar.win, r->tabBar.gc, clipRegion, x, y, str, len/2, XDrawString16); } else { XSetFont (r->Xdisplay, r->tabBar.gc, r->TermWin.font->fid); rxvt_draw_string_x11 (r, r->tabBar.win, r->tabBar.gc, clipRegion, x, y, str, len, XDrawString); } return Width2Pixel( len ); } } /* if (multichar) */ else #endif /* MULTICHAR_SET */ { /* * Draw the non-multichar string */ # ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && (NULL != r->tabBar.xftwin)) { rxvt_draw_string_xft (r, r->tabBar.win, r->tabBar.gc, clipRegion, RS_None, active ? USE_BOLD_PFONT : USE_PFONT, r->tabBar.xftwin, active ? &(r->tabBar.xftfg) : &(r->tabBar.xftifg), x, y, str, len, XftDrawString8); if( r->TermWin.xftpfont ) { XftTextExtents8( r->Xdisplay, r->TermWin.xftpfont, (unsigned char*) str, len, &ginfo); return ginfo.width; } else return Width2Pixel( len ); } else # endif /* XFT_SUPPORT */ { XSetFont (r->Xdisplay, r->tabBar.gc, r->TermWin.font->fid); rxvt_draw_string_x11 (r, r->tabBar.win, r->tabBar.gc, clipRegion, x, y, str, len, XDrawString); return Width2Pixel( len ); } } } /* * Draw tab title string * * If region is non-empty, we assume that the caller has set the GC's clipping * to region, and we honor it. */ /* INTPROTO */ static void draw_title (rxvt_t* r, int x, int y, int tnum, Region region) { Region clipRegion; char str[MAX_DISPLAY_TAB_TXT + 1]; #ifdef MULTICHAR_SET char buf[MAX_TAB_TXT + 1]; const char* sptr; const char* ptr; int multichar; int len; #endif UNSET_REGION( clipRegion ); /* * Adjust y offset, and make sure output is restricted to the current tab * title. */ #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && (NULL != r->tabBar.xftwin)) { if( r->TermWin.xftpfont ) { /* * If we use pfont to draw tab titles, the we dont' know how many * characters will fit on the title. So we should clip the output * correctly. */ XRectangle rect; rect.x = x; rect.y = y - r->TermWin.pheight; rect.width = PVTS(r, tnum)->tab_width - 2*TXT_XOFF; rect.height = r->TermWin.pheight; clipRegion = XCreateRegion(); XUnionRectWithRegion( &rect, clipRegion, clipRegion); if (IS_REGION(region)) XIntersectRegion( clipRegion, region, clipRegion); XftDrawSetClip( r->tabBar.xftwin, clipRegion); y -= r->TermWin.xftpfont->descent; } else y -= r->TermWin.xftfont->descent; } else #endif /* XFT_SUPPORT */ y -= r->TermWin.font->descent; /* * Get the title into str. Under Xft, we use the format specified by * title_format. */ #ifdef XFT_SUPPORT if( NOTSET_OPTION( r, Opt_xft ) || IS_NULL( r->TermWin.xftpfont ) || IS_NULL( PVTS(r, tnum)->title_format ) || rxvt_percent_interpolate( r, tnum, PVTS(r, tnum)->title_format, STRLEN( PVTS(r, tnum)->title_format ), str, r->TermWin.maxTabWidth ) <= 1 ) #endif /* XFT_SUPPORT */ { /* * If % interpolation was not possible, or returned a 1 byte long * string, then just copy the title over. */ STRNCPY( str, PVTS(r,tnum)->tab_title , r->TermWin.maxTabWidth ); str[r->TermWin.maxTabWidth] = '\0'; } /* * Draw the string (different code for multichar / non-multichar). */ #ifdef MULTICHAR_SET sptr = ptr = str; multichar = (*ptr & 0x80); while (*ptr) { if (multichar && (*ptr & 0x80)) /* multichar */ ptr ++; else if (!multichar && !(*ptr & 0x80)) /* single char */ ptr ++; else { len = ptr - sptr; /* adjust bytes, must be 2x for multichar */ if (multichar && (len % 2) != 0) { len ++; ptr ++; /* continue to next byte, we shouldn't stop here */ continue; } assert (len <= MAX_TAB_TXT); memcpy (buf, sptr, len); buf[len] = (char) 0; x += draw_string (r, clipRegion, x, y, buf, len, multichar, tnum == ATAB(r)); /* adjust start position */ /* x += Width2Pixel(len); */ /* #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft) && r->tabBar.xftwin) { x += Width2Pixel(len); } else #endif { if (multichar) x += XTextWidth (r->TermWin.mfont, buf, len/2); else x += XTextWidth (r->TermWin.font, buf, len); } */ /* ok, now the next sub-string */ sptr = ptr; multichar = (*ptr & 0x80); if ((char) 0 == *ptr) break; /* in case ptr is increased at line 356 */ ptr ++; } } /* last sub-string */ len = ptr - sptr; if (0 != len) /* in case last sub-string is empty */ { memcpy (buf, sptr, len); buf[len] = (char) 0; draw_string (r, clipRegion, x, y, buf, len, multichar, tnum == ATAB(r)); } #else /* MULTICHAR_SET */ draw_string (r, clipRegion, x, y, str, STRLEN(str), False, tnum == ATAB(r)); #endif /* MULTICHAR_SET */ /* * Restore clipping of the xftdrawable / gc. */ if (IS_REGION(clipRegion)) { XDestroyRegion( clipRegion); if (NOT_REGION(region)) XSetClipMask( r->Xdisplay, r->tabBar.gc, None); else XSetRegion( r->Xdisplay, r->tabBar.gc, region); #ifdef XFT_SUPPORT if (r->tabBar.xftwin) XftDrawSetClip( r->tabBar.xftwin, region); #endif } } #define SET_ARC( arc, ax, ay, awidth, aheight, aangle1, aangle2) \ (arc).x = (short) (ax); \ (arc).y = (short) (ay); \ (arc).width = (unsigned short) (awidth); \ (arc).height = (unsigned short) (aheight); \ (arc).angle1 = (short) (aangle1); \ (arc).angle2 = (short) (aangle2) #define SET_POINT( point, ax, ay) \ point.x = (short) ax; \ point.y = (short) ay /* * Refresh title of tab "page" */ /* EXTPROTO */ void refresh_tabbar_tab( rxvt_t *r, int page) { int i; XRectangle rect; rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "Refreshing tabbar title of page %d\n", page)); if( page < FVTAB(r) || page > LVTAB(r) ) return; for( i=FVTAB(r), rect.x=TAB_BORDER; i < page; i++) rect.x += TAB_WIDTH(i); rect.y = TAB_TOPOFF; rect.width = TAB_WIDTH( page); rect.height = 0; /* Clear the tab completely, and send expose events */ XClearArea( r->Xdisplay, r->tabBar.win, rect.x, rect.y, rect.width, rect.height, True); } /* * Draw all visible tabs at top. If region is not none, then we clip output to * it. */ /* INTPROTO */ void rxvt_draw_tabs (rxvt_t* r, Region region) { int page, x; if (LTAB(r) < 0 || NOT_WIN(r->tabBar.win) || !r->tabBar.state) /* * Nothing to do here :) */ return; /* Sanatization */ assert( LTAB(r) >= 0 ); assert( FVTAB(r) >= 0 ); assert( FVTAB(r) <= LTAB(r) ); assert( LVTAB(r) >= 0 ); assert( LVTAB(r) <= LTAB(r) ); assert( ATAB(r) >= FVTAB(r) ); assert( ATAB(r) <= LVTAB(r) ); if (IS_REGION(region)) XSetRegion( r->Xdisplay, r->tabBar.gc, region); for( page=FVTAB(r), x=TAB_BORDER; page <= LVTAB(r); page++) { /* * Draw the tab corresponding to "page". */ XArc arcs[2]; XPoint points[8]; /* * Color the tab as active if the tab is active * or * activity/inactivity is detected by the MonitorTab macro */ if( (page == ATAB(r)) || ((NOT_NULL(&PVTS(r, page)->monitor_tab)) && (PVTS(r,page)->monitor_tab == TAB_MON_NOTIFICATION)) ) { /* * disable activity/inactivity notification if current tab is * active tab */ if ((page == ATAB(r)) && (PVTS(r,page)->monitor_tab == TAB_MON_NOTIFICATION)) { rxvt_msg (DBG_INFO, DBG_MACROS, "Macro MonitorTab: monitored tab %i is now the active tab", page); PVTS(r,page)->monitor_tab = TAB_MON_OFF; } /* * Draw the active tab, and bottom line of the tabbar. */ int clear = 0; /* use ClearArea or FillRectangle */ if (ISSET_OPTION(r, Opt2_bottomTabbar)) { /* Top tabbar line & left of active tab */ SET_POINT( points[0], 0, TAB_TOPOFF); SET_POINT( points[1], x, TAB_TOPOFF); SET_POINT( points[2], x, TAB_BOTOFF - TAB_RADIUS); /* Arc coordinates for rounded tab tops :) */ SET_ARC( arcs[0], x, TAB_BOTOFF - 2*TAB_RADIUS, 2*TAB_RADIUS, 2*TAB_RADIUS, 180*64, 90*64); SET_ARC( arcs[1], x + AVTS(r)->tab_width - 2*TAB_RADIUS, TAB_BOTOFF - 2*TAB_RADIUS, 2*TAB_RADIUS, 2*TAB_RADIUS, 270*64, 90*64); /* Coordinates for horizontal line below tab. */ SET_POINT( points[3], x + TAB_RADIUS, TAB_BOTOFF); SET_POINT( points[4], x + AVTS(r)->tab_width - TAB_RADIUS, TAB_BOTOFF); /* Right line of tab and top of tabbar. */ SET_POINT( points[5], x + AVTS(r)->tab_width, TAB_BOTOFF - TAB_RADIUS); SET_POINT( points[6], x + AVTS(r)->tab_width, TAB_TOPOFF); SET_POINT( points[7], TWIN_WIDTH(r), TAB_TOPOFF); } else /* if (ISSET_OPTION(r, Opt2_bottomTabbar)) */ { /* * Coordinates for the draw bottom line to the left of active * tab, and left verticle line of the active tab. */ SET_POINT( points[0], 0, TAB_BOTOFF); SET_POINT( points[1], x, TAB_BOTOFF); SET_POINT( points[2], x, TAB_TOPOFF + TAB_RADIUS); /* Arc coordinates for rounded tab tops :) */ SET_ARC( arcs[0], x, TAB_TOPOFF, 2*TAB_RADIUS, 2*TAB_RADIUS, 180*64, -90*64); SET_ARC( arcs[1], x + AVTS(r)->tab_width - 2*TAB_RADIUS, TAB_TOPOFF, 2*TAB_RADIUS, 2*TAB_RADIUS, 90*64, -90*64); /* Coordinates for horizontal line above tab. */ SET_POINT( points[3], x + TAB_RADIUS, TAB_TOPOFF); SET_POINT( points[4], x + AVTS(r)->tab_width - TAB_RADIUS, TAB_TOPOFF); /* * Coordinates for vertical line on the right of the active tab, and * bottom line of tab bar after active tab. */ SET_POINT( points[5], x + AVTS(r)->tab_width, TAB_TOPOFF + TAB_RADIUS); SET_POINT( points[6], x + AVTS(r)->tab_width, TAB_BOTOFF); SET_POINT( points[7], TWIN_WIDTH(r), TAB_BOTOFF); } #ifdef BACKGROUND_IMAGE if( r->tabBar.hasPixmap && ISSET_OPTION(r, Opt_tabPixmap)) clear = 1; /* use background image */ #endif #ifdef TRANSPARENT if ( ( r->h->am_transparent || r->h->am_pixmap_trans ) && ISSET_OPTION(r, Opt_transparent_tabbar)) clear = 1; /* transparent override background image */ #endif if( !clear ) { /* * Fill the ATAB with the background color. */ CHOOSE_GC_FG( r, r->tabBar.bg); XFillArcs( r->Xdisplay, r->tabBar.win, r->tabBar.gc, arcs, 2); XFillPolygon( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points+1, 6, Convex, CoordModeOrigin); /* * This misses the bottom of the ATAB, so we should color it * ourselves. * * 2006-02-14 gi1242: Drawing with XDrawLine is not enough. For * some reason a thin line below is still missed. Be super safe * and XFillRectangle it. * * 2006-05-26 gi1242: The thin line looks kinda nice actually... */ #if 0 XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points[1].x, points[1].y, points[6].x, points[6].y); XFillRectangle( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points[1].x, points[1].y, points[6].x - points[1].x, 2); #endif } /* * Finally, draw the (boundary) of ATAB here. */ CHOOSE_GC_FG( r, r->tabBar.frame); /* Tabbar line + left of ATAB */ XDrawLines( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points, 3, CoordModeOrigin); /* Rounded tab tops :) */ XDrawArcs( r->Xdisplay, r->tabBar.win, r->tabBar.gc, arcs, 2); /* Top line of ATAB */ XDrawLines( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points + 3, 2, CoordModeOrigin); /* Right of ATAB + tab bar line */ XDrawLines( r->Xdisplay, r->tabBar.win, r->tabBar.gc, points + 5, 3, CoordModeOrigin); /* Draw the tab title. */ CHOOSE_GC_FG( r, r->tabBar.fg); draw_title (r, x + TXT_XOFF, ATAB_EXTRA / 2 + TXT_YOFF, page, region); } else /* if( page == ATAB(r) ) */ { /* * Draw the inactive tabs. */ CHOOSE_GC_FG( r, r->tabBar.delimit); if (ISSET_OPTION(r, Opt2_bottomTabbar)) { /* Left vertical line */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x, TAB_TOPOFF + 1, /* Dont' interupt tabbar line */ x, TAB_BOTOFF - TAB_RADIUS - ATAB_EXTRA); /* Draw rounded tab bottoms :). */ SET_ARC( arcs[0], x, TAB_BOTOFF - ATAB_EXTRA - 2*TAB_RADIUS, 2*TAB_RADIUS, 2*TAB_RADIUS, 180*64, 90*64); SET_ARC( arcs[1], x + PVTS(r, page)->tab_width - 2*TAB_RADIUS, TAB_BOTOFF - ATAB_EXTRA - 2*TAB_RADIUS, 2*TAB_RADIUS, 2*TAB_RADIUS, 270*64, 90*64); XDrawArcs( r->Xdisplay, r->tabBar.win, r->tabBar.gc, arcs, 2); /* Horizontal line below tab. */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x + TAB_RADIUS, TAB_BOTOFF - ATAB_EXTRA, x + PVTS(r, page)->tab_width - TAB_RADIUS, TAB_BOTOFF - ATAB_EXTRA); /* Right vertical line */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x + PVTS(r, page)->tab_width, TAB_BOTOFF - TAB_RADIUS - ATAB_EXTRA, x + PVTS(r, page)->tab_width, TAB_TOPOFF + 1); } else /* if (ISSET_OPTION(r, Opt2_bottomTabbar)) */ { /* Left vertical line */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x, TAB_BOTOFF-1, x, TAB_TOPOFF + TAB_RADIUS + ATAB_EXTRA); /* Draw rounded tab tops :). */ SET_ARC( arcs[0], x, TAB_TOPOFF + ATAB_EXTRA, 2*TAB_RADIUS, 2*TAB_RADIUS, 180*64, -90*64); SET_ARC( arcs[1], x + PVTS(r, page)->tab_width - 2*TAB_RADIUS, TAB_TOPOFF + ATAB_EXTRA, 2*TAB_RADIUS, 2*TAB_RADIUS, 90*64, -90*64); XDrawArcs( r->Xdisplay, r->tabBar.win, r->tabBar.gc, arcs, 2); /* Horizontal line above tab. */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x + TAB_RADIUS, TAB_TOPOFF + ATAB_EXTRA, x + PVTS(r, page)->tab_width - TAB_RADIUS, TAB_TOPOFF + ATAB_EXTRA); /* Right vertical line */ XDrawLine( r->Xdisplay, r->tabBar.win, r->tabBar.gc, x + PVTS(r, page)->tab_width, TAB_TOPOFF + TAB_RADIUS + ATAB_EXTRA, x + PVTS(r, page)->tab_width, TAB_BOTOFF-1); } /* Choose GC foreground for tab title. */ CHOOSE_GC_FG( r, r->tabBar.ifg); draw_title (r, x + TXT_XOFF, ISSET_OPTION(r, Opt2_bottomTabbar) ? TXT_YOFF : ATAB_EXTRA + TXT_YOFF, page, region); /* Highlight the tab if necessary */ if( PVTS(r, page)->highlight ) rxvt_tabbar_highlight_tab( r, page, True); } x += TAB_WIDTH(page); } if (IS_REGION(region)) XSetClipMask( r->Xdisplay, r->tabBar.gc, None); } /* EXTPROTO */ void rxvt_tabbar_highlight_tab (rxvt_t* r, short page, Bool force) { register int i, x; int sx, sy; unsigned int rw, rh; XGCValues gcvalues; /* Sanatization */ assert (LTAB(r) >= 0); assert (FVTAB(r) >= 0); assert (FVTAB(r) <= LTAB(r)); assert (LVTAB(r) >= 0); assert (LVTAB(r) <= LTAB(r)); assert (ATAB(r) >= FVTAB(r)); assert (ATAB(r) <= LVTAB(r)); assert (page <= LTAB(r)); /* highlight flag is already set, simply return */ if ( !force && PVTS(r, page)->highlight) return; /* set highlight flag */ PVTS(r, page)->highlight = 1; if (LTAB(r) < 0 || NOT_WIN(r->tabBar.win) || !r->tabBar.state) return ; /* do not highlight invisible/active tab */ if (page < FVTAB(r) || page > LVTAB(r) || page == ATAB(r)) return; for (i = FVTAB(r), x=TAB_BORDER; i < page; x += TAB_WIDTH(i), i++); /* set dash-line attributes */ XGetGCValues( r->Xdisplay, r->tabBar.gc, GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle, &gcvalues); XSetLineAttributes (r->Xdisplay, r->tabBar.gc, 1, LineOnOffDash, CapButt, JoinMiter); XSetForeground (r->Xdisplay, r->tabBar.gc, r->tabBar.ifg); /* Set dimensions of the highlighted tab rectangle */ sx = x + ( TXT_XOFF / 2 ); sy = ISSET_OPTION(r, Opt2_bottomTabbar) ? TAB_TOPOFF + 1 : TAB_TOPOFF + ATAB_EXTRA + 1; rw = PVTS(r, page)->tab_width - TXT_XOFF; rh = TAB_BOTOFF - TAB_TOPOFF - ATAB_EXTRA - 3; XDrawRectangle (r->Xdisplay, r->tabBar.win, r->tabBar.gc, sx, sy, rw, rh); /* restore solid-line attributes */ XChangeGC( r->Xdisplay, r->tabBar.gc, GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle, &gcvalues); } /* * Buttons */ /* EXTPROTO */ void rxvt_tabbar_draw_buttons (rxvt_t* r) { register int i; int topoff; unsigned long frame; if (LTAB(r) < 0) return; if (NOT_WIN(r->tabBar.win)) return; if (!r->tabBar.state) return; /* whether the buttons are hidden */ if (ISSET_OPTION(r, Opt2_hideButtons)) return; topoff = BTN_TOPOFF; #if 0 frame = NOTSET_OPTION(r, Opt2_bottomTabbar) ? r->tabBar.frame : r->tabBar.delimit; #endif frame = r->tabBar.frame; CHOOSE_GC_FG (r, r->tabBar.fg); for (i = NB_XPM; i >= 1; i--) { #ifdef HAVE_LIBXPM register int curimg = NB_XPM - i; switch (curimg) { case XPM_TERM: img[XPM_TERM] = (LTAB(r) == MAX_PAGES - 1) ? img_d[XPM_TERM] : img_e[XPM_TERM]; break; case XPM_CLOSE: img[XPM_CLOSE] = (ISSET_OPTION(r, Opt2_protectSecondary) && PRIMARY != AVTS(r)->current_screen) ? img_d[XPM_CLOSE] : img_e[XPM_CLOSE]; break; case XPM_LEFT: img[XPM_LEFT] = (FVTAB(r) == 0) ? img_d[XPM_LEFT] : img_e[XPM_LEFT]; break; case XPM_RIGHT: img[XPM_RIGHT] = (LVTAB(r) == LTAB(r)) ? img_d[XPM_RIGHT] : img_e[XPM_RIGHT]; break; } #endif if (IS_PIXMAP(img[NB_XPM-i])) { XCopyArea (r->Xdisplay, img[NB_XPM-i], r->tabBar.win, r->tabBar.gc, 0, 0, BTN_WIDTH, BTN_HEIGHT, TWIN_WIDTH(r)-(i*(BTN_WIDTH+BTN_SPACE)), topoff); } } CHOOSE_GC_FG (r, r->tabBar.frame); for (i = NB_XPM; i >= 1; i--) { /* XDrawRectangle (r->Xdisplay, r->tabBar.win, r->tabBar.gc, TWIN_WIDTH(r)-(i*(BTN_WIDTH+BTN_SPACE)), topoff, BTN_WIDTH, BTN_HEIGHT); */ int sx = TWIN_WIDTH(r) - (i*(BTN_WIDTH+BTN_SPACE)); /* draw top line */ XDrawLine (r->Xdisplay, r->tabBar.win, r->tabBar.gc, sx, topoff, sx + BTN_WIDTH, topoff); /* draw left line */ XDrawLine (r->Xdisplay, r->tabBar.win, r->tabBar.gc, sx, topoff, sx, topoff + BTN_HEIGHT); } CHOOSE_GC_FG (r, r->tabBar.delimit); for (i = NB_XPM; i >= 1; i--) { int sx = TWIN_WIDTH(r) - (i*(BTN_WIDTH+BTN_SPACE)); /* draw bottom line */ XDrawLine (r->Xdisplay, r->tabBar.win, r->tabBar.gc, sx, topoff+BTN_HEIGHT, sx+BTN_WIDTH, topoff+BTN_HEIGHT); /* draw right line */ XDrawLine (r->Xdisplay, r->tabBar.win, r->tabBar.gc, sx+BTN_WIDTH, topoff, sx+BTN_WIDTH, topoff+BTN_HEIGHT); } } /* * Initialize global data structure of all tabs */ /* INTPROTO */ static void init_tabbar (rxvt_t* r) { r->tabBar.state = 0; /* not mapped yet */ LTAB(r) = -1; /* the last tab */ r->tabBar.atab = 0; /* the active tab */ FVTAB(r) = 0; /* first visiable tab */ LVTAB(r) = 0; /* last visiable tab */ r->tabBar.ptab = 0; /* previous active tab */ /* Make sure that font has been initialized */ #ifdef XFT_SUPPORT if (ISSET_OPTION (r, Opt_xft)) assert (NULL != r->TermWin.xftfont); else #endif assert (NULL != r->TermWin.font); assert (r->TermWin.FHEIGHT > 0); /* resource string are static, needn't to free */ r->tabBar.rsfg = r->tabBar.rsbg = r->tabBar.rsifg = r->tabBar.rsibg = 0; } /* INTPROTO */ void rxvt_kill_page (rxvt_t* r, short page) { kill (PVTS(r, page)->cmd_pid, SIGHUP); } /* * Reduce r->num_fds so that select() is more efficient */ /* EXTPROTO */ void rxvt_adjust_fd_number( rxvt_t* r ) { int num_fds = STDERR_FILENO; int i; for( i=0; i <= LTAB(r); i++ ) MAX_IT( num_fds, PVTS(r, i)->cmd_fd ); rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "LTAB=%d, stderr_fd=%d, num_fds=%d. ", LTAB(r), STDERR_FILENO, num_fds)); MAX_IT( num_fds, r->Xfd ); #ifdef USE_FIFO MAX_IT( num_fds, r->fifo_fd ); #endif/*USE_FIFO*/ #ifdef HAVE_X11_SM_SMLIB_H MAX_IT( num_fds, r->TermWin.ice_fd ); #endif #if 0 MAX_IT( num_fds, r->num_fds-1 ); #endif #ifdef OS_IRIX /* Alex Coventry says we need 4 & 7 too */ MAX_IT( num_fds, 7 ); #endif r->num_fds = num_fds + 1; /* counts from 0 */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR, "Adjust num_fds to %d\n", r->num_fds)); } /* * Append a new tab after the last tab. If command is not NULL, run that * command in the tab. If command begins with '!', then run the shell first. */ /* EXTPROTO */ void rxvt_append_page( rxvt_t* r, int profile, const char TAINTED *title, const char *command ) { int num_cmd_args = 0; /* Number of args we got from parsing command */ char** argv; rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "rxvt_append_page( r, %d, %s, %s )\n", profile, title ? title : "(nil)", command ? command : "(nil)" )); /* Sanitization */ assert( LTAB(r) < MAX_PAGES ); if (LTAB(r) == MAX_PAGES-1) { rxvt_msg (DBG_ERROR, DBG_TABBAR, "Too many tabs" ); return ; } if( profile < 0 || profile >= MAX_PROFILES ) { rxvt_msg (DBG_WARN, DBG_TABBAR, "Warning: Profile %d out of range", profile ); profile = 0; } /* indicate that we add a new tab */ LTAB(r)++; rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR, "last page is %d\n", LTAB(r))); /* * Use command specified with -e only if we're opening the first tab, or the * --cmdAllTabs option is specified, and we're not given a command to * execute (e.g. via the NewTab cmd macro). */ if( cmd_argv /* Argument specified via -e option */ && command == NULL /* No command specified (e.g. via NewTab macro) */ && ( LTAB(r)== 0 /* First tab */ || ISSET_OPTION(r, Opt2_cmdAllTabs) /* -at option */ ) ) argv = cmd_argv; else { /* load tab command if necessary*/ if( command == NULL ) command = getProfileOption( r, profile, Rs_command ); if( command != NULL && *command != '!' ) { const char *cmd = command; /* If "command" starts with '!', we should run it in the shell. */ if( cmd[0] == '\\' && cmd[1] == '!' ) cmd++; argv = rxvt_string_to_argv( cmd, &num_cmd_args ); } else argv = NULL; } rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "Forking command=%s, argv[0]=%s\n", command ? command : "(nil)", ( argv && argv[0] ) ? argv[0] : "(nil)" )); /* * Set the tab title. */ if( title == NULL || *title == '\0' ) { title = getProfileOption( r, profile, Rs_tabtitle ); if( title == NULL || *title == '\0' ) { if( command && *command != '\0' ) title = command; else if( argv && argv[0] && *argv[0] != '\0' ) title = argv[0]; } } rxvt_create_termwin( r, LTAB(r), profile, title ); /* * Run the child process. * * 2006-02-17 gi1242: Bug -- If the child produces some output and exits * quickly, then some of that output is sometimes lost. */ if( getProfileOption( r, profile, Rs_cwd ) != NULL ) { const char *cwdOption = getProfileOption( r, profile, Rs_cwd ); char cwd[PATH_MAX] = "", child_cwd[PATH_MAX] = ""; int len = 0; getcwd (cwd, PATH_MAX); if( !STRCMP( cwdOption, "." ) ) { if( ATAB(r) != LTAB(r) ) { /* * Copy working directory of the current tab into child_cwd. */ char proc_cwd[32]; /* 16 is enough */ sprintf( proc_cwd, "/proc/%d/cwd", AVTS(r)->cmd_pid ); if( (len = readlink( proc_cwd, child_cwd, PATH_MAX-1) ) > 0 ) /* readlink does not null terminate */ child_cwd[len] = 0; } } else { #ifdef HAVE_WORDEXP_H wordexp_t p; int wordexp_result = wordexp(cwdOption, &p, 0); char *filename; if( wordexp_result == 0 ) { if( p.we_wordc > 1) rxvt_msg( DBG_ERROR, DBG_TABBAR, "Too many words when expanding %s\n", cwdOption ); else { filename = *p.we_wordv; len = STRLEN( filename ); MIN_IT( len, PATH_MAX - 1 ); STRNCPY( child_cwd, filename, len ); child_cwd[len] = 0; } wordfree( &p ); } else { rxvt_dbgmsg(( DBG_VERBOSE, DBG_TABBAR, "wordexp error code '%i', expanding '%s'\n", wordexp_result, filename )); } #endif /* HAVE_WORDEXP_H */ } if( len > 0 && chdir( child_cwd ) == 0 ) { /* Now in working directory of ATAB */ rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "Running child in directory: %s\n", child_cwd )); /* Run command in this new directory. */ LVTS(r)->cmd_fd = rxvt_run_command( r, LTAB(r), (const char**) argv ); /* Restore old working directory. */ chdir( cwd ); } else { /* Exec command in original directory. */ rxvt_dbgmsg(( DBG_DEBUG, DBG_TABBAR, "Running child in original directory\n")); LVTS(r)->cmd_fd = rxvt_run_command( r, LTAB(r), (const char**) argv ); } } else LVTS(r)->cmd_fd = rxvt_run_command (r, LTAB(r), (const char**) argv); /* * In case we allocated memory for argv using rxvt_string_to_argv (because a * command was specified), then free it. */ if( num_cmd_args > 0) { char **s; for( s = argv; *s != NULL; s++) rxvt_free(*s); rxvt_free( argv ); } /* * If run command failed, rollback */ assert( -1 != LVTS(r)->cmd_fd ); if (-1 == LVTS(r)->cmd_fd) { rxvt_destroy_termwin (r, LTAB(r)); LTAB(r) --; return; } rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR,"page %d's cmd_fd is %d\n", LTAB(r), LVTS(r)->cmd_fd)); /* adjust number of file descriptors to listen */ rxvt_adjust_fd_number (r); /* * Initialize the screen data structures */ rxvt_scr_reset (r, LTAB(r)); rxvt_scr_refresh (r, LTAB(r), FAST_REFRESH); /* * Now we actually execute the command after executing shell, but we need * careful check first. */ if( command != NULL && *command == '!' ) { command++; /* Skip leading '!' */ rxvt_tt_write( r, LTAB(r), (const unsigned char*) command, STRLEN(command) ); rxvt_tt_write( r, LTAB(r), (const unsigned char*) "\n", 1 ); } /* * Now update active page information */ PTAB(r) = ATAB(r); /* set last previous tab */ ATAB(r) = LTAB(r); /* set the active tab */ /* update mapped flag */ AVTS(r)->mapped = 1; /* first tab is special since ptab = atab now */ if (PTAB(r) != ATAB(r)) PVTS(r, r->tabBar.ptab)->mapped = 0; /* Adjust visible tabs */ rxvt_tabbar_set_visible_tabs (r, True); /* Send expose events to tabbar */ refresh_tabbar_tab( r, PTAB(r)); /* PTAB will need to be drawn as inactive */ /* * Auto show tabbar if we have exactly two tabs. */ if( !r->tabBar.state && LTAB(r) == 1 && ISSET_OPTION(r, Opt2_autohideTabbar) && rxvt_tabbar_show( r ) ) rxvt_resize_on_subwin( r, SHOW_TABBAR); /* synchronize terminal title with tab title */ if (ISSET_OPTION(r, Opt2_syncTabTitle)) sync_tab_title( r, ATAB(r) ); /* synchronize icon name to tab title */ if (ISSET_OPTION(r, Opt2_syncTabIcon)) rxvt_set_icon_name (r, (const unsigned char*) PVTS(r, ATAB(r))->tab_title); } /* * Called by the handler of SIGCHLD; destroy the terminal and its tab */ /* EXTPROTO */ void rxvt_remove_page (rxvt_t* r, short page) { register int i; rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR,"remove_page(%d)\n", page)); /* clean utmp/wtmp entry */ #ifdef UTMP_SUPPORT rxvt_privileges (RESTORE); rxvt_cleanutent (r, page); rxvt_privileges (IGNORE); #endif /* free virtual terminal related resources */ assert (PVTS(r, page)->ttydev); rxvt_free (PVTS(r, page)->ttydev); assert (PVTS(r, page)->cmd_fd >= 0); close (PVTS(r, page)->cmd_fd); if (PVTS(r, page)->v_buffer) { rxvt_free (PVTS(r, page)->v_buffer); PVTS(r, page)->v_buffer = NULL; } /* free screen structure */ rxvt_scr_release (r, page); /* destroy the virtual terminal window */ rxvt_destroy_termwin (r, page); /* update total number of tabs */ LTAB(r)--; /* quit the last the terminal, exit the application */ if( LTAB(r) < 0 ) rxvt_clean_exit (r); /* update TermWin and tab_widths */ for (i = page; i <= LTAB(r); i++) { PVTS(r, i) = PVTS(r, i+1); refresh_tabbar_tab( r, i); } /* update selection */ if (page == r->selection.vt) rxvt_process_selectionclear (r, page); else if (r->selection.vt > page) r->selection.vt --; /* * Now we try to set correct atab, ptab, fvtab, and lvtab * Must be careful here!!! */ /* update previous active tab */ if (PTAB(r) > page) PTAB(r)--; /* in case PTAB is invalid */ if (PTAB(r) > LTAB(r)) PTAB(r) = LTAB(r); /* update active tab */ if( ATAB(r) == page ) { /* Fall back to previous active */ ATAB(r) = PTAB(r); /* Make the previous active tab the previous / next tab if possible. */ if( PTAB(r) > 0 ) PTAB(r)--; else if (PTAB(r) < LTAB(r) ) PTAB(r)++; } else if( ATAB(r) > page) ATAB(r)--; /* always set mapped flag */ AVTS(r)->mapped = 1; /* Adjust the number of FD's we select() for. */ rxvt_adjust_fd_number(r); /* adjust visible tabs */ rxvt_tabbar_set_visible_tabs (r, True); refresh_tabbar_tab( r, ATAB(r)); /* Active tab has changed */ /* redraw the tabs and buttons */ if (r->tabBar.state) { if( LTAB(r) == 0 && ISSET_OPTION(r, Opt2_autohideTabbar) && rxvt_tabbar_hide( r )) /* * Only one tab left. Auto hide tabbar. */ rxvt_resize_on_subwin (r, HIDE_TABBAR); } /* Switch fg/bg colors */ rxvt_set_vt_colors( r, ATAB(r) ); XMapRaised( r->Xdisplay, AVTS(r)->vt ); /* * We don't need to touch the screen here. XMapRaised will generate a * MapNotify and Expose events, which will refresh the screen as needed. * Touching the screen unnecessarily causes a flicker (and is *horrible* * under slow connections). */ /* rxvt_scr_touch (r, ATAB(r), True); */ /* synchronize terminal title with tab title */ if (ISSET_OPTION(r, Opt2_syncTabTitle)) sync_tab_title( r, ATAB(r) ); /* synchronize icon name to tab title */ if (ISSET_OPTION(r, Opt2_syncTabIcon)) rxvt_set_icon_name(r, (const unsigned char*) PVTS(r, ATAB(r))->tab_title); } /* * Set new title for a tab */ /* EXTPROTO */ void rxvt_tabbar_set_title (rxvt_t* r, short page, const unsigned char TAINTED * str) { char UNTAINTED * n_title; assert (str); assert (page >= 0 && page <= LTAB(r)); assert (PVTS(r, page)->tab_title); n_title = STRNDUP (str, MAX_TAB_TXT); /* * If strdup succeeds, set new title */ if (NULL != n_title) { rxvt_free (PVTS(r, page)->tab_title); PVTS(r, page)->tab_title = n_title; /* Compute the new width of the tab */ PVTS(r, page)->tab_width = rxvt_tab_width (r, n_title); } /* * If visible tab's title is changed, refresh tab bar */ if (page >= FVTAB(r) && page <= LVTAB(r)) { /* adjust visible tabs */ rxvt_tabbar_set_visible_tabs (r, True); refresh_tabbar_tab(r, page); } /* synchronize terminal title with active tab title */ if (ISSET_OPTION(r, Opt2_syncTabTitle) && (page == ATAB(r))) sync_tab_title( r, ATAB(r) ); /* synchronize icon name to tab title */ if (ISSET_OPTION(r, Opt2_syncTabIcon) && (page == ATAB(r))) rxvt_set_icon_name(r, (const unsigned char*) PVTS(r, ATAB(r))->tab_title); } /* * Activate a page terminal */ /* EXTPROTO */ void rxvt_activate_page (rxvt_t* r, short index) { /* shortcut */ if (/* !r->tabBar.state || NOT_WIN(r->tabBar.win) || */ index == ATAB(r)) return; AVTS(r)->mapped = 0; r->tabBar.ptab = ATAB(r); ATAB(r) = index; AVTS(r)->mapped = 1; AVTS(r)->highlight = 0; /* clear highlight flag */ /* * Now the visible tabs may be changed, recompute the visible * tabs before redrawing. */ if (index < FVTAB(r) || index > LVTAB(r)) { /* adjust visible tabs */ rxvt_tabbar_set_visible_tabs (r, True); } refresh_tabbar_tab( r, ATAB(r)); refresh_tabbar_tab( r, PTAB(r)); /* Switch VT fg/bg colors */ rxvt_set_vt_colors( r, ATAB(r) ); XMapRaised( r->Xdisplay, AVTS(r)->vt ); /* * We don't need to touch the screen here. XMapRaised will generate a * MapNotify and Expose events, which will refresh the screen as needed. * Touching the screen unnecessarily causes a flicker (and is *horrible* * under slow connections). */ /* rxvt_scr_touch (r, ATAB(r), True); */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR, "active page is %d\n",ATAB(r))); /* synchronize terminal title with tab title */ if (ISSET_OPTION(r, Opt2_syncTabTitle)) sync_tab_title( r, ATAB(r) ); /* synchronize icon name to tab title */ if (ISSET_OPTION(r, Opt2_syncTabIcon)) rxvt_set_icon_name (r, (const unsigned char*) PVTS(r, ATAB(r))->tab_title); } /* * Change the width of the tab bar */ /* EXTPROTO */ void rxvt_tabbar_resize (rxvt_t* r) { register int i; int sx, sy; sx = 0; sy = 0; #ifdef HAVE_MENUBAR sy += rxvt_menubar_height (r); #endif if (ISSET_OPTION(r, Opt2_bottomTabbar)) sy += VT_HEIGHT(r); XMoveResizeWindow (r->Xdisplay, r->tabBar.win, sx, sy, TWIN_WIDTH(r), rxvt_tabbar_rheight (r)); /* recompute width of each tab */ for (i = 0; i <= LTAB(r); i ++) PVTS(r, i)->tab_width = rxvt_tab_width (r, PVTS(r, i)->tab_title); /* adjust visible tabs */ rxvt_tabbar_set_visible_tabs (r, False); /* redraw the tabs and buttons */ XClearArea( r->Xdisplay, r->tabBar.win, 0, 0, 0, 0, True); } /* * Determine the position of pointer click and dispatch the event */ /* EXTPROTO */ void rxvt_tabbar_dispatcher (rxvt_t* r, XButtonEvent* ev) { register int x, y, z, but; x = ev->x; y = ev->y; but = -1; rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "click in (%d,%d)\n", x, y)); /* Button4/Button5 of wheel mouse activate the left/right tab as Mozilla firefox */ switch ( ev->button ) { #ifdef HAVE_MENUBAR case Button3: if( r->h->popupMenu[0] ) { int x, y; Window unused_cr; r->h->showingMenu |= POPUP_MENU; XTranslateCoordinates( r->Xdisplay, ev->window, r->TermWin.parent, ev->x, ev->y, &x, &y, &unused_cr); r->h->ActiveMenu = r->h->popupMenu[0]; r->h->ActiveMenu->x = x; r->h->ActiveMenu->y = y; XDefineCursor(r->Xdisplay, AVTS(r)->vt, r->h->bar_pointer); rxvt_menu_show(r); return; } break; #endif case Button4: /* activate left tab */ if (0 != ATAB(r)) rxvt_activate_page (r, ATAB(r)-1); else if (0 != LTAB(r)) rxvt_activate_page (r, LTAB(r)); return; case Button5: /* activate right tab */ if( ATAB(r) != LTAB(r) ) rxvt_activate_page( r, ATAB(r) + 1 ); else if( 0 != LTAB(r) ) rxvt_activate_page( r, 0 ); return; default: break; } /* let's decode where the user click */ z = TWIN_WIDTH(r) - x; if ( NOTSET_OPTION(r, Opt2_hideButtons) && z < 4*(BTN_WIDTH+BTN_SPACE) && (z%(BTN_WIDTH+BTN_SPACE)) > BTN_SPACE ) { but = z/(BTN_WIDTH+BTN_SPACE); /* we should only handle left-mouse-button clicks */ if ( ev->button != Button1 ) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR,"skip non-left-mouse-button click\n")); return; } rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR,"click on button %d\n",but)); switch(but) { case 0 : /* right shift */ if (r->tabBar.atab < LTAB(r)) rxvt_activate_page (r, r->tabBar.atab+1); break; case 1 : /* left shift */ if (r->tabBar.atab > 0) rxvt_activate_page (r, r->tabBar.atab-1); break; case 2 : /* delete the active vt if it's in primary screen */ if( NOTSET_OPTION(r, Opt2_protectSecondary) || ( ISSET_OPTION(r, Opt2_protectSecondary) && PRIMARY == AVTS(r)->current_screen ) ) { /* * 2006-09-19 gi1242: If user presses the X button, don't * hold the tab open, regardless of exit status. */ AVTS(r)->holdOption &= ~(HOLD_NORMALBIT|HOLD_STATUSBIT); rxvt_kill_page (r, ATAB(r)); } break; case 3 : /* create a new vt*/ rxvt_append_page (r, 0, NULL, NULL); break; default : break; } } else if ( x < TAB_SPACE && LTAB(r) >= 0) { register int w = 0; register int i; for ( i = FVTAB(r); w < x && i <= LVTAB(r); i++) w += TAB_WIDTH(i); if( w - TAB_BORDER >= x ) { but = i - 1; rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR,"click on tab %d\n", but)); switch( ev->button ) { case Button1: /* activate the selected tab */ rxvt_activate_page (r, but); r->tabClicked = but; break; case Button2: /* change tab title on middle click */ if (NULL != r->selection.text) rxvt_tabbar_set_title (r, but, r->selection.text); break; } } else { /* change tab title of active tab on middle click */ if ((Button2 == ev->button) && (NULL != r->selection.text)) rxvt_tabbar_set_title (r, ATAB(r), r->selection.text); } } } /* * Check if we're dragging a tab. If yes, then move the tab. * * TODO: Set a different cursor when dragging a tab. */ /* EXTPROTO */ void rxvt_tabbar_button_release( rxvt_t *r, XButtonEvent *ev) { int w, droppedTab; do /* while( 0 ) */ { if ( ev->button != Button1 /* Ignore everything except left clicks */ || r->tabClicked == -1 /* If we're not dragging a tab then nothing to do */ || ev->y < 0 || ev->y > rxvt_tabbar_rheight( r ) /* If we drag off the tabbar. (Coordinates in ev are relative to the tabbar window) */ ) break; /* Figure out where the user released the mouse */ for ( droppedTab = FVTAB(r), w=0; w < ev->x && droppedTab <= LVTAB(r); droppedTab++ ) w += TAB_WIDTH( droppedTab ); rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "Dragged tab %d to %d (%d, %d)\n", r->tabClicked, droppedTab - 1, ev->x, ev->y)); /* Move active tab there */ rxvt_tabbar_move_tab( r, droppedTab - 1 ); } while( 0 ); r->tabClicked = -1; } /* * Is the tabbar visible */ /* EXTPROTO */ int rxvt_tabbar_visible (rxvt_t* r) { return (IS_WIN(r->tabBar.win) && r->tabBar.state); } /* * Expose handler for tabbar */ /* EXTPROTO */ void rxvt_tabbar_expose (rxvt_t* r, XEvent *ev) { Region region; UNSET_REGION(region); if( ev && ev->type == Expose) { region = XCreateRegion(); do { XRectangle rect; rect.x = ev->xexpose.x; rect.y = ev->xexpose.y; rect.width = ev->xexpose.width; rect.height = ev->xexpose.height; XUnionRectWithRegion( &rect, region, region); } while( XCheckTypedWindowEvent( r->Xdisplay, r->tabBar.win, Expose, ev)); } else XClearWindow (r->Xdisplay, r->tabBar.win); /* draw the tabs and blank space*/ rxvt_draw_tabs(r, region); /* draw the buttons */ rxvt_tabbar_draw_buttons (r); if (IS_REGION(region)) XDestroyRegion( region ); } /* * Hide the tabbar */ /* EXTPROTO */ int rxvt_tabbar_hide (rxvt_t* r) { int changed = 0; assert (IS_WIN(r->tabBar.win)); changed = r->tabBar.state; XUnmapWindow (r->Xdisplay, r->tabBar.win); r->tabBar.state = 0; return (changed); } /* * Show the tabbar */ /* EXTPROTO */ int rxvt_tabbar_show (rxvt_t* r) { int changed = 0; assert (IS_WIN(r->tabBar.win)); changed = !r->tabBar.state; XMapWindow (r->Xdisplay, r->tabBar.win); r->tabBar.state = 1; return (changed); } /* * Create the tab bar window */ /* EXTPROTO */ void rxvt_tabbar_create (rxvt_t* r) { XColor color, bgcolor; XGCValues gcvalue; unsigned long gcmask; register int i; int sx, sy; #ifdef HAVE_LIBXPM XpmAttributes xpm_attr; /* * Make sure symbol `background' exists in all .xpm files! This elimate the * background color so that the buttons look transparent. */ XpmColorSymbol xpm_color_sym = {"background", NULL, 0}; #endif init_tabbar (r); rxvt_dbgmsg ((DBG_VERBOSE, DBG_TABBAR,"Creating tabbar\n")); /* initialize the colors */ if (XDEPTH <= 2) { r->tabBar.fg = r->pixColorsFocus[Color_fg]; r->tabBar.bg = r->pixColorsFocus[Color_bg]; r->tabBar.ifg = r->pixColorsFocus[Color_fg]; r->tabBar.ibg = r->pixColorsFocus[Color_bg]; r->tabBar.frame = r->pixColorsFocus[Color_bg]; r->tabBar.delimit = r->pixColorsFocus[Color_fg]; } else { /* create the foreground color */ if( r->h->rs[Rs_tabfg] && rxvt_parse_alloc_color (r, &color, r->h->rs[Rs_tabfg]) ) { r->tabBar.fg = color.pixel; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) rxvt_alloc_xft_color( r, &color, &r->tabBar.xftfg ); #endif } else { r->tabBar.fg = r->pixColorsFocus[Color_Black]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) r->tabBar.xftfg = r->xftColorsFocus[Color_Black]; #endif } /* * create the background color */ if( r->h->rs[Rs_tabbg] && rxvt_parse_alloc_color (r, &color, r->h->rs[Rs_tabbg]) ) { r->tabBar.bg = color.pixel; } else { color.red = 0xd300; color.green = 0xd300; color.blue = 0xdd00; if( rxvt_alloc_color (r, &color, "Active_Tab") ) r->tabBar.bg = color.pixel; else r->tabBar.bg = VTBG(r,0); } /* create the tab frame color */ r->tabBar.frame = r->pixColorsFocus[Color_fg]; /* create the inactive tab foreground color */ if( r->h->rs[Rs_itabfg] && rxvt_parse_alloc_color (r, &color, r->h->rs[Rs_itabfg]) ) { r->tabBar.ifg = color.pixel; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) rxvt_alloc_xft_color( r, &color, &r->tabBar.xftifg ); #endif } else { r->tabBar.ifg = r->pixColorsFocus[Color_Black]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) r->tabBar.xftifg = r->xftColorsFocus[Color_Black]; #endif } /* create the inactive tab background color */ if( r->h->rs[Rs_itabbg] && rxvt_parse_alloc_color( r, &color, r->h->rs[Rs_itabbg] ) ) r->tabBar.ibg = color.pixel; else { color.red = 0xa100; color.green = 0xa100; color.blue = 0xac00; if( rxvt_alloc_color( r, &color, "Inactive_Tab_Bg" ) ) r->tabBar.ibg = color.pixel; else r->tabBar.ibg = VTBG(r,0); } /* create the delimit color (average of 3*fg & bg) */ color.pixel = r->pixColorsFocus[Color_fg]; XQueryColor( r->Xdisplay, XCMAP, &color ); bgcolor.pixel = r->pixColorsFocus[Color_bg]; XQueryColor( r->Xdisplay, XCMAP, &bgcolor ); color.red = ( bgcolor.red + 3 * color.red ) / 4; color.green = ( bgcolor.green + 3 * color.green ) / 4; color.blue = ( bgcolor.blue + 3 * color.blue ) / 4; if( rxvt_alloc_color( r, &color, "Tab_Delimit" ) ) r->tabBar.delimit = color.pixel; else r->tabBar.delimit = VTFG(r,0); rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "Delimit color: %hx, %hx, %hx (#%lx)\n", color.red, color.green, color.blue, r->tabBar.delimit)); } sx = 0; sy = 0; #ifdef HAVE_MENUBAR sy += rxvt_menubar_height (r); #endif if (ISSET_OPTION(r, Opt2_bottomTabbar)) sy += VT_HEIGHT(r); /* * create the window of the tabbar. Use ifg and ibg for the background of * the tabBar so that the active tab stands out better. */ r->tabBar.win = XCreateSimpleWindow( r->Xdisplay, r->TermWin.parent, sx, sy, TWIN_WIDTH(r), rxvt_tabbar_rheight( r ), 0, r->tabBar.ifg, r->tabBar.ibg ); assert(IS_WIN(r->tabBar.win)); #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { r->tabBar.xftwin = XftDrawCreate (r->Xdisplay, r->tabBar.win, XVISUAL, XCMAP); } #endif #ifdef DEBUG_X rxvt_set_win_title (r, r->tabBar.win, "tabbar"); #endif #ifdef BACKGROUND_IMAGE r->tabBar.hasPixmap = False; /* initialize it to None */ if ( #ifdef TRANSPARENT /* Transparency overrides background */ !( ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_tabbar) ) && #endif r->h->rs[Rs_tabbarPixmap] ) { long w = 0, h = 0; Pixmap pmap; pmap = rxvt_load_pixmap (r, r->h->rs[Rs_tabbarPixmap], &w, &h); if (IS_PIXMAP(pmap)) { XSetWindowBackgroundPixmap (r->Xdisplay, r->tabBar.win, pmap); XFreePixmap( r->Xdisplay, pmap); r->tabBar.hasPixmap = True; } else r->tabBar.hasPixmap = False; } #endif #ifdef TRANSPARENT if ( ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_tabbar) ) XSetWindowBackgroundPixmap( r->Xdisplay, r->tabBar.win, ParentRelative); #endif /* create the GC for the tab window */ gcvalue.foreground = r->tabBar.fg; gcvalue.line_width = 0; gcvalue.line_style = LineSolid; gcvalue.cap_style = CapButt; gcvalue.join_style = JoinMiter; gcvalue.arc_mode = ArcChord; /* For coloring ATAB */ gcvalue.fill_style = FillSolid; /* Probably default ... */ gcmask = GCForeground | GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle | GCArcMode | GCFillStyle; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(( r->h->am_transparent || r->h->am_pixmap_trans) && ISSET_OPTION(r, Opt_transparent_tabbar))) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if ( ! r->tabBar.hasPixmap ) #endif { gcvalue.background = r->tabBar.bg; gcmask |= GCBackground; } r->tabBar.gc = XCreateGC (r->Xdisplay, r->tabBar.win, gcmask, &gcvalue); assert (IS_GC(r->tabBar.gc)); XDefineCursor (r->Xdisplay, r->tabBar.win, r->h->bar_pointer); XSelectInput (r->Xdisplay, r->tabBar.win, ExposureMask | ButtonPressMask | ButtonReleaseMask #ifdef HAVE_MENUBAR | Button3MotionMask #endif ); #ifdef XFT_SUPPORT if (NOTSET_OPTION(r, Opt_xft)) #endif XSetFont (r->Xdisplay, r->tabBar.gc, r->TermWin.font->fid); #ifdef HAVE_LIBXPM xpm_color_sym.pixel = r->tabBar.bg; xpm_attr.colorsymbols = &xpm_color_sym; xpm_attr.numsymbols = 1; xpm_attr.visual = XVISUAL; xpm_attr.colormap = XCMAP; xpm_attr.depth = XDEPTH; xpm_attr.closeness = 65535; xpm_attr.valuemask = XpmVisual | XpmColormap | XpmDepth | XpmCloseness | XpmReturnPixels | XpmColorSymbols; #endif /* now, create the buttons */ for (i = 0; i < NB_XPM; i++) { #ifdef HAVE_LIBXPM XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win, xpm_name[i], &img_e[i], &img_emask[i], &xpm_attr); assert (IS_PIXMAP(img_e[i])); XpmCreatePixmapFromData (r->Xdisplay, r->tabBar.win, xpm_d_name[i], &img_d[i], &img_dmask[i], &xpm_attr); assert (IS_PIXMAP(img_d[i])); #else img[i] = XCreatePixmapFromBitmapData (r->Xdisplay, r->tabBar.win, (char *) xbm_name[i], BTN_WIDTH, BTN_HEIGHT, r->tabBar.fg, r->tabBar.bg, XDEPTH); assert (IS_PIXMAP(img[i])); #endif } rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "TXT_XOFF=%d, TXT_YOFF=%d, ATAB_EXTRA=%d, TAB_RADIUS=%d\n", TXT_XOFF, TXT_YOFF, ATAB_EXTRA, TAB_RADIUS)); } /* * Create the tab bar window */ /* EXTPROTO */ void rxvt_tabbar_clean_exit (rxvt_t* r) { register int i; UNSET_WIN(r->tabBar.win); /* destroyed by XDestroySubwindows */ /* free resource strings */ if (r->tabBar.rsfg) rxvt_free ((void*) r->h->rs[Rs_tabfg]); if (r->tabBar.rsbg) rxvt_free ((void*) r->h->rs[Rs_tabbg]); if (r->tabBar.rsifg) rxvt_free ((void*) r->h->rs[Rs_itabfg]); if (r->tabBar.rsibg) rxvt_free ((void*) r->h->rs[Rs_itabbg]); if (IS_GC(r->tabBar.gc)) { XFreeGC (r->Xdisplay, r->tabBar.gc); UNSET_GC(r->tabBar.gc); } for (i = 0; i < NB_XPM; i ++) { #ifdef HAVE_LIBXPM if (IS_PIXMAP(img_e[i])) { XFreePixmap (r->Xdisplay, img_e[i]); UNSET_PIXMAP(img_e[i]); } if (IS_PIXMAP(img_emask[i])) { XFreePixmap (r->Xdisplay, img_emask[i]); UNSET_PIXMAP(img_emask[i]); } if (IS_PIXMAP(img_d[i])) { XFreePixmap (r->Xdisplay, img_d[i]); UNSET_PIXMAP(img_d[i]); } if (IS_PIXMAP(img_dmask[i])) { XFreePixmap (r->Xdisplay, img_dmask[i]); UNSET_PIXMAP(img_dmask[i]); } #else if (IS_PIXMAP(img[i])) XFreePixmap (r->Xdisplay, img[i]); #endif UNSET_PIXMAP(img[i]); } /* for */ } /* EXTPROTO */ unsigned short rxvt_tabbar_height (rxvt_t* r) { if (NOT_WIN(r->tabBar.win) || !r->tabBar.state) return 0; return (rxvt_tabbar_rheight(r)); } /* EXTPROTO */ unsigned short rxvt_tabbar_rheight (rxvt_t* r) { return (r->TermWin.FHEIGHT + 2*TXT_MARGIN + 2*TAB_BORDER + ATAB_EXTRA); } /* EXTPROTO */ unsigned int rxvt_tab_width (rxvt_t *r, const char *str) { #ifdef XFT_SUPPORT if ( ISSET_OPTION (r, Opt_xft) && r->TermWin.xftpfont) { /* * With a proportionally spaced font defined, let's try and make the * tabs look like firefox. All tabs have the same width. The more tabs * there are, the narrower the width becomes. The width does not depend * on the tab title. */ if( LTAB(r) >= 0 ) { int twidth = (TAB_SPACE - TAB_BORDER) / min( LTAB(r) + 1, r->TermWin.minVisibleTabs ) - TAB_BORDER; return min( twidth, MAX_TAB_PIXEL_WIDTH); } else return MAX_TAB_PIXEL_WIDTH; } else #endif { int len; uint16_t maxw = r->TermWin.maxTabWidth; assert (str); len = STRLEN (str); if (len > maxw) len = maxw; #ifdef XFT_SUPPORT if (ISSET_OPTION (r, Opt_xft) && (NULL != r->tabBar.xftwin)) { return (2 * TXT_XOFF + Width2Pixel(len)); } else #endif /* XFT_SUPPORT */ return (2 * TXT_XOFF + XTextWidth (r->TermWin.font, str, len)); } } /* EXTPROTO */ int rxvt_is_tabbar_win (rxvt_t* r, Window w) { return (w == r->tabBar.win); } /* EXTPROTO */ void rxvt_tabbar_change_color (rxvt_t* r, int item, const char* str) { XColor xcol; int changed = 0; switch (item) { case MRxvt_tabfg: if (r->h->rs[Rs_tabfg] && !STRCASECMP(str, r->h->rs[Rs_tabfg])) break; /* no color change */ if (rxvt_parse_alloc_color (r, &xcol, str)) { r->tabBar.fg = xcol.pixel; #ifdef XFT_SUPPORT rxvt_alloc_xft_color( r, &xcol, &(r->tabBar.xftfg) ); #endif if (r->tabBar.rsfg) /* free previous string */ rxvt_free ((void*) r->h->rs[Rs_tabfg]); r->h->rs[Rs_tabfg] = STRDUP(str); r->tabBar.rsfg = 1; /* free resource string later */ changed = 1; } break; case MRxvt_tabbg: if (r->h->rs[Rs_tabbg] && !STRCASECMP(str, r->h->rs[Rs_tabbg])) break; /* no color change */ if (rxvt_parse_alloc_color (r, &xcol, str)) { r->tabBar.bg = xcol.pixel; if (r->tabBar.rsbg) /* free previous string */ rxvt_free ((void*) r->h->rs[Rs_tabbg]); r->h->rs[Rs_tabbg] = STRDUP(str); r->tabBar.rsbg = 1; /* free resource string later */ changed = 1; } break; case MRxvt_itabfg: if (r->h->rs[Rs_itabfg] && !STRCASECMP(str, r->h->rs[Rs_itabfg])) break; /* no color change */ if (rxvt_parse_alloc_color (r, &xcol, str)) { r->tabBar.ifg = xcol.pixel; #ifdef XFT_SUPPORT rxvt_alloc_xft_color( r, &xcol, &(r->tabBar.xftifg) ); #endif if (r->tabBar.rsifg) /* free previous string */ rxvt_free ((void*) r->h->rs[Rs_itabfg]); r->h->rs[Rs_itabfg] = STRDUP(str); r->tabBar.rsifg = 1; /* free resource string later */ changed = 1; } break; case MRxvt_itabbg: if (r->h->rs[Rs_itabbg] && !STRCASECMP(str, r->h->rs[Rs_itabbg])) break; if (rxvt_parse_alloc_color (r, &xcol, str)) { r->tabBar.ibg = xcol.pixel; if (r->tabBar.rsibg) /* free previous string */ rxvt_free ((void*) r->h->rs[Rs_itabbg]); r->h->rs[Rs_itabbg] = STRDUP(str); r->tabBar.rsibg = 1; /* free resource string later */ changed = 1; } break; default: break; } if (changed) { if (MRxvt_itabbg == item) { #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) if ( # ifdef TRANSPARENT ( (r->h->am_transparent || r->h->am_pixmap_trans) && ISSET_OPTION (r, Opt_transparent_tabbar) ) # endif # if defined(TRANSPARENT) && defined(BACKGROUND_IMAGE) || # endif # ifdef BACKGROUND_IMAGE ( r->tabBar.hasPixmap ) # endif ) { # ifdef HAVE_LIBXRENDER /* Background image needs to be regrabed */ rxvt_refresh_bg_image(r, ATAB(r), False); # endif } else #endif { XSetWindowBackground (r->Xdisplay, r->tabBar.win, r->tabBar.ibg); } } /* * Better to put the expose event on the queue, than expose immediately. * Expose events can be expensive when using XRender transparency. */ XClearArea( r->Xdisplay, r->tabBar.win, 0, 0, 0, 0, True); } } /* * Move active tab to position newPage. */ /* EXTPROTO */ void rxvt_tabbar_move_tab (rxvt_t* r, short newPage) { short curPage = ATAB(r); short i; if ( 0 == LTAB(r) || /* Only one tab (no move possible) */ newPage == curPage || /* Move to itself */ newPage < 0 || newPage > LTAB(r) /* Out of range */ ) return; if( newPage < curPage ) { term_t* temp_vt = r->vts[curPage]; /* Shift pages newPage .. curPage-1 one to the right. */ for( i = curPage; i > newPage; i--) r->vts[i] = r->vts[i-1]; r->vts[newPage] = temp_vt; /* Update selection */ if( r->selection.vt >= newPage && r->selection.vt < curPage ) r->selection.vt++; else if( r->selection.vt == curPage ) r->selection.vt = newPage; } else { term_t* temp_vt = r->vts[curPage]; /* Shift pages curPage+1 .. newPage one to the left. */ for( i = curPage; i < newPage; i++) r->vts[i] = r->vts[i+1]; r->vts[newPage] = temp_vt; /* Update selection */ if( r->selection.vt > curPage && r->selection.vt <= newPage) r->selection.vt--; else if( r->selection.vt == curPage ) r->selection.vt = newPage; } /* adjust active tab */ ATAB(r) = newPage; /* adjust previous active tab */ if (PTAB(r) == newPage) PTAB(r) = curPage; /* refresh tabbar */ if (newPage < FVTAB(r) || newPage > LVTAB(r)) rxvt_tabbar_set_visible_tabs (r, True); else { /* * If the width of newPage is different from that of curPage, then all * tabs in between newPage and curPage will have to be refreshed. */ for( i = min( newPage, curPage ); i <= max( newPage, curPage ); i++ ) refresh_tabbar_tab( r, i); } if( ISSET_OPTION( r, Opt2_syncTabTitle ) ) sync_tab_title( r, ATAB(r) ); } /* * Synchronize the window title to the title of the tab "page". */ void sync_tab_title( rxvt_t *r, int page ) { char wintitle[MAX_TAB_TXT]; if( IS_NULL( PVTS(r,page)->winTitleFormat ) || rxvt_percent_interpolate( r, page, PVTS(r,page)->winTitleFormat, STRLEN(PVTS(r,page)->winTitleFormat), wintitle, MAX_TAB_TXT ) <= 1 ) { /* % interpolation failed / not possible */ rxvt_set_term_title( r, (unsigned char*) PVTS(r, page)->tab_title ); } else rxvt_set_term_title( r, (unsigned char*) wintitle ); } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/init.c0000644000175000001440000032220711024542635011523 00000000000000/*--------------------------------*-C-*---------------------------------* * File: init.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey * Copyright (c) 1994 Robert Nation * Copyright (c) 1998-2001 Geoff Wing * Copyright (c) 1999 D J Hawkey Jr * Copyright (c) 2003 marcus at #fluxbox on freenode.net * Copyright (c) 2004 Mr. Dobalina * Copyright (c) 2003-2004 Marc Lehmann * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef XFT_SUPPORT # include "xftacs.h" #endif /* #define XTERM_REVERSE_VIDEO 1 */ /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ #if defined(OS_SVR4) && !defined(_POSIX_VERSION) int rxvt_getdtablesize (); #endif int rxvt_xerror_handler (const Display*, const XErrorEvent*); void rxvt_init_colors (rxvt_t*); void rxvt_init_win_size (rxvt_t*); void rxvt_color_aliases (rxvt_t*, int); void rxvt_get_ourmods (rxvt_t*); int rxvt_run_child (rxvt_t*, int, const char**); void rxvt_get_ttymode (ttymode_t*, int); /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ const char *const def_colorName[] = { COLOR_FOREGROUND, COLOR_BACKGROUND, /* low-intensity colors */ "black", /* 0: black (#000000) */ #ifndef NO_BRIGHTCOLOR "red3", /* 1: red (#CD0000) */ "green3", /* 2: green (#00CD00) */ "yellow3", /* 3: yellow (#CDCD00) */ "blue3", /* 4: blue (#0000CD) */ "magenta3", /* 5: magenta (#CD00CD) */ "cyan3", /* 6: cyan (#00CDCD) */ # ifdef XTERM_COLORS "grey90", /* 7: white (#E5E5E5) */ # else "antiquewhite", /* 7: white (#FAEBD7) */ # endif /* high-intensity colors */ # ifdef XTERM_COLORS "grey30", /* 8: bright black (#4D4D4D) */ # else "grey25", /* 8: bright black (#404040) */ # endif #endif /* NO_BRIGHTCOLOR */ "red", /* 1/9: bright red (#FF0000) */ "green", /* 2/10: bright green (#00FF00) */ "yellow", /* 3/11: bright yellow (#FFFF00) */ "blue", /* 4/12: bright blue (#0000FF) */ "magenta", /* 5/13: bright magenta (#FF00FF) */ "cyan", /* 6/14: bright cyan (#00FFFF) */ "white", /* 7/15: bright white (#FFFFFF) */ #ifdef TTY_256COLOR # ifdef XTERM_COLORS /* use the same color cube as xterm. 16-231 is a more or less uniform * rgb ramp, and 231-255 is a greyscale ramp */ "rgb:00/00/00", /* default 16-255 color table */ "rgb:00/00/5f", /* consists of 6x6x6 colour cub */ "rgb:00/00/87", /* and a 24 greyscale ramp w/o */ "rgb:00/00/af", /* black or white */ "rgb:00/00/d7", "rgb:00/00/ff", "rgb:00/5f/00", "rgb:00/5f/5f", "rgb:00/5f/87", "rgb:00/5f/af", "rgb:00/5f/d7", "rgb:00/5f/ff", "rgb:00/87/00", "rgb:00/87/5f", "rgb:00/87/87", "rgb:00/87/af", "rgb:00/87/d7", "rgb:00/87/ff", "rgb:00/af/00", "rgb:00/af/5f", "rgb:00/af/87", "rgb:00/af/af", "rgb:00/af/d7", "rgb:00/af/ff", "rgb:00/d7/00", "rgb:00/d7/5f", "rgb:00/d7/87", "rgb:00/d7/af", "rgb:00/d7/d7", "rgb:00/d7/ff", "rgb:00/ff/00", "rgb:00/ff/5f", "rgb:00/ff/87", "rgb:00/ff/af", "rgb:00/ff/d7", "rgb:00/ff/ff", "rgb:5f/00/00", "rgb:5f/00/5f", "rgb:5f/00/87", "rgb:5f/00/af", "rgb:5f/00/d7", "rgb:5f/00/ff", "rgb:5f/5f/00", "rgb:5f/5f/5f", "rgb:5f/5f/87", "rgb:5f/5f/af", "rgb:5f/5f/d7", "rgb:5f/5f/ff", "rgb:5f/87/00", "rgb:5f/87/5f", "rgb:5f/87/87", "rgb:5f/87/af", "rgb:5f/87/d7", "rgb:5f/87/ff", "rgb:5f/af/00", "rgb:5f/af/5f", "rgb:5f/af/87", "rgb:5f/af/af", "rgb:5f/af/d7", "rgb:5f/af/ff", "rgb:5f/d7/00", "rgb:5f/d7/5f", "rgb:5f/d7/87", "rgb:5f/d7/af", "rgb:5f/d7/d7", "rgb:5f/d7/ff", "rgb:5f/ff/00", "rgb:5f/ff/5f", "rgb:5f/ff/87", "rgb:5f/ff/af", "rgb:5f/ff/d7", "rgb:5f/ff/ff", "rgb:87/00/00", "rgb:87/00/5f", "rgb:87/00/87", "rgb:87/00/af", "rgb:87/00/d7", "rgb:87/00/ff", "rgb:87/5f/00", "rgb:87/5f/5f", "rgb:87/5f/87", "rgb:87/5f/af", "rgb:87/5f/d7", "rgb:87/5f/ff", "rgb:87/87/00", "rgb:87/87/5f", "rgb:87/87/87", "rgb:87/87/af", "rgb:87/87/d7", "rgb:87/87/ff", "rgb:87/af/00", "rgb:87/af/5f", "rgb:87/af/87", "rgb:87/af/af", "rgb:87/af/d7", "rgb:87/af/ff", "rgb:87/d7/00", "rgb:87/d7/5f", "rgb:87/d7/87", "rgb:87/d7/af", "rgb:87/d7/d7", "rgb:87/d7/ff", "rgb:87/ff/00", "rgb:87/ff/5f", "rgb:87/ff/87", "rgb:87/ff/af", "rgb:87/ff/d7", "rgb:87/ff/ff", "rgb:af/00/00", "rgb:af/00/5f", "rgb:af/00/87", "rgb:af/00/af", "rgb:af/00/d7", "rgb:af/00/ff", "rgb:af/5f/00", "rgb:af/5f/5f", "rgb:af/5f/87", "rgb:af/5f/af", "rgb:af/5f/d7", "rgb:af/5f/ff", "rgb:af/87/00", "rgb:af/87/5f", "rgb:af/87/87", "rgb:af/87/af", "rgb:af/87/d7", "rgb:af/87/ff", "rgb:af/af/00", "rgb:af/af/5f", "rgb:af/af/87", "rgb:af/af/af", "rgb:af/af/d7", "rgb:af/af/ff", "rgb:af/d7/00", "rgb:af/d7/5f", "rgb:af/d7/87", "rgb:af/d7/af", "rgb:af/d7/d7", "rgb:af/d7/ff", "rgb:af/ff/00", "rgb:af/ff/5f", "rgb:af/ff/87", "rgb:af/ff/af", "rgb:af/ff/d7", "rgb:af/ff/ff", "rgb:d7/00/00", "rgb:d7/00/5f", "rgb:d7/00/87", "rgb:d7/00/af", "rgb:d7/00/d7", "rgb:d7/00/ff", "rgb:d7/5f/00", "rgb:d7/5f/5f", "rgb:d7/5f/87", "rgb:d7/5f/af", "rgb:d7/5f/d7", "rgb:d7/5f/ff", "rgb:d7/87/00", "rgb:d7/87/5f", "rgb:d7/87/87", "rgb:d7/87/af", "rgb:d7/87/d7", "rgb:d7/87/ff", "rgb:d7/af/00", "rgb:d7/af/5f", "rgb:d7/af/87", "rgb:d7/af/af", "rgb:d7/af/d7", "rgb:d7/af/ff", "rgb:d7/d7/00", "rgb:d7/d7/5f", "rgb:d7/d7/87", "rgb:d7/d7/af", "rgb:d7/d7/d7", "rgb:d7/d7/ff", "rgb:d7/ff/00", "rgb:d7/ff/5f", "rgb:d7/ff/87", "rgb:d7/ff/af", "rgb:d7/ff/d7", "rgb:d7/ff/ff", "rgb:ff/00/00", "rgb:ff/00/5f", "rgb:ff/00/87", "rgb:ff/00/af", "rgb:ff/00/d7", "rgb:ff/00/ff", "rgb:ff/5f/00", "rgb:ff/5f/5f", "rgb:ff/5f/87", "rgb:ff/5f/af", "rgb:ff/5f/d7", "rgb:ff/5f/ff", "rgb:ff/87/00", "rgb:ff/87/5f", "rgb:ff/87/87", "rgb:ff/87/af", "rgb:ff/87/d7", "rgb:ff/87/ff", "rgb:ff/af/00", "rgb:ff/af/5f", "rgb:ff/af/87", "rgb:ff/af/af", "rgb:ff/af/d7", "rgb:ff/af/ff", "rgb:ff/d7/00", "rgb:ff/d7/5f", "rgb:ff/d7/87", "rgb:ff/d7/af", "rgb:ff/d7/d7", "rgb:ff/d7/ff", "rgb:ff/ff/00", "rgb:ff/ff/5f", "rgb:ff/ff/87", "rgb:ff/ff/af", "rgb:ff/ff/d7", "rgb:ff/ff/ff", # else /* !XTERM_COLORS */ "rgbi:0/0/0", /* default 16-255 color table */ "rgbi:0/0/.2", /* consists of 6x6x6 colour cubes */ "rgbi:0/0/.4", /* and a 24 greyscale ramp w/o */ "rgbi:0/0/.6", /* black or white */ "rgbi:0/0/.8", "rgbi:0/0/1", "rgbi:0/.2/0", "rgbi:0/.2/.2", "rgbi:0/.2/.4", "rgbi:0/.2/.6", "rgbi:0/.2/.8", "rgbi:0/.2/1", "rgbi:0/.4/0", "rgbi:0/.4/.2", "rgbi:0/.4/.4", "rgbi:0/.4/.6", "rgbi:0/.4/.8", "rgbi:0/.4/1", "rgbi:0/.6/0", "rgbi:0/.6/.2", "rgbi:0/.6/.4", "rgbi:0/.6/.6", "rgbi:0/.6/.8", "rgbi:0/.6/1", "rgbi:0/.8/0", "rgbi:0/.8/.2", "rgbi:0/.8/.4", "rgbi:0/.8/.6", "rgbi:0/.8/.8", "rgbi:0/.8/1", "rgbi:0/1/0", "rgbi:0/1/.2", "rgbi:0/1/.4", "rgbi:0/1/.6", "rgbi:0/1/.8", "rgbi:0/1/1", "rgbi:.2/0/0", "rgbi:.2/0/.2", "rgbi:.2/0/.4", "rgbi:.2/0/.6", "rgbi:.2/0/.8", "rgbi:.2/0/1", "rgbi:.2/.2/0", "rgbi:.2/.2/.2", "rgbi:.2/.2/.4", "rgbi:.2/.2/.6", "rgbi:.2/.2/.8", "rgbi:.2/.2/1", "rgbi:.2/.4/0", "rgbi:.2/.4/.2", "rgbi:.2/.4/.4", "rgbi:.2/.4/.6", "rgbi:.2/.4/.8", "rgbi:.2/.4/1", "rgbi:.2/.6/0", "rgbi:.2/.6/.2", "rgbi:.2/.6/.4", "rgbi:.2/.6/.6", "rgbi:.2/.6/.8", "rgbi:.2/.6/1", "rgbi:.2/.8/0", "rgbi:.2/.8/.2", "rgbi:.2/.8/.4", "rgbi:.2/.8/.6", "rgbi:.2/.8/.8", "rgbi:.2/.8/1", "rgbi:.2/1/0", "rgbi:.2/1/.2", "rgbi:.2/1/.4", "rgbi:.2/1/.6", "rgbi:.2/1/.8", "rgbi:.2/1/1", "rgbi:.4/0/0", "rgbi:.4/0/.2", "rgbi:.4/0/.4", "rgbi:.4/0/.6", "rgbi:.4/0/.8", "rgbi:.4/0/1", "rgbi:.4/.2/0", "rgbi:.4/.2/.2", "rgbi:.4/.2/.4", "rgbi:.4/.2/.6", "rgbi:.4/.2/.8", "rgbi:.4/.2/1", "rgbi:.4/.4/0", "rgbi:.4/.4/.2", "rgbi:.4/.4/.4", "rgbi:.4/.4/.6", "rgbi:.4/.4/.8", "rgbi:.4/.4/1", "rgbi:.4/.6/0", "rgbi:.4/.6/.2", "rgbi:.4/.6/.4", "rgbi:.4/.6/.6", "rgbi:.4/.6/.8", "rgbi:.4/.6/1", "rgbi:.4/.8/0", "rgbi:.4/.8/.2", "rgbi:.4/.8/.4", "rgbi:.4/.8/.6", "rgbi:.4/.8/.8", "rgbi:.4/.8/1", "rgbi:.4/1/0", "rgbi:.4/1/.2", "rgbi:.4/1/.4", "rgbi:.4/1/.6", "rgbi:.4/1/.8", "rgbi:.4/1/1", "rgbi:.6/0/0", "rgbi:.6/0/.2", "rgbi:.6/0/.4", "rgbi:.6/0/.6", "rgbi:.6/0/.8", "rgbi:.6/0/1", "rgbi:.6/.2/0", "rgbi:.6/.2/.2", "rgbi:.6/.2/.4", "rgbi:.6/.2/.6", "rgbi:.6/.2/.8", "rgbi:.6/.2/1", "rgbi:.6/.4/0", "rgbi:.6/.4/.2", "rgbi:.6/.4/.4", "rgbi:.6/.4/.6", "rgbi:.6/.4/.8", "rgbi:.6/.4/1", "rgbi:.6/.6/0", "rgbi:.6/.6/.2", "rgbi:.6/.6/.4", "rgbi:.6/.6/.6", "rgbi:.6/.6/.8", "rgbi:.6/.6/1", "rgbi:.6/.8/0", "rgbi:.6/.8/.2", "rgbi:.6/.8/.4", "rgbi:.6/.8/.6", "rgbi:.6/.8/.8", "rgbi:.6/.8/1", "rgbi:.6/1/0", "rgbi:.6/1/.2", "rgbi:.6/1/.4", "rgbi:.6/1/.6", "rgbi:.6/1/.8", "rgbi:.6/1/1", "rgbi:.8/0/0", "rgbi:.8/0/.2", "rgbi:.8/0/.4", "rgbi:.8/0/.6", "rgbi:.8/0/.8", "rgbi:.8/0/1", "rgbi:.8/.2/0", "rgbi:.8/.2/.2", "rgbi:.8/.2/.4", "rgbi:.8/.2/.6", "rgbi:.8/.2/.8", "rgbi:.8/.2/1", "rgbi:.8/.4/0", "rgbi:.8/.4/.2", "rgbi:.8/.4/.4", "rgbi:.8/.4/.6", "rgbi:.8/.4/.8", "rgbi:.8/.4/1", "rgbi:.8/.6/0", "rgbi:.8/.6/.2", "rgbi:.8/.6/.4", "rgbi:.8/.6/.6", "rgbi:.8/.6/.8", "rgbi:.8/.6/1", "rgbi:.8/.8/0", "rgbi:.8/.8/.2", "rgbi:.8/.8/.4", "rgbi:.8/.8/.6", "rgbi:.8/.8/.8", "rgbi:.8/.8/1", "rgbi:.8/1/0", "rgbi:.8/1/.2", "rgbi:.8/1/.4", "rgbi:.8/1/.6", "rgbi:.8/1/.8", "rgbi:.8/1/1", "rgbi:1/0/0", "rgbi:1/0/.2", "rgbi:1/0/.4", "rgbi:1/0/.6", "rgbi:1/0/.8", "rgbi:1/0/1", "rgbi:1/.2/0", "rgbi:1/.2/.2", "rgbi:1/.2/.4", "rgbi:1/.2/.6", "rgbi:1/.2/.8", "rgbi:1/.2/1", "rgbi:1/.4/0", "rgbi:1/.4/.2", "rgbi:1/.4/.4", "rgbi:1/.4/.6", "rgbi:1/.4/.8", "rgbi:1/.4/1", "rgbi:1/.6/0", "rgbi:1/.6/.2", "rgbi:1/.6/.4", "rgbi:1/.6/.6", "rgbi:1/.6/.8", "rgbi:1/.6/1", "rgbi:1/.8/0", "rgbi:1/.8/.2", "rgbi:1/.8/.4", "rgbi:1/.8/.6", "rgbi:1/.8/.8", "rgbi:1/.8/1", "rgbi:1/1/0", "rgbi:1/1/.2", "rgbi:1/1/.4", "rgbi:1/1/.6", "rgbi:1/1/.8", "rgbi:1/1/1", # endif /* XTERM_COLORS */ "rgb:08/08/08", /* xterm, rxvt, mrxvt use the same greyscale ramp */ "rgb:12/12/12", "rgb:1c/1c/1c", "rgb:26/26/26", "rgb:30/30/30", "rgb:3a/3a/3a", "rgb:44/44/44", "rgb:4e/4e/4e", "rgb:58/58/58", "rgb:62/62/62", "rgb:6c/6c/6c", "rgb:76/76/76", "rgb:80/80/80", "rgb:8a/8a/8a", "rgb:94/94/94", "rgb:9e/9e/9e", "rgb:a8/a8/a8", "rgb:b2/b2/b2", "rgb:bc/bc/bc", "rgb:c6/c6/c6", "rgb:d0/d0/d0", "rgb:da/da/da", "rgb:e4/e4/e4", "rgb:ee/ee/ee", #endif /* TTY_256COLOR */ #ifndef NO_CURSORCOLOR COLOR_CURSOR_BACKGROUND, COLOR_CURSOR_FOREGROUND, #endif /* ! NO_CURSORCOLOR */ NULL, /* Color_pointer */ NULL, /* Color_border */ NULL, /* Color_ufbg */ #ifndef NO_BOLD_UNDERLINE_REVERSE NULL, /* Color_BD */ NULL, /* Color_UL */ NULL, /* Color_RV */ #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ #ifdef OPTION_HC NULL, /* Color_HL */ #endif #ifdef KEEP_SCROLLCOLOR COLOR_SCROLLBAR, COLOR_SCROLLTROUGH, #endif /* KEEP_SCROLLCOLOR */ #ifdef TINTING_SUPPORT # ifdef HAVE_LIBXRENDER "rgb:00/00/00", # else "rgb:ff/ff/ff", # endif #endif }; /* ** MUST sync with rxvt.h:enum XA_XXXX */ const char *const xa_names[NUM_XA] = { "COMPOUND_TEXT", "UTF8_STRING", "TEXT", "MULTIPLE", "TARGETS", "TIMESTAMP", "VT_SELECTION", "INCR", "WM_DELETE_WINDOW", "_NET_WM_DESKTOP", "_WIN_WORKSPACE", "_NET_WM_NAME", "_NET_WM_ICON_NAME", "WM_CLIENT_LEADER", "_NET_WM_WINDOW_OPACITY", #ifndef NO_FRILLS "_NET_WM_PID", #endif #ifdef HAVE_X11_SM_SMLIB_H "SM_CLIENT_ID", #endif #ifdef USE_XIM "WM_LOCALE_NAME", #endif #ifdef TRANSPARENT "_XROOTPMAP_ID", "_XSETROOT_ID", #endif #ifdef OFFIX_DND "DndProtocol", "DndSelection", #endif "CLIPBOARD" }; /* substitute system functions */ #if defined(OS_SVR4) && ! defined(_POSIX_VERSION) /* INTPROTO */ int rxvt_getdtablesize(void) { struct rlimit rlim; getrlimit(RLIMIT_NOFILE, &rlim); return rlim.rlim_cur; } #endif /* EXTPROTO */ int rxvt_init_vars(rxvt_t *r) { register int i; struct rxvt_hidden* h; MEMSET(r, 0, sizeof(rxvt_t)); h = r->h = (struct rxvt_hidden *)rxvt_calloc(1, sizeof(struct rxvt_hidden)); for (i = 0; i < MAX_PAGES; i ++) { /* Initialize vts_idx for each term_t structure */ r->vterm[i].vts_idx = -1; /* Initialize each vts pointer */ SET_NULL(r->vts[i]); } SET_NULL(r->Xdisplay); #ifdef USE_XIM SET_NULL(r->TermWin.fontset); #endif SET_NULL(r->TermWin.font); #ifdef MULTICHAR_SET SET_NULL(r->TermWin.mfont); #endif #ifndef NO_BOLDFONT SET_NULL(r->TermWin.bfont); #endif #ifdef XFT_SUPPORT SET_NULL(r->TermWin.xftpattern); SET_NULL(r->TermWin.xftfont); SET_NULL(r->TermWin.xftpfont); SET_NULL(r->TermWin.xftPfont); # ifndef NO_BOLDFONT SET_NULL(r->TermWin.xftbfont); # endif /* NO_BOLDFONT */ # ifdef MULTICHAR_SET # ifdef HAVE_ICONV_H r->TermWin.xfticonv = (iconv_t) -1; # endif SET_NULL(r->TermWin.xftmpattern); SET_NULL(r->TermWin.xftmfont); # endif /* MULTICHAR_SET */ #endif /* XFT_SUPPORT */ UNSET_ATOM(h->xa[XA_COMPOUND_TEXT]); UNSET_ATOM(h->xa[XA_MULTIPLE]); UNSET_ATOM(h->xa[XA_TARGETS]); UNSET_ATOM(h->xa[XA_TEXT]); UNSET_ATOM(h->xa[XA_TIMESTAMP]); UNSET_ATOM(h->xa[XA_VT_SELECTION]); UNSET_ATOM(h->xa[XA_INCR]); h->locale = NULL; # ifdef HAVE_MENUBAR SET_NULL(h->BuildMenu); SET_NULL(h->ActiveMenu); SET_NULL(h->popupMenu[0]); SET_NULL(h->popupMenu[1]); SET_NULL(h->popupMenu[2]); h->showingMenu = 0; /* Set the current menubar to empty defaults */ SET_NULL(h->MenuBar.head); SET_NULL(h->MenuBar.tail); SET_NULL(h->MenuBar.title); # endif # ifdef USE_XIM SET_NULL(h->Input_Context); # endif /* SET_NULL(h->v_bufstr); */ SET_NULL(h->buffer); # ifdef TRANSPARENT h->am_pixmap_trans = 0; h->am_transparent = 0; UNSET_PIXMAP(h->rootPixmap); h->bgRefreshInterval = DEFAULT_BG_REFRESH_INTERVAL; h->lastCNotify.tv_sec = 0; /* No BG update pending */ # endif /* Initialize timeouts to 0 */ for( i=NUM_TIMEOUTS; i--;) h->timeout[i].tv_sec = 0; /* Back to undocumented code :) */ h->MEvent.time = CurrentTime; h->MEvent.button = AnyButton; r->Options[0] = DEFAULT_OPTIONS; r->Options[1] = DEFAULT_OPTIONS2; r->Options[2] = DEFAULT_OPTIONS3; r->Options[3] = DEFAULT_OPTIONS4; h->want_clip_refresh = 0; /* * We only want to set want_resize when we call XResizeWindow. In that * case if XResizeWindow fails, we know that we called it, and can run * our internal resize routines anyway (e.g. put the tabbar in place) */ h->want_resize = 0; h->ttygid = -1; r->Xfd = -1; #ifdef USE_FIFO r->fifo_fd = -1; #endif r->ndead_childs = 0; r->nAsyncChilds = 0; /* default values */ #ifdef NO_FRILLS r->TermWin.int_bwidth = DEFAULT_INTERNALBORDERWIDTH; r->TermWin.ext_bwidth = DEFAULT_EXTERNALBORDERWIDTH; #else r->TermWin.int_bwidth = (INTERNALBORDERWIDTH >= 0 && INTERNALBORDERWIDTH <= MAX_INTERNALBORDERWIDTH) ? INTERNALBORDERWIDTH : DEFAULT_INTERNALBORDERWIDTH; r->TermWin.ext_bwidth = (EXTERNALBORDERWIDTH >= 0 && EXTERNALBORDERWIDTH <= MAX_EXTERNALBORDERWIDTH) ? EXTERNALBORDERWIDTH : DEFAULT_EXTERNALBORDERWIDTH; #endif #ifndef NO_LINESPACE r->TermWin.lineSpace = (LINESPACE >= 0 && LINESPACE <= MAX_LINESPACE) ? LINESPACE : DEFAULT_LINESPACE; #endif #ifdef CURSOR_BLINK r->h->blinkInterval = DEFAULT_BLINK_TIME; #endif #ifdef POINTER_BLANK r->h->pointerBlankDelay = DEFAULT_BLANKDELAY; #endif /* Initialize selection data */ #ifndef NO_NEW_SELECTION r->selection_style = NEW_SELECT; #else r->selection_style = OLD_SELECT; #endif r->selection.vt = -1; r->selection.op = SELECTION_CLEAR; r->selection.screen = PRIMARY; r->selection.clicks = 0; SET_NULL(r->selection.text); r->selection.len = 0; r->selection.beg.row = 0; r->selection.beg.col = 0; r->selection.end.row = 0; r->selection.end.col = 0; #ifndef NO_BRIGHTCOLOR h->colorfgbg = DEFAULT_RSTYLE; #endif #ifdef GREEK_SUPPORT h->ks_greekmodeswith = GREEK_KEYBOARD_MODESWITCH; #endif h->refresh_type = SLOW_REFRESH; UNSET_REGION(h->refreshRegion); /* Will be created when needed */ h->prev_nrow = h->prev_ncol = 0; r->encoding_method = ENC_NOENC; h->multichar_decode = rxvt_decode_dummy; h->oldcursor.row = h->oldcursor.col = -1; h->last_bot = h->last_state = -1; #ifdef HAVE_X11_SM_SMLIB_H SET_NULL(r->TermWin.sm_conn); SET_NULL(r->TermWin.ice_conn); r->TermWin.ice_fd = -1; SET_NULL(r->TermWin.sm_client_id); #endif #ifdef USE_FIFO { char fifo_name[FILENAME_MAX]; sprintf( fifo_name, "/tmp/.mrxvt-%d", getpid() ); r->fbuf_ptr = r->fifo_buf; r->fifo_name = STRDUP( fifo_name ); } #endif/*USE_FIFO*/ r->tabClicked = -1; /* No tab has been clicked by user */ h->allowedxerror = 0; h->xerror_return = Success; return 0; } /* EXTPROTO */ void rxvt_init_secondary(rxvt_t *r) { int i, num_fds; #ifdef TTY_GID_SUPPORT struct group *gr = getgrnam("tty"); if (gr) /* change group ownership of tty to "tty" */ { r->h->ttygid = gr->gr_gid; } else #endif /* TTY_GID_SUPPORT */ { r->h->ttygid = getgid(); } rxvt_set_default_locale (r); /* get number of available file descriptors */ #if defined(_POSIX_VERSION) || ! defined(OS_SVR4) num_fds = (int)sysconf(_SC_OPEN_MAX); #else num_fds = rxvt_getdtablesize(); #endif /* ** Close all unused file descriptors ** We don't want them, we don't need them. */ if ((i = open("/dev/null", O_RDONLY)) < 0) { /* TODO: BOO HISS */ dup2(STDERR_FILENO, STDIN_FILENO); } else if (i > STDIN_FILENO) { dup2(i, STDIN_FILENO); close(i); } dup2(STDERR_FILENO, STDOUT_FILENO); for (i = STDERR_FILENO + 1; i < num_fds; i++) { /* #ifdef __sgi */ #ifdef OS_IRIX /* Alex Coventry says we need 4 & 7 too */ if (i == 4 || i == 7) continue; #endif close(i); } /* Now set the correct num_fds */ r->num_fds = STDERR_FILENO + 1; #ifdef OS_IRIX r->num_fds = 7 + 1; #endif } /* INTPROTO */ int rxvt_xerror_handler(const Display *display __attribute__((unused)), const XErrorEvent *event) { rxvt_t* r = rxvt_get_r(); char error_msg[1024]; XGetErrorText (r->Xdisplay, event->error_code, error_msg, 1023); r->h->xerror_return = event->error_code; if( !r->h->allowedxerror ) { rxvt_msg (DBG_ERROR, DBG_INIT, "%s", error_msg); #ifdef DEBUG_X abort(); #endif } return 0; /* ignored anyway */ } #ifdef TEXT_SHADOW /* INTPROTO */ void rxvt_init_shadow_mode (rxvt_t* r, const char* shadow_mode) { if ( !shadow_mode || !STRCASECMP ("botright", shadow_mode) || !STRCASECMP ("default", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_BOTRIGHT; } else if (!STRCASECMP ("botleft", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_BOTLEFT; } else if (!STRCASECMP ("topright", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_TOPRIGHT; } else if (!STRCASECMP ("topleft", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_TOPLEFT; } else if (!STRCASECMP ("top", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_TOP; } else if (!STRCASECMP ("bottom", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_BOTTOM; } else if (!STRCASECMP ("left", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_LEFT; } else if (!STRCASECMP ("right", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_RIGHT; } else if (!STRCASECMP ("none", shadow_mode)) { r->TermWin.shadow_mode = SHADOW_NONE; } else /* no match == default */ { r->TermWin.shadow_mode = SHADOW_NONE; } } #endif /*----------------------------------------------------------------------*/ /* EXTPROTO */ void rxvt_set_jumpscroll( rxvt_t *r ) { if( r->h->rs[Rs_refreshLimit] ) { r->h->refresh_limit = atol( r->h->rs[Rs_refreshLimit] ); if( r->h->refresh_limit < 0 ) r->h->refresh_limit = 0; } else r->h->refresh_limit = DEFAULT_REFRESH_LIMIT; if( r->h->rs[Rs_skipPages] ) { r->h->skip_pages = atol( r->h->rs[Rs_skipPages] ); if( r->h->skip_pages <= 0 ) r->h->skip_pages = 1; } else r->h->skip_pages = DEFAULT_SKIP_PAGES; } /* EXTPROTO */ const char** rxvt_init_resources(rxvt_t* r, int argc, const char *const *argv) { register int i, r_argc; const char** cmd_argv; const char** r_argv; const char** rs; /* * Look for -exec option. Find => split and make cmd_argv[] of command args */ for( r_argc = 0; r_argc < argc; r_argc++ ) if( !STRCMP(argv[r_argc], "-e") || !STRCMP(argv[r_argc], "-exec") ) break; r_argv = (const char**) rxvt_malloc( sizeof(char*) * (r_argc + 1) ); for( i = 0; i < r_argc; i++ ) r_argv[i] = (const char*) argv[i]; SET_NULL(r_argv[i]); if (r_argc == argc) SET_NULL(cmd_argv); else { cmd_argv = (const char **)rxvt_malloc(sizeof(char*) * (argc - r_argc)); for (i = 0; i < argc - r_argc - 1; i++) cmd_argv[i] = (const char *)argv[i + r_argc + 1]; SET_NULL(cmd_argv[i]); } /* clear all resources */ rs = r->h->rs; for (i = 0; i < NUM_RESOURCES;) SET_NULL(rs[i++]); rs[Rs_name] = rxvt_r_basename( argv[0] ); /* * Open display, get options/resources and create the window */ rxvt_get_options( r, r_argc, r_argv ); rxvt_free( r_argv ); /* XXX memory leak? */ #ifdef LOCAL_X_IS_UNIX /* * 2008-04-29 gi1242: Force UNIX sockets for security (Gentoo Bug #219750) */ if( IS_NULL( rs[Rs_display_name] ) ) rs[Rs_display_name] = getenv( "DISPLAY" ); if( rs[Rs_display_name] && rs[Rs_display_name][0] == ':' ) { char *val; int l = 5 + STRLEN(rs[Rs_display_name]); if (l <= 0 || l > 1024) /* possible integer overflow */ l = 1024; val = rxvt_malloc(l); STRCPY( val, "unix"); STRNCAT( val, rs[Rs_display_name], l-5); rs[Rs_display_name] = val; } #endif /* LOCAL_X_IS_UNIX */ rxvt_msg( DBG_INFO, DBG_INIT, "Open X display %s\n", rs[Rs_display_name] ); r->Xdisplay = XOpenDisplay( rs[Rs_display_name] ); if( IS_NULL(r->Xdisplay) ) { rxvt_msg( DBG_ERROR, DBG_INIT, "Error opening display %s\n", rs[Rs_display_name] ); exit( EXIT_FAILURE ); } #ifdef DEBUG_X /* * Makes life a lot simpler when handling X events, as they are not cached, * but processed immediately. */ XSynchronize( r->Xdisplay, True ); #endif /* * Always set XErrorHandler to our own error handler because sometimes * errors are legal! Our error handler will abort when errors are not * allowed. */ XSetErrorHandler( (XErrorHandler) rxvt_xerror_handler ); /* Initialize all atoms after establishing connection to X */ for (i = 0; i < NUM_XA; i++) r->h->xa[i] = XInternAtom( r->Xdisplay, xa_names[i], False ); rxvt_extract_resources( r, r->Xdisplay, rs[Rs_name] ); /* * set any defaults not already set */ if( cmd_argv && cmd_argv[0] ) { if( !rs[Rs_title] ) rs[Rs_title] = rxvt_r_basename( cmd_argv[0] ); if( !rs[Rs_iconName] ) rs[Rs_iconName] = rs[Rs_title]; } else { if( !rs[Rs_title] ) rs[Rs_title] = rs[Rs_name]; if( !rs[Rs_iconName] ) rs[Rs_iconName] = rs[Rs_name]; } if( rs[Rs_maxTabWidth] ) { register int tmp = atoi( rs[ Rs_maxTabWidth]); r->TermWin.maxTabWidth = ( tmp >=1 && tmp <= MAX_DISPLAY_TAB_TXT ) ? tmp : MAX_DISPLAY_TAB_TXT; } else /* * If we're using Xft, then we will probably also use a PFont. So we * should set this to the maximum possible. */ r->TermWin.maxTabWidth = #ifdef XFT_SUPPORT ISSET_OPTION(r, Opt_xft) ? MAX_DISPLAY_TAB_TXT : #endif DEFAULT_DISPLAY_TAB_TXT; if( rs[Rs_minVisibleTabs] ) { register int n = atoi( rs[Rs_minVisibleTabs] ); r->TermWin.minVisibleTabs = (n >= 2 && n <= MAX_PAGES) ? n : DEFAULT_MIN_VISIBLE_TABS; } else r->TermWin.minVisibleTabs = DEFAULT_MIN_VISIBLE_TABS; #ifndef NO_FRILLS if (rs[Rs_int_bwidth]) { register int tmp = atoi( rs[Rs_int_bwidth] ); r->TermWin.int_bwidth =( tmp >= 0 && tmp <= MAX_INTERNALBORDERWIDTH ) ? tmp : DEFAULT_INTERNALBORDERWIDTH; } if (rs[Rs_ext_bwidth]) { register int tmp = atoi( rs[Rs_ext_bwidth] ); r->TermWin.ext_bwidth = (tmp >= 0 && tmp <= MAX_EXTERNALBORDERWIDTH) ? tmp : DEFAULT_EXTERNALBORDERWIDTH; } #endif #ifndef NO_LINESPACE if (rs[Rs_lineSpace]) { register int tmp = atoi( rs[Rs_lineSpace] ); r->TermWin.lineSpace = (tmp >= 0 && tmp <= MAX_LINESPACE) ? tmp : DEFAULT_LINESPACE; } #endif #ifdef POINTER_BLANK if (rs[Rs_pointerBlankDelay]) { register int tmp = atoi( rs[Rs_pointerBlankDelay] ); r->h->pointerBlankDelay = (tmp >= 0 && tmp <= MAX_BLANKDELAY) ? tmp : DEFAULT_BLANKDELAY; } #endif /* Handle opacity of translucent window */ if (rs[Rs_opacity]) { register int tmp = atoi( rs[Rs_opacity] ); r->TermWin.opacity = (tmp >= 0 && tmp <= 100) ? 100 - tmp : 0; #ifdef TRANSPARENT if ( IS_ATOM(r->h->xa[XA_NET_WM_WINDOW_OPACITY]) && ISSET_OPTION(r, Opt_transparent) ) { /* Override pseudo-transparent */ UNSET_OPTION(r, Opt_transparent); } #endif } if (rs[Rs_opacityDegree]) { register int tmp = atoi (rs[Rs_opacityDegree]); r->TermWin.opacity_degree = (tmp > 0 && tmp <= 100) ? tmp : 1; } #ifdef TINTING_SUPPORT if (rs[Rs_shade]) { register int shade; shade = atoi( rs[Rs_shade] ); if (shade < 0 || shade > 100) shade = 100; r->TermWin.shade = 100 - shade; } #endif rxvt_set_jumpscroll(r); #ifdef TRANSPARENT if (rs[Rs_bgRefreshInterval]) { register unsigned long interval = atol( rs[Rs_bgRefreshInterval] ); if( interval > 1000 ) interval = 1000; r->h->bgRefreshInterval = interval * 1000L; /* convert to micro-sec */ } #endif if (rs[Rs_fade]) { register int fade; fade = atoi( rs[Rs_fade] ); /* * Fade levels of 0 will make the text completely black, so let's ignore * it. */ if( fade <= 0 || fade > 100 ) fade = 100; r->TermWin.fade = 100 - fade; } /* else r->TermWin.fade is 0 */ #ifdef CURSOR_BLINK if (rs[Rs_cursorBlinkInterval]) { register long tmp = atol( rs[Rs_cursorBlinkInterval] ); r->h->blinkInterval = (tmp >= MIN_BLINK_TIME && tmp <= MAX_BLINK_TIME) ? tmp : DEFAULT_BLINK_TIME; } /* convert msec to usec */ r->h->blinkInterval *= 1000; #endif #ifdef PRINTPIPE if (!rs[Rs_print_pipe]) rs[Rs_print_pipe] = PRINTPIPE; #endif if (!rs[Rs_cutchars]) rs[Rs_cutchars] = CUTCHARS; #ifdef ACS_ASCII if( !rs[Rs_acs_chars] ) rs[Rs_acs_chars] = ACS_CHARS; if( (i = STRLEN(rs[Rs_acs_chars])) < 0x20 ) { char *val = rxvt_realloc( (void*) rs[Rs_acs_chars], 0x20 ); for( ; i < 0x20; ) val[i++] = ' '; rs[Rs_acs_chars] = val; } #endif #ifndef NO_BACKSPACE_KEY if( !rs[Rs_backspace_key] ) # ifdef DEFAULT_BACKSPACE r->h->key_backspace = DEFAULT_BACKSPACE; # else r->h->key_backspace = "DEC"; /* can toggle between \010 or \177 */ # endif else { char* val = STRDUP(rs[Rs_backspace_key]); rxvt_str_trim( val ); rxvt_str_escaped( val ); r->h->key_backspace = val; } #endif #ifndef NO_DELETE_KEY if( !rs[Rs_delete_key] ) # ifdef DEFAULT_DELETE r->h->key_delete = DEFAULT_DELETE; # else r->h->key_delete = "\033[3~"; # endif else { char *val = STRDUP( rs[Rs_delete_key] ); rxvt_str_trim( val ); rxvt_str_escaped( val ); r->h->key_delete = val; } #endif if( rs[Rs_answerbackstring] ) { rxvt_str_trim( (char*) rs[Rs_answerbackstring] ); rxvt_str_escaped( (char*) rs[Rs_answerbackstring] ); } if( rs[Rs_selectstyle] ) { if( STRNCASECMP( rs[Rs_selectstyle], "oldword", 7 ) == 0 ) r->selection_style = OLD_WORD_SELECT; #ifndef NO_OLD_SELECTION else if( STRNCASECMP( rs[Rs_selectstyle], "old", 3 ) == 0 ) r->selection_style = OLD_SELECT; #endif } /* Set default X11 fonts */ rxvt_set_default_font_x11( r ); #ifdef XFT_SUPPORT if( rs[Rs_xftsz] ) { int sz = atoi( rs[Rs_xftsz] ); r->TermWin.xftsize = (sz >= MIN_XFT_FONT_SIZE) ? sz : MIN_XFT_FONT_SIZE; } else /* default xft font size */ r->TermWin.xftsize = DEFAULT_XFT_FONT_SIZE; if (rs[Rs_xftpsz]) { int sz = atoi (rs[Rs_xftpsz]); r->TermWin.xftpsize = (sz >= MIN_XFT_FONT_SIZE) ? sz : MIN_XFT_FONT_SIZE; } else /* default xft Pfont size */ r->TermWin.xftpsize = DEFAULT_XFT_PFONT_SIZE; # ifdef MULTICHAR_SET if (rs[Rs_xftmsz]) { int sz = (int) atof (rs[Rs_xftmsz]); r->TermWin.xftmsize = (sz >= MIN_XFT_FONT_SIZE) ? sz : MIN_XFT_FONT_SIZE; } else /* default xft font size */ r->TermWin.xftmsize = DEFAULT_XFT_FONT_SIZE; # endif /* MULTICHAR_SET */ /* Set default Freetype fonts */ rxvt_set_default_font_xft (r); #endif /* XFT_SUPPORT */ #ifdef TEXT_SHADOW rxvt_init_shadow_mode (r, rs[Rs_textShadowMode]); #endif #ifdef XTERM_REVERSE_VIDEO /* this is how xterm implements reverseVideo */ if (ISSET_OPTION(r, Opt_reverseVideo)) { if (!rs[Rs_color + Color_fg]) rs[Rs_color + Color_fg] = def_colorName[Color_bg]; if (!rs[Rs_color + Color_bg]) rs[Rs_color + Color_bg] = def_colorName[Color_fg]; for (i = 0; i < MAX_PROFILES; i++) { int vtfg = Rs_foreground + i; int vtbg = Rs_background + i; char* fg = (char*) rs[vtfg]; char* bg = (char*) rs[vtbg]; /* foreground color of i terminal */ if (ISSET_VTFG(r, i)) rs[vtfg] = ISSET_VTBG(r, i) ? bg : def_colorName[Color_bg]; /* background color of i terminal */ if (ISSET_VTBG(r, i)) rs[vtbg] = ISSET_VTFG(r, i) ? fg : def_colorName[Color_fg]; } } #endif for (i = 0; i < NRS_COLORS; i++) if (!rs[Rs_color + i]) rs[Rs_color + i] = def_colorName[i]; #ifndef XTERM_REVERSE_VIDEO /* this is how we implement reverseVideo */ if (ISSET_OPTION(r, Opt_reverseVideo)) { if (!rs[Rs_color + Color_fg]) rs[Rs_color + Color_fg] = def_colorName[Color_fg]; if (!rs[Rs_color + Color_bg]) rs[Rs_color + Color_bg] = def_colorName[Color_bg]; SWAP_IT(rs[Rs_color + Color_fg], rs[Rs_color + Color_bg], const char *); for (i = 0; i < MAX_PROFILES; i++) { int vtfg = Rs_foreground + i; int vtbg = Rs_background + i; if (!rs[vtfg]) rs[vtfg] = def_colorName[Color_fg]; if (!rs[vtbg]) rs[vtbg] = def_colorName[Color_bg]; SWAP_IT(rs[vtfg], rs[vtbg], const char*); } } #endif /* convenient aliases for setting fg/bg to colors */ rxvt_color_aliases(r, Color_fg); rxvt_color_aliases(r, Color_bg); #ifndef NO_CURSORCOLOR rxvt_color_aliases(r, Color_cursor); rxvt_color_aliases(r, Color_cursor2); #endif /* NO_CURSORCOLOR */ rxvt_color_aliases(r, Color_pointer); rxvt_color_aliases(r, Color_border); #ifndef NO_BOLD_UNDERLINE_REVERSE rxvt_color_aliases(r, Color_BD); rxvt_color_aliases(r, Color_UL); rxvt_color_aliases(r, Color_RV); #endif /* ! NO_BOLD_UNDERLINE_REVERSE */ /* * On startup, use autohideTabbar to override hideTabbar. Thus on startup, * using autohideTabbar will only display the tabbar if there are multiple * tabs. The user can hide / show the tabbar using a macro at will. */ if(ISSET_OPTION(r, Opt2_autohideTabbar)) SET_OPTION(r, Opt2_hideTabbar); /* Cleanup the macro list */ rxvt_cleanup_macros( r ); /* * Profile settings. */ for( i=0; i < MAX_PROFILES; i++ ) { /* Set saveLines */ if( r->h->rs[Rs_saveLines + i] ) { int tmp = atoi( r->h->rs[Rs_saveLines + i] ); r->profile[i].saveLines = ( tmp >= 0 && tmp <= MAX_SAVELINES ) ? tmp : DEFAULT_SAVELINES; } else r->profile[i].saveLines = ( i > 0 ) ? r->profile[0].saveLines : DEFAULT_SAVELINES; /* Set holdOption */ if( r->h->rs[Rs_holdExit + i] ) { const char *s = r->h->rs[Rs_holdExit + i]; /* Backward compatibility hack */ if( !STRCASECMP( s, "true" ) || !STRCASECMP( s, "yes" ) || !STRCASECMP( s, "on" ) ) r->profile[i].holdOption = HOLD_ALWAYSBIT; else r->profile[i].holdOption = strtoul( s, NULL, 0 ); } else r->profile[i].holdOption = (i > 0) ? r->profile[0].holdOption : (HOLD_STATUSBIT|HOLD_NORMALBIT); } /* for(i) */ if( !r->h->rs[Rs_holdExitTtl] ) r->h->rs[Rs_holdExitTtl] = "(Done) %t"; if( !r->h->rs[Rs_holdExitTxt] ) r->h->rs[Rs_holdExitTxt] = "\n\n\r\e[31m" "Process exited %N with status %S. " "Press any key to close tab.\e[0m"; #ifdef OS_LINUX if( !r->h->rs[Rs_cwd] ) r->h->rs[Rs_cwd] = "."; #endif #ifndef NO_BEEP if( r->h->rs[Rs_vBellDuration] ) r->TermWin.vBellDuration = 1000000ul * strtoul( r->h->rs[Rs_vBellDuration], NULL, 0 ); else r->TermWin.vBellDuration = 0; #endif return cmd_argv; } /*----------------------------------------------------------------------*/ /* EXTPROTO */ void rxvt_init_env(rxvt_t *r) { int i; unsigned int u; char* val; #ifdef DISPLAY_IS_IP /* Fixup display_name for export over pty to any interested ** terminal clients via "ESC[7n" (e.g. shells). Note we use ** the pure IP number (for the first non-loopback interface) ** that we get from rxvt_network_display(). This is more ** "name-resolution-portable", if you will, and probably allows ** for faster x-client startup if your name server is beyond ** a slow link or overloaded at client startup. Of course that ** only helps the shell's child processes, not us. ** ** Giving out the display_name also affords a potential ** security hole */ val = rxvt_network_display(r->h->rs[Rs_display_name]); r->h->rs[Rs_display_name] = (const char *)val; if (IS_NULL(val)) #endif /* DISPLAY_IS_IP */ val = XDisplayString(r->Xdisplay); if (IS_NULL(r->h->rs[Rs_display_name])) r->h->rs[Rs_display_name] = val; /* use broken `:0' value */ i = STRLEN(val) + 9; if (i <= 0 || i > 1024) /* possible integer overflow */ i = 1024; r->h->env_display = rxvt_malloc(i * sizeof(char)); STRCPY (r->h->env_display, "DISPLAY="); STRNCAT (r->h->env_display, val, i-9); r->h->env_display[i-1] = (char) 0; /* avoiding the math library: * i = (int)(ceil(log10((unsigned int)r->TermWin.parent))) */ for (i = 0, u = (unsigned int)r->TermWin.parent; u; u /= 10, i++) ; MAX_IT(i, 1); r->h->env_windowid = rxvt_malloc((i + 10) * sizeof(char)); sprintf(r->h->env_windowid, "WINDOWID=%u", (unsigned int)r->TermWin.parent); /* ** add entries to the environment: ** @ DISPLAY: in case we started with -display ** @ WINDOWID: X window id number of the window ** @ COLORTERM: terminal sub-name and also indicates its color ** @ TERM: terminal name ** @ TERMINFO: path to terminfo directory */ #ifdef HAVE_PUTENV putenv(r->h->env_display); putenv(r->h->env_windowid); # ifdef RXVT_TERMINFO putenv("TERMINFO=" RXVT_TERMINFO); # endif if (XDEPTH <= 2) putenv("COLORTERM=" COLORTERMENV "-mono"); else putenv("COLORTERM=" COLORTERMENVFULL); if (NOT_NULL(r->h->rs[Rs_term_name])) { int l = 6 + STRLEN(r->h->rs[Rs_term_name]); if (l <= 0 || l > 1024) /* possible integer overflow */ l = 1024; r->h->env_term = rxvt_malloc(l * sizeof(char)); STRCPY (r->h->env_term, "TERM="); STRNCAT (r->h->env_term, r->h->rs[Rs_term_name], l-6); r->h->env_term[l-1] = (char) 0; putenv(r->h->env_term); } else putenv("TERM=" TERMENV); #endif /* HAVE_PUTENV */ #ifdef HAVE_UNSETENV /* avoid passing old settings and confusing term size */ unsetenv("LINES"); unsetenv("COLUMNS"); unsetenv("TERMCAP"); /* terminfo should be okay */ #endif /* HAVE_UNSETENV */ /* ** allocate environment variable for MRXVT_TABTITLE, we will ** use it in rxvt_create_termwin later for each tab terminal */ r->h->env_tabtitle = rxvt_malloc(sizeof(TABTITLEENV) + MAX_TAB_TXT + 1); } /*----------------------------------------------------------------------*/ /* * This is more or less stolen straight from XFree86 xterm. * This should support all European type languages. */ /* EXTPROTO */ void rxvt_init_xlocale(rxvt_t *r) { #ifdef USE_XIM if (IS_NULL(r->h->locale)) rxvt_msg (DBG_ERROR, DBG_INIT, "Setting locale failed."); else { XChangeProperty(r->Xdisplay, r->TermWin.parent, r->h->xa[XA_WM_LOCALE_NAME], XA_STRING, 8, PropModeReplace, (unsigned char *)r->h->locale, STRLEN(r->h->locale)); if (XSupportsLocale() != True) { rxvt_msg (DBG_ERROR, DBG_INIT, "The locale is not supported by Xlib"); return; } rxvt_IM_set_fontset (r, 0); /* see if we can connect yet */ rxvt_IM_init_callback (r->Xdisplay, NULL, NULL); /* To avoid Segmentation Fault in C locale: Solaris only? */ if (STRCMP(r->h->locale, "C")) XRegisterIMInstantiateCallback(r->Xdisplay, NULL, NULL, NULL, rxvt_IM_init_callback, NULL); } #endif } /*----------------------------------------------------------------------*/ /* EXTPROTO */ #ifdef USE_FIFO void rxvt_init_fifo( rxvt_t *r ) { unlink( r->fifo_name ); mkfifo( r->fifo_name, 0600 ); /* * Create the fifo in read write mode. If not, when no clients have the * fifo open, select() will claim our fifo has data pending and return. */ r->fifo_fd = open( r->fifo_name, O_RDONLY|O_NDELAY ); if( r->fifo_fd == -1 ) UNSET_OPTION( r, Opt_useFifo ); else MAX_IT( r->num_fds, r->fifo_fd + 1); /* Reset the fifo buffer */ r->fbuf_ptr = r->fifo_buf; } #endif /* EXTPROTO */ void rxvt_init_command(rxvt_t* r) { /* * Initialize the command connection. This should be called after the X * server connection is established. */ struct sigaction act; rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "%s()\n", __func__)); /* * Enable delete window protocol so that if the top-level window of the * terminal is destroyed by the Session Manager, we can receive a * ClientMessage event and do something gracefully. */ XSetWMProtocols (r->Xdisplay, r->TermWin.parent, &(r->h->xa[XA_WMDELETEWINDOW]), 1); #ifdef META8_OPTION r->h->meta_char = (ISSET_OPTION(r, Opt_meta8) ? 0x80 : C0_ESC); #endif rxvt_get_ourmods(r); #ifdef GREEK_SUPPORT greek_init(); #endif r->Xfd = XConnectionNumber(r->Xdisplay); #ifdef USE_FIFO if( ISSET_OPTION( r, Opt_useFifo ) ) rxvt_init_fifo( r ); else r->fifo_fd = -1; #endif #ifdef CURSOR_BLINK if (ISSET_OPTION(r, Opt_cursorBlink)) (void)gettimeofday(&r->h->lastcursorchange, NULL); #endif /* * Gracefully exit on term signals. */ act.sa_handler = rxvt_Exit_signal; act.sa_flags = 0; sigemptyset (&act.sa_mask); #ifndef OS_SVR4 sigaction( SIGINT , &act, NULL); #endif sigaction( SIGQUIT, &act, NULL); sigaction( SIGTERM, &act, NULL); /* * 2006-04-28 gi1242: Ignore HUP signals. We sometimes receive this if bash * is killed. Chances are that we don't have to exit ... */ act.sa_handler = SIG_IGN; sigaction( SIGHUP, &act, NULL); #ifdef PRINTPIPE /* * 2006-04-28 gi1242: If there is an error opening the printer command, then * we'll get SIGPIPE. If not handled, mrxvt will exit. * * There's nothing we really need to do on broken pipes, so just ignore * SIGPIPE for now. */ sigaction( SIGPIPE, &act, NULL); #endif act.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &act, NULL); } /* EXTPROTO */ void rxvt_fade_color( rxvt_t* r, const XColor *xcol, unsigned long *pix_return, # ifdef XFT_SUPPORT XftColor *xft_return # else void *xft_return # endif ) { if( r->TermWin.fade ) { XColor faded_xcol; faded_xcol.red = (xcol->red / 100) * r->TermWin.fade; faded_xcol.green = (xcol->green / 100) * r->TermWin.fade; faded_xcol.blue = (xcol->blue / 100) * r->TermWin.fade; rxvt_alloc_color( r, &faded_xcol, "Faded" ); *pix_return = faded_xcol.pixel; # ifdef XFT_SUPPORT if( NOT_NULL( xft_return ) ) rxvt_alloc_xft_color( r, &faded_xcol, xft_return ); # endif } } #define setChanged( a, b ) \ if( (a) != (b) ) {(a) = (b); changed = 1;} #define setChangedXft( a, b ) \ if( (a).pixel != (b).pixel ) { (a) = (b); changed = 1;} /* * Sets r->pixColors[Color_fg] / etc to the correct color (depending on the ufbg * color, off focus fading and weather we have focus or not). */ /* EXTPROTO */ int rxvt_set_fgbg_colors( rxvt_t *r, int page ) { int changed = 0; rxvt_dbgmsg(( DBG_DEBUG, DBG_INIT, "%s(r, page=%d)" ": fgbg_tabnum=%d, globalTabNum=%d\n", __func__, page, r->fgbg_tabnum, PVTS(r, page)->globalTabNum)); if( r->fgbg_tabnum == PVTS(r, page)->globalTabNum && ( r->TermWin.fade || !ISSET_PIXCOLOR( r->h, Color_ufbg ) || ( /* * If we dont have fading, but have ufbg, then make sure that * Color_bg points to the correct color. */ r->TermWin.focus ? ( r->pixColors[Color_bg] == PVTS(r, page)->p_bg ) : ( r->pixColors[Color_bg] == r->pixColors[Color_ufbg] ) ) ) ) return 0; /* No change */ setChanged( r->pixColorsFocus[Color_fg], PVTS( r, page)->p_fg ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) setChangedXft( r->xftColorsFocus[Color_fg], PVTS(r, page)->p_xftfg ); #endif if( r->TermWin.fade ) { /* Ignore ufbg, and use faded colors */ setChanged( r->pixColorsFocus[Color_bg], PVTS(r, page)->p_bg ); setChanged( r->pixColorsUnfocus[Color_fg], PVTS(r, page)->p_fgfade ); setChanged( r->pixColorsUnfocus[Color_bg], PVTS(r, page)->p_bgfade ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { setChangedXft( r->xftColorsFocus[Color_bg], PVTS(r, page)->p_xftbg ); setChangedXft( r->xftColorsUnfocus[Color_fg], PVTS(r, page)->p_xftfgfade ); setChangedXft( r->xftColorsUnfocus[Color_bg], PVTS(r, page)->p_xftbgfade ); } #endif } else if( ISSET_PIXCOLOR( r->h, Color_ufbg ) && !r->TermWin.focus ) { /* No fading. But use Color_ufbg */ setChanged( r->pixColorsFocus[Color_bg], r->pixColorsFocus[Color_ufbg] ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) setChangedXft( r->xftColorsFocus[Color_bg], r->xftColorsFocus[Color_ufbg] ); #endif } else { /* Use fgbg from profile */ setChanged( r->pixColorsFocus[Color_bg], PVTS(r, page)->p_bg ); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) setChangedXft( r->xftColorsFocus[Color_bg], PVTS(r, page)->p_xftbg ); #endif } r->fgbg_tabnum = PVTS( r, page )->globalTabNum; rxvt_dbgmsg(( DBG_DEBUG, DBG_INIT, "%s(r, page=%d) returning %d\n", __func__, page, changed )); return changed; /* Changed */ } #undef setChanged #undef setChangedXft void rxvt_copy_color( rxvt_t *r, int dst_index, int src_index ) { r->pixColorsFocus[ dst_index ] = r->pixColorsFocus[ src_index ]; if( r->TermWin.fade ) r->pixColorsUnfocus[ dst_index ] = r->pixColorsUnfocus[ src_index ]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { r->xftColorsFocus[ dst_index ] = r->xftColorsFocus[ src_index ]; if( r->TermWin.fade ) r->xftColorsUnfocus[ dst_index ] = r->xftColorsUnfocus[ src_index ]; } #endif SET_PIXCOLOR( r->h, dst_index ); } void rxvt_set_color( rxvt_t *r, int cIndex, const XColor *xcol ) { /* xcol must contain an ALLOCATED color */ r->pixColorsFocus[cIndex] = xcol->pixel; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) rxvt_alloc_xft_color( r, xcol, &r->xftColorsFocus[cIndex] ); #endif if( r->TermWin.fade ) { if( cIndex == Color_pointer ) { /* Don't fade these colors */ r->pixColorsUnfocus[cIndex] = r->pixColorsFocus[cIndex]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) r->xftColorsUnfocus[cIndex] = r->xftColorsFocus[cIndex]; #endif } else rxvt_fade_color( r, xcol, &r->pixColorsUnfocus[cIndex], #ifdef XFT_SUPPORT ISSET_OPTION(r, Opt_xft) ? &r->xftColorsUnfocus[cIndex] : NULL #else NULL #endif ); } SET_PIXCOLOR( r->h, cIndex ); } /* * XXX 2006-05-24 gi1242: Should allocate Xft colors only if Opt_xft is set. In * that case we should avoid allocating XColors, since we can always access them * through xftcolor.pixel. */ /* INTPROTO */ void rxvt_init_colors( rxvt_t *r ) { register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "%s()\n", __func__)); /* Initialize fg/bg colors for each profile */ for (i = 0; i < MAX_PROFILES; i++) { XColor xcol; int vtfg = Rs_foreground + i; int vtbg = Rs_background + i; if( !ISSET_VTFG( r, i ) ) r->h->rs[vtfg] = ISSET_VTFG( r, 0 ) ? r->h->rs[Rs_foreground] : def_colorName[ Color_fg ]; if( !ISSET_VTBG( r, i ) ) r->h->rs[vtbg] = ISSET_VTBG( r, 0 ) ? r->h->rs[Rs_background] : def_colorName[ Color_bg ]; /* foreground color of i terminal */ if( rxvt_parse_alloc_color(r, &xcol, r->h->rs[vtfg]) ) { VTFG(r, i) = xcol.pixel; #ifdef XFT_SUPPORT rxvt_alloc_xft_color( r, &xcol, &(VTXFTFG(r, i)) ); rxvt_fade_color( r, &xcol, &VTFG_FADE(r, i), &VTXFTFG_FADE(r, i) ); #else rxvt_fade_color( r, &xcol, &VTFG_FADE(r, i), NULL ); #endif /* XFT_SUPPORT */ } else { rxvt_msg (DBG_ERROR, DBG_INIT, "Could not alloc foreground color of profile %d", i ); if( i == 0 ) /* Need default fg/bg */ exit( EXIT_FAILURE ); /* Use foreground from profie 0 */ VTFG( r, i ) = VTFG( r, 0 ); VTFG_FADE( r, i ) = VTFG_FADE( r, 0 ); #ifdef XFT_SUPPORT VTXFTFG( r, i ) = VTXFTFG( r, 0 ); VTXFTFG_FADE( r, i ) = VTXFTFG_FADE( r, 0 ); #endif } /* background color of i terminal */ if( rxvt_parse_alloc_color(r, &xcol, r->h->rs[vtbg]) ) { VTBG(r, i) = xcol.pixel; #ifdef XFT_SUPPORT rxvt_alloc_xft_color( r, &xcol, &(VTXFTBG(r, i)) ); rxvt_fade_color( r, &xcol, &VTBG_FADE(r, i), &VTXFTBG_FADE(r, i) ); #else rxvt_fade_color( r, &xcol, &VTBG_FADE(r, i), NULL ); #endif /* XFT_SUPPORT */ } else { rxvt_msg (DBG_ERROR, DBG_INIT, "Could not alloc background color of profile %d", i ); if( i == 0 ) /* Need default fg/bg */ exit( EXIT_FAILURE ); /* Use background from profie 0 */ VTBG( r, i ) = VTBG( r, 0 ); VTBG_FADE( r, i ) = VTBG_FADE( r, 0 ); #ifdef XFT_SUPPORT VTXFTBG( r, i ) = VTXFTBG( r, 0 ); VTXFTBG_FADE( r, i ) = VTXFTBG_FADE( r, 0 ); #endif } } /* Set foreground / background colors */ r->pixColorsFocus[ Color_fg ] = VTFG( r, 0 ); r->pixColorsFocus[ Color_bg ] = VTBG( r, 0 ); if( r->TermWin.fade ) { r->pixColorsUnfocus[ Color_fg ] = VTFG_FADE( r, 0 ); r->pixColorsUnfocus[ Color_bg ] = VTBG_FADE( r, 0 ); } #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { r->xftColorsFocus[ Color_fg ] = VTXFTFG( r, 0 ); r->xftColorsFocus[ Color_bg ] = VTXFTBG( r, 0 ); if( r->TermWin.fade ) { r->xftColorsUnfocus[ Color_fg ] = VTXFTFG( r, 0 ); r->xftColorsUnfocus[ Color_bg ] = VTXFTBG( r, 0 ); } } #endif r->fgbg_tabnum = -1; /* fg/bg corresponds to profile 0, not any particular tab during initialization. */ /* * Allocate generic colors. */ for (i = minCOLOR; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) { XColor xcol; if( IS_NULL(r->h->rs[Rs_color + i]) ) continue; if( !rxvt_parse_alloc_color(r, &xcol, r->h->rs[Rs_color + i]) ) { if( r->h->rs[Rs_color+i] != def_colorName[i] ) { rxvt_msg (DBG_ERROR, DBG_INIT, "Could not allocate color '%s'\n", r->h->rs[Rs_color + i] ); /* Try again with default color */ r->h->rs[Rs_color + i] = def_colorName[i]; i--; continue; } /* * Unable to alloc even the default color. Fall back to fg/bg. */ switch( i ) { #ifndef NO_CURSORCOLOR case Color_cursor2: #endif /* !NO_CURSORCOLOR */ case Color_pointer: rxvt_copy_color( r, i, Color_fg ); break; default: rxvt_copy_color( r, i, Color_bg ); break; } } else { /* * Succeeded allocating the color. Store it in pixColors. */ rxvt_set_color( r, i, &xcol ); } } /* for(i) */ /* * Allocate colors which are essential if they have not been allocated. */ if( XDEPTH <= 2 || !ISSET_PIXCOLOR( r->h, Color_pointer ) ) { /* * NOTE: Fading should be disabled for low depths. And the pointer color * should not be faded. */ r->pixColorsFocus[Color_pointer] = VTFG(r, 0); if( r->TermWin.fade ) r->pixColorsUnfocus[Color_pointer] = VTFG(r, 0); #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { r->xftColorsFocus[Color_pointer] = VTXFTFG(r, 0); if( r->TermWin.fade ) r->xftColorsUnfocus[Color_pointer] = VTXFTFG(r, 0); } #endif SET_PIXCOLOR( r->h, Color_pointer ); } if( XDEPTH <= 2 || !ISSET_PIXCOLOR( r->h, Color_border ) ) rxvt_copy_color( r, Color_border, Color_fg ); /* * get scrollBar/menuBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted from the * fvwm window manager. */ #ifdef KEEP_SCROLLCOLOR if (XDEPTH <= 2) /* Monochrome */ { rxvt_copy_color( r, Color_scroll, Color_fg ); rxvt_copy_color( r, Color_topShadow, Color_bg ); rxvt_copy_color( r, Color_bottomShadow, Color_bg ); } else { XColor xcol[3]; /* * xcol[0] == white * xcol[1] == top shadow * xcol[2] == bot shadow */ xcol[1].pixel = r->pixColorsFocus[Color_scroll]; # ifdef PREFER_24BIT xcol[0].red = xcol[0].green = xcol[0].blue = 0xffffu; rxvt_alloc_color( r, &(xcol[0]), "White" ); XQueryColors(r->Xdisplay, XCMAP, &(xcol[1]), 1); # else xcol[0].pixel = WhitePixel(r->Xdisplay, XSCREEN); XQueryColors(r->Xdisplay, XCMAP, xcol, 2); # endif /* bottomShadowColor */ xcol[2].red = xcol[1].red / 2; xcol[2].green = xcol[1].green / 2; xcol[2].blue = xcol[1].blue / 2; if( !rxvt_alloc_color( r, &(xcol[2]), "Color_bottomShadow" ) ) rxvt_copy_color( r, Color_bottomShadow, Color_Black ); else rxvt_set_color( r, Color_bottomShadow, &xcol[2] ); /* topShadowColor */ xcol[1].red = max((xcol[0].red / 5), xcol[1].red ); xcol[1].green = max((xcol[0].green / 5), xcol[1].green); xcol[1].blue = max((xcol[0].blue / 5), xcol[1].blue ); xcol[1].red = min(xcol[0].red, (xcol[1].red * 7) / 5); xcol[1].green = min(xcol[0].green, (xcol[1].green * 7) / 5); xcol[1].blue = min(xcol[0].blue, (xcol[1].blue * 7) / 5); if( !rxvt_alloc_color(r, &(xcol[1]), "Color_topShadow") ) rxvt_copy_color( r, Color_topShadow, Color_White ); else rxvt_set_color( r, Color_topShadow, &xcol[1] ); } #endif /* KEEP_SCROLLCOLOR */ #ifdef TEXT_SHADOW if (r->h->rs[Rs_textShadow]) { XColor xcol; if( rxvt_parse_alloc_color( r, &xcol, r->h->rs[Rs_textShadow] ) ) { r->TermWin.shadow = xcol.pixel; # ifdef XFT_SUPPORT rxvt_alloc_xft_color( r, &xcol, &(r->TermWin.xftshadow)); # endif } else { r->TermWin.shadow = r->pixColorsFocus[Color_Black]; # ifdef XFT_SUPPORT r->TermWin.xftshadow = r->xftColorsFocus[Color_Black]; # endif } } #endif } /*----------------------------------------------------------------------*/ /* color aliases, fg/bg bright-bold */ /* INTPROTO */ void rxvt_color_aliases( rxvt_t *r, int idx ) { if (r->h->rs[Rs_color + idx] && isdigit((int) *(r->h->rs[Rs_color + idx]))) { int i = atoi(r->h->rs[Rs_color + idx]); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; #ifndef NO_BRIGHTCOLOR r->h->rs[Rs_color + idx] = r->h->rs[Rs_color + minBrightCOLOR + i]; return; #endif } if (i >= 0 && i <= 7) /* normal colors */ r->h->rs[Rs_color + idx] = r->h->rs[Rs_color + minCOLOR +i]; } } /* INTPROTO */ void rxvt_init_win_size( rxvt_t *r ) { int flags = 0; /* must initialize to 0!!! */ short recalc_x = 0, recalc_y = 0, recalc_width = 1, recalc_height = 1; int x, y; unsigned int w, h; r->szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; r->szHint.win_gravity = NorthWestGravity; /* Set default terminal columns and rows */ r->TermWin.ncol = 80; r->TermWin.nrow = 24; r->szHint.x = 0; r->szHint.y = 0; #ifdef TRANSPARENT refreshRootBGVars( r ); #endif /* Get geometry in x, y, w, h */ if (r->h->rs[Rs_geometry]) flags = XParseGeometry(r->h->rs[Rs_geometry], &x, &y, &w, &h); /* Calculate the terminal increment width and height */ #ifndef NO_FRILLS if( ISSET_OPTION(r, Opt2_smoothResize)) { r->szHint.width_inc = 1; r->szHint.height_inc = 1; } else #endif { r->szHint.width_inc = r->TermWin.fwidth; r->szHint.height_inc = r->TermWin.fheight; } /* Calculate the base width and height */ r->szHint.base_width = 2 * r->TermWin.int_bwidth; r->szHint.base_height = 2 * r->TermWin.int_bwidth; #ifdef HAVE_SCROLLBARS if (ISSET_OPTION(r, Opt_scrollBar)) r->szHint.base_width += rxvt_scrollbar_rwidth (r); #endif #ifdef HAVE_MENUBAR if (ISSET_OPTION(r, Opt_showMenu)) r->szHint.base_height += rxvt_menubar_rheight (r); #endif if (NOTSET_OPTION(r, Opt2_hideTabbar)) r->szHint.base_height += rxvt_tabbar_rheight (r); /* Set the terminal minimal width and height */ r->szHint.min_width = r->szHint.base_width + r->TermWin.fwidth; r->szHint.min_height = r->szHint.base_height + r->TermWin.fheight; /* Parse Geometry */ if (flags & WidthValue) { r->TermWin.ncol = BOUND_POSITIVE_INT16(w); #ifndef NO_FRILLS if( ISSET_OPTION(r, Opt2_smoothResize) ) { /* For smoothResize, w as a pixel width (if large enough) */ if(r->TermWin.ncol > r->szHint.base_width + r->TermWin.fwidth) { r->szHint.width = r->TermWin.ncol; r->TermWin.ncol = (r->TermWin.ncol - r->szHint.base_width) / r->TermWin.fwidth; recalc_width = 0; } else r->TermWin.ncol = 1; } #endif r->szHint.flags |= USSize; } if (flags & HeightValue) { r->TermWin.nrow = BOUND_POSITIVE_INT16(h); #ifndef NO_FRILLS if(ISSET_OPTION(r, Opt2_smoothResize)) { /* For smoothResize, w as a pixel height (if large enough) */ if(r->TermWin.nrow > r->szHint.base_height + r->TermWin.fheight) { r->szHint.height = r->TermWin.nrow; r->TermWin.nrow = (r->TermWin.nrow - r->szHint.base_height) / r->TermWin.fheight; recalc_height = 0; } else r->TermWin.nrow = 1; } #endif r->szHint.flags |= USSize; } if (flags & XValue) { r->szHint.x = x; r->szHint.flags |= USPosition; if (flags & XNegative) { recalc_x = 1; r->szHint.win_gravity = NorthEastGravity; } } if (flags & YValue) { r->szHint.y = y; r->szHint.flags |= USPosition; if (flags & YNegative) { recalc_y = 1; if (r->szHint.win_gravity == NorthEastGravity) r->szHint.win_gravity = SouthEastGravity; else r->szHint.win_gravity = SouthWestGravity; } } /* Set the terminal width and height */ if( recalc_width) r->szHint.width = r->szHint.base_width + Width2Pixel (r->TermWin.ncol); if( recalc_height) r->szHint.height = r->szHint.base_height + Height2Pixel (r->TermWin.nrow); /* Recalculate the starting position */ if (recalc_x) r->szHint.x += (DisplayWidth(r->Xdisplay, XSCREEN) - r->szHint.width - 2 * r->TermWin.ext_bwidth); if (recalc_y) r->szHint.y += (DisplayHeight(r->Xdisplay, XSCREEN) - r->szHint.height - 2 * r->TermWin.ext_bwidth); /* Set the terminal window starting position */ r->h->window_vt_x = (ISSET_OPTION(r, Opt_scrollBar_right)) ? 0 : r->szHint.base_width - 2*r->TermWin.int_bwidth; r->h->window_vt_y = r->szHint.base_height - 2*r->TermWin.int_bwidth; if (ISSET_OPTION(r, Opt2_bottomTabbar) && NOTSET_OPTION(r, Opt2_hideTabbar)) r->h->window_vt_y -= rxvt_tabbar_rheight (r); } /*----------------------------------------------------------------------*/ /* * Probe the modifier keymap to get the Meta (Alt) and Num_Lock settings * Use resource ``modifier'' to override the Meta modifier */ /* INTPROTO */ void rxvt_get_ourmods( rxvt_t *r ) { int i, j, k; int requestedmeta, realmeta, realalt; const char* cm; const char* rsmod; XModifierKeymap* map; KeyCode* kc; const unsigned int modmasks[] = { Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; requestedmeta = realmeta = realalt = 0; rsmod = r->h->rs[Rs_modifier]; if (rsmod && STRCASECMP(rsmod, "mod1") >= 0 && STRCASECMP(rsmod, "mod5") <= 0) requestedmeta = rsmod[3] - '0'; map = XGetModifierMapping(r->Xdisplay); kc = map->modifiermap; for (i = 1; i < 6; i++) { k = (i + 2) * map->max_keypermod; /* skip shift/lock/control */ for (j = map->max_keypermod; j--; k++) { if (kc[k] == 0) break; switch (XKeycodeToKeysym(r->Xdisplay, kc[k], 0)) { case XK_Num_Lock: r->h->ModNumLockMask = modmasks[i - 1]; /* FALLTHROUGH */ default: continue; /* for(;;) */ case XK_Meta_L: case XK_Meta_R: cm = "meta"; realmeta = i; break; case XK_Alt_L: case XK_Alt_R: cm = "alt"; realalt = i; break; case XK_Super_L: case XK_Super_R: cm = "super"; break; case XK_Hyper_L: case XK_Hyper_R: cm = "hyper"; break; } if (rsmod && STRNCASECMP(rsmod, cm, STRLEN(cm)) == 0) requestedmeta = i; } } XFreeModifiermap(map); i = (requestedmeta ? requestedmeta : ( realmeta ? realmeta : ( realalt ? realalt : 0))); if (i) r->h->ModMetaMask = modmasks[i - 1]; } /* EXTPROTO */ char** rxvt_string_to_argv( const char *string, int *argc ) { int i = 0; char** pret; const char* pcur; #ifdef INTERNAL_ARGV_SPLIT const char* pbeg; #endif *argc = 0; if( IS_NULL(string) || *string == '\0' ) { *argc = 0; return NULL; } #define MAX_ARGV (1024) /* Up to 64 argv. * * 2006-02-23 gi1242: Use calloc instead of malloc. Thus when freeing pret, * we can safely free all elements till we encounter a NULL pointer. */ pret = (char**) rxvt_calloc (MAX_ARGV, sizeof (char*)); rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "fetch command argv for the tab\n")); #ifdef INTERNAL_ARGV_SPLIT /*{{{*/ /* * 2006-02-23 gi1242: Remember to leave space for a NULL terminated pointer * at the end */ pbeg = pcur = string; for (i = 0; i < MAX_ARGV-2; i ++) { int dq = 0; /* double quote */ int sq = 0; /* single quote */ /* set default argument to NULL */ SET_NULL(pret[i]); /* skip any spaces and non-printable */ while (*pcur && (isspace ((int) *pcur) || !isprint ((int) *pcur))) pcur ++; /* stop if reach end of string */ if (!*pcur) break; /* beginning of the token */ if (isalnum ((int) *pcur) || ispunct ((int) *pcur)) { if ('\"' == *pcur) { /* beginning of double quote */ dq = 1; pbeg = pcur + 1; pcur ++; } else if ('\'' == *pcur) { /* beginning of single quote */ sq = 1; pbeg = pcur + 1; pcur ++; } else /* normal characters */ pbeg = pcur; } #ifdef DEBUG else /* shouldn't happen */ assert (0); #endif /* move forward one character */ pcur ++; /* now fetch the new token */ while( *pcur && /* not end of string */ ( (dq && *pcur != '\"') || /* not end of double quote */ (sq && *pcur != '\'') || /* not end of single quote */ (!dq && !sq && !isspace ((int) *pcur)) ) ) { pcur ++; } if (!*pcur && /* end of string */ (dq || sq)) /* no match of quote is found */ goto NotMatch; if (!*pcur) /* end of string */ { pret[i] = STRDUP (pbeg); rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, " argv[%d] = %s\n", i, pret[i])); break; /* ready to return */ } if ( (dq && *pcur == '\"') /* end of double quote */ || (sq && *pcur == '\'') /* end of single quote */ || (!dq && !sq && isspace ((int) *pcur)) /* space */ ) { int len = sizeof (char) * (pcur - pbeg) + 1; assert (len > 0); /* possible integer overflow? */ pret[i] = (char*) rxvt_malloc (len * sizeof(char)); MEMCPY (pret[i], pbeg, len-1); pret[i][len-1] = (char) 0; rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, " argv[%d] = %s\n", i, pret[i])); /* forward to next character */ pcur ++; /* fetch next token */ continue; } /* shouldn't get here */ assert (0); } /*}}}*/ #else /* !INTERNAL_ARGV_SPLIT */ /* * Pass strings beginning with "!" but not "!!" to /bin/sh -c */ if( *string == '!' && *(++string) != '!' ) { /* Pass command to the shell for word splitting */ pret[i++] = STRDUP( "/bin/sh" ); pret[i++] = STRDUP( "-c" ); pret[i++] = STRDUP( string ); } else { /* * Split command into words at spaces. White spaces can be quoted with * a backslash. However we don't processes chains of "\\" which don't * end in a space or tab. That is "\\a" expands to "\\a" however "\\ " * expands to "\ ", and "\ " expands to a " " which does not split * words. */ pcur = string; for( ; i < MAX_ARGV && *pcur; i++ ) { const int max_argv_len = 1024; char argval[max_argv_len]; int j = 0; /* Skip leading spaces */ while( *pcur == ' ' || *pcur == '\t' ) pcur++; while( *pcur && *pcur != ' ' && *pcur != '\t' && j < max_argv_len - 1 ) { if( *pcur == '\\' ) { const char *s = pcur + 1; /* Count backslashes */ while( *s == '\\' ) s++; if( *s == ' ' || *s == '\t' ) { int nbslashs = s - pcur; int nbytes = min( nbslashs / 2, max_argv_len - j - 1); /* Halve # backslashes */ MEMSET( &argval[j], '\\', nbytes ); pcur = s; j += nbytes; if( nbslashs % 2 == 0 ) break; /* Split word here */ } else { /* Copy backslashes over verbatim */ int nbytes = min( s - pcur, max_argv_len -j -1 ); MEMCPY( &argval[j], pcur, nbytes ); j += nbytes; pcur = s; } } /* if( pcur = '\\' ) */ argval[j++] = *pcur++; } /* while( *pcur ... ) */ if( j ) { argval[j] = '\0'; pret[i] = STRDUP( argval ); } else break; } } /* else [ if( *string != '!' ) ] */ #endif /* !INTERNAL_ARGV_SPLIT */ #undef MAX_ARGV /* set the end of argv */ if (pret[i]) { *argc = i+1; SET_NULL(pret[i+1]); } else if (i) /* non-empty argv */ { *argc = i; } else /* empty argv */ { #if 0 /* 2006-02-23 gi1242: Also need to free the char* pointers in pret? */ rxvt_free (pret); return NULL; #endif goto NotMatch; } /* 2006-02-23 gi1242: Can now reduce the size of pret. */ pret = (char **) rxvt_realloc( pret, (*argc + 1) * sizeof(char*) ); return pret; NotMatch: *argc = 0; { char **s; for( s = pret; NOT_NULL(*s); s++) rxvt_free(*s); } rxvt_free (pret); return NULL; } /* * Sets up the fg/bg correctly in pixColorsFocus/unfocus, the fg/bg of * TermWin.gc, and the fg/bg of the window (if active). */ /* EXTPROTO */ int rxvt_set_vt_colors( rxvt_t *r, int page ) { int changed = 0; int useFocusColors; unsigned long *pix_colors; rxvt_dbgmsg(( DBG_DEBUG, DBG_INIT, "%s(r, page=%d). ", __func__, page )); useFocusColors = ( r->TermWin.focus || !r->TermWin.fade ); pix_colors = (useFocusColors ? r->pixColorsFocus : r->pixColorsUnfocus); if( r->pixColors != pix_colors ) { changed = 1; r->pixColors = pix_colors; } #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) r->xftColors = useFocusColors ? r->xftColorsFocus : r->xftColorsUnfocus; #endif if( rxvt_set_fgbg_colors( r, page ) ) changed = 1; if( changed ) { /* * Set foreground/background color for GC. This is necessary. Since all * VTs share the same GC, if we do not set the color here, color from * other VTs will be used to draw the following text till there is a * color change. */ XSetForeground( r->Xdisplay, r->TermWin.gc, r->pixColors[Color_fg] ); XSetBackground( r->Xdisplay, r->TermWin.gc, r->pixColors[Color_bg] ); if( IS_WIN( PVTS(r, page)->vt ) ) # ifdef TRANSPARENT if (NOTSET_OPTION(r, Opt_transparent)) # endif /* TRANSPARENT */ #ifdef BACKGROUND_IMAGE if (NOT_PIXMAP(PVTS(r, page)->pixmap)) #endif /* BACKGROUND_IMAGE */ XSetWindowBackground(r->Xdisplay, PVTS(r, page)->vt, r->pixColors[Color_bg]); } rxvt_dbgmsg(( DBG_DEBUG, DBG_INIT, "Returning %d\n", changed )); return changed; } /* INTPROTO */ termenv_t rxvt_get_termenv( const char *env ) { if (IS_NULL(env)) return (TERMENV_XTERM); else if (0 == STRCASECMP (env, "xterm")) return (TERMENV_XTERM); else if (0 == STRCASECMP (env, "rxvt")) return (TERMENV_RXVT); else if (0 == STRCASECMP (env, "vt102")) return (TERMENV_VT102); else if (0 == STRCASECMP (env, "vt100")) return (TERMENV_VT100); else if (0 == STRCASECMP (env, "ansi")) return (TERMENV_ANSI); else if (0 == STRCASECMP (env, "dumb")) return (TERMENV_DUMB); else return (TERMENV_XTERM); } /* INTPROTO */ void rxvt_init_vts( rxvt_t *r, int page, int profile ) { #ifdef TTY_GID_SUPPORT struct group* gr = getgrnam( "tty" ); #endif register int i; assert( page < MAX_PAGES ); /* look for an unused term_t structure */ for( i = 0; i < MAX_PAGES; i ++ ) if( -1 == r->vterm[i].vts_idx ) break; assert( i != MAX_PAGES ); rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "Find vterm[%d] for pointer vts[%d]\n", i, page)); /* clear the term_t structure */ r->vts[page] = &(r->vterm[i]); MEMSET( r->vts[page], 0, sizeof( r->vterm[0] ) ); /* set vts_idx for the vterm */ PVTS(r, page)->vts_idx = i; /* Set the profile number */ PVTS(r, page)->profileNum = profile; /* Save the "static" number of this tab */ PVTS(r, page)->globalTabNum = r->ntabs++; #ifdef TTY_GID_SUPPORT /* change group ownership of tty to "tty" */ if (gr) { PVTS(r, page)->ttymode = S_IRUSR | S_IWUSR | S_IWGRP; } else #endif /* TTY_GID_SUPPORT */ { PVTS(r, page)->ttymode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; } /* Initialize term_t (vts) structure */ PVTS( r, page )->saveLines = r->profile[profile].saveLines; /* will be set in rxvt_create_termwin */ UNSET_WIN(PVTS(r, page)->vt); #ifdef XFT_SUPPORT SET_NULL(PVTS(r, page)->xftvt); #endif SET_NULL(PVTS(r, page)->tab_title); /* * Set the tab title format, and window title format. getProfileOption * returns a static string, so duplicate it here */ { const char *stf = getProfileOption( r, profile, Rs_titleFormat ); PVTS(r, page)->title_format = NOT_NULL(stf) ? STRDUP(stf) : NULL; } { const char *wtf = getProfileOption( r, profile, Rs_winTitleFormat ); PVTS(r, page)->winTitleFormat = NOT_NULL(wtf) ? STRDUP(wtf) : NULL; } #ifdef BACKGROUND_IMAGE UNSET_PIXMAP(PVTS(r, page)->pixmap); UNSET_PIXMAP(PVTS(r, page)->bg.pixmap); PVTS(r, page)->bg.x = PVTS(r, page)->bg.y = 50; #endif PVTS(r, page)->cmd_pid = -1; PVTS(r, page)->cmd_fd = PVTS(r, page)->tty_fd = -1; #ifdef UTMP_SUPPORT PVTS(r, page)->next_utmp_action = SAVE; #endif #ifndef NO_SETOWNER_TTYDEV PVTS(r, page)->next_tty_action = SAVE; #endif PVTS(r, page)->holdOption = r->profile[profile].holdOption; PVTS(r, page)->status = 0; PVTS(r, page)->hold = 0; /* clear hold flag */ PVTS(r, page)->dead = 0; /* clear dead flag */ PVTS(r, page)->highlight = 0; /* clear highlight flag */ /* Get term_env type */ PVTS(r, page)->termenv = rxvt_get_termenv ( r->h->rs[Rs_term_name] ? r->h->rs[Rs_term_name] : TERMENV); /* Initialize PrivateModes and SavedModes */ PVTS(r, page)->PrivateModes = PVTS(r, page)->SavedModes = PrivMode_Default; if (ISSET_OPTION(r, Opt_scrollTtyOutputInhibit)) SET_PMODE(r, page, PrivMode_TtyOutputInh); if (ISSET_OPTION(r, Opt_scrollTtyKeypress)) SET_PMODE(r, page, PrivMode_Keypress); if( r->h->skip_pages > 1 /* jump scroll is unset */ ) SET_PMODE(r, page, PrivMode_smoothScroll); #ifndef NO_BACKSPACE_KEY if (STRCMP(r->h->key_backspace, "DEC") == 0) SET_PMODE(r, page, PrivMode_HaveBackSpace); #endif #ifdef HAVE_SCROLLBARS if (rxvt_scrollbar_visible(r)) { SET_PMODE(r, page, PrivMode_scrollBar); SET_SMODE(r, page, PrivMode_scrollBar); } #endif #ifdef HAVE_MENUBAR if (rxvt_menubar_visible(r)) { SET_PMODE(r, page, PrivMode_menuBar); SET_SMODE(r, page, PrivMode_menuBar); } #endif /* Now set VT fg/bg color */ PVTS(r, page)->p_fg = VTFG(r, profile); PVTS(r, page)->p_bg = VTBG(r, profile); if( r->TermWin.fade ) { PVTS(r, page)->p_fgfade = VTFG_FADE(r, profile); PVTS(r, page)->p_bgfade = VTBG_FADE(r, profile); } #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { PVTS(r, page)->p_xftfg = VTXFTFG(r, profile); PVTS(r, page)->p_xftbg = VTXFTBG(r, profile); if( r->TermWin.fade ) { PVTS(r, page)->p_xftfgfade = VTXFTFG_FADE(r, profile); PVTS(r, page)->p_xftbgfade = VTXFTBG_FADE(r, profile); } } #endif /* Initialize input buffer */ PVTS(r, page)->cmdbuf_ptr = PVTS(r, page)->cmdbuf_endp = PVTS(r, page)->cmdbuf_base; /* Initialize write out buffer */ SET_NULL(PVTS(r, page)->v_buffer); SET_NULL(PVTS(r, page)->v_bufstr); SET_NULL(PVTS(r, page)->v_bufptr); SET_NULL(PVTS(r, page)->v_bufend); /* Set screen structure initialization flag */ PVTS(r, page)->init_screen = 0; /* Request a refresh */ PVTS(r, page)->want_refresh = 1; } /*----------------------------------------------------------------------*/ /* rxvt_destroy_termwin() - destroy a terminal window */ /* EXTPROTO */ void rxvt_destroy_termwin( rxvt_t *r, int page ) { assert (page < MAX_PAGES); assert (PVTS(r, page)->tab_title); rxvt_free (PVTS(r, page)->tab_title); SET_NULL(PVTS(r, page)->tab_title); rxvt_free( PVTS(r, page)->title_format ); SET_NULL( PVTS(r, page)->title_format ); #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { if (PVTS(r, page)->xftvt) XftDrawDestroy (PVTS(r, page)->xftvt); SET_NULL(PVTS(r, page)->xftvt); } #endif assert (IS_WIN(PVTS(r, page)->vt)); XDestroyWindow (r->Xdisplay, PVTS(r, page)->vt); UNSET_WIN(PVTS(r, page)->vt); #ifdef BACKGROUND_IMAGE if (IS_PIXMAP(PVTS(r, page)->pixmap)) { XFreePixmap (r->Xdisplay, PVTS(r, page)->pixmap); UNSET_PIXMAP(PVTS(r, page)->pixmap); } if (IS_PIXMAP(PVTS(r, page)->bg.pixmap)) { XFreePixmap (r->Xdisplay, PVTS(r, page)->bg.pixmap); UNSET_PIXMAP(PVTS(r, page)->bg.pixmap); } #endif /* Set vterm index to -1, so that we know it's unused */ PVTS(r, page)->vts_idx = -1; } /* rxvt_create_termwin() - create a terminal window */ /* EXTPROTO */ void rxvt_create_termwin( rxvt_t *r, int page, int profile, const char TAINTED *title ) { long vt_emask; assert( page < MAX_PAGES ); rxvt_init_vts( r, page, profile ); /* * Set the tab title */ if (IS_NULL(title)) title = DEFAULT_TAB_TITLE; PVTS(r, page)->tab_title = (char UNTAINTED *) STRNDUP( title, MAX_TAB_TXT ); #ifdef HAVE_PUTENV /* Set environment variable of tab title */ sprintf (r->h->env_tabtitle, TABTITLEENV "%s", PVTS(r, page)->tab_title); putenv (r->h->env_tabtitle); #endif PVTS(r, page)->tab_width = rxvt_tab_width (r, PVTS(r, page)->tab_title); /* * Now switch fg/bg colors before creating VT because this will use the * fg/bg colors */ rxvt_set_vt_colors( r, page ); /* create the terminal window */ rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "Create VT %d (%dx%d+%dx%d) fg=%06lx, bg=%06lx\n", page, r->h->window_vt_x, r->h->window_vt_y, VT_WIDTH(r), VT_HEIGHT(r), r->pixColors[Color_fg], r->pixColors[Color_bg])); PVTS(r, page)->vt = XCreateSimpleWindow (r->Xdisplay, r->TermWin.parent, r->h->window_vt_x, r->h->window_vt_y, VT_WIDTH(r), VT_HEIGHT(r), 0, r->pixColors[Color_fg], r->pixColors[Color_bg]); assert (IS_WIN(PVTS(r, page)->vt)); #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { PVTS(r, page)->xftvt = XftDrawCreate (r->Xdisplay, PVTS(r, page)->vt, XVISUAL, XCMAP); assert (NOT_NULL(PVTS(r, page)->xftvt)); } #endif /* define cursor for the terminal window */ rxvt_pointer_unblank(r, page); /* define event mask fo the terminal window */ vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask); #ifdef POINTER_BLANK if (ISSET_OPTION(r, Opt_pointerBlank)) vt_emask |= PointerMotionMask; else #endif vt_emask |= (Button1MotionMask | Button3MotionMask); XSelectInput(r->Xdisplay, PVTS(r, page)->vt, vt_emask); #ifdef TRANSPARENT /* Set transparent background */ if (ISSET_OPTION(r, Opt_transparent)) { XSetWindowBackgroundPixmap (r->Xdisplay, PVTS(r, page)->vt, ParentRelative); } #endif /* * Load the background image for terminal window when not transparent */ #ifdef BACKGROUND_IMAGE # ifdef TRANSPARENT if( NOTSET_OPTION(r, Opt_transparent) ) # endif { const char *pf = getProfileOption( r, profile, Rs_backgroundPixmap ); if (NOT_NULL(pf)) { /* Load pixmap for each individual tab */ const char *p = pf; if (NOT_NULL(p = STRCHR(p, ';'))) { p++; rxvt_scale_pixmap(r, page, p); } rxvt_load_bg_pixmap(r, page, pf); /* rxvt_scr_touch(r, page, True); */ } } /* if( NOTSET_OPTION(r, Opt_transparent) ) */ #endif XMapWindow (r->Xdisplay, PVTS(r, page)->vt); } /* * Return the value of an option with profile number "profile". This function * should only be called for profile options. * * The string returned is one of r->h->rs[], so should not be freed. */ /* EXTPROTO */ const char * getProfileOption( rxvt_t *r, int profile, int resource ) { assert( profile >= 0 || profile < MAX_PROFILES ); /* * Profile 0 is default, so if the profile option is unset, fall back to * profile 0. */ return NOT_NULL(r->h->rs[resource + profile]) ? r->h->rs[resource + profile] : r->h->rs[resource]; } /* INTPROTO */ void rxvt_set_borderless( rxvt_t *r ) { Atom prop; CARD32 hints; /* KDE/GNOME hints */ MWMHints mwmhints; /* Motif hints */ hints = (CARD32) 0; mwmhints.flags = MWM_HINTS_DECORATIONS; mwmhints.decorations = 0; /* Motif compatible WM */ prop = XInternAtom (r->Xdisplay, "_MOTIF_WM_HINTS", True); if (IS_ATOM(prop)) XChangeProperty (r->Xdisplay, r->TermWin.parent, prop, prop, 32, PropModeReplace, (unsigned char*) &mwmhints, PROP_MWM_HINTS_ELEMENTS); /* GNOME compatible WM */ prop = XInternAtom (r->Xdisplay, "_WIN_HINTS", True); if (IS_ATOM(prop)) XChangeProperty (r->Xdisplay, r->TermWin.parent, prop, prop, 32, PropModeReplace, (unsigned char*) &hints, 1); /* KDE compatible WM */ prop = XInternAtom (r->Xdisplay, "KWM_WIN_DECORATION", True); if (IS_ATOM(prop)) XChangeProperty (r->Xdisplay, r->TermWin.parent, prop, prop, 32, PropModeReplace, (unsigned char*) &hints, 1); } /* * Send a message to an EWMH compatible window manager. */ /* EXTPROTO */ Status ewmh_message( Display *dpy, Window root_win, Window client_win, Atom msgAtom, long d0, long d1, long d2, long d3, long d4) { XEvent event; if (NOT_ATOM(msgAtom)) return 1; event.xclient.type = ClientMessage; event.xclient.serial = 0; event.xclient.send_event = True; event.xclient.message_type = msgAtom; event.xclient.window = client_win; event.xclient.format = 32; event.xclient.data.l[0] = d0; event.xclient.data.l[1] = d1; event.xclient.data.l[2] = d2; event.xclient.data.l[3] = d3; event.xclient.data.l[4] = d4; return XSendEvent( dpy, root_win, False, SubstructureRedirectMask | SubstructureNotifyMask, &event); } /* INTPROTO */ void rxvt_set_desktop( rxvt_t* r, CARD32 desktop ) { /* GNOME compatible WM */ if (desktop >= 0 && desktop <= 64 && IS_ATOM(r->h->xa[XA_WIN_WORKSPACE])) XChangeProperty(r->Xdisplay, r->TermWin.parent, r->h->xa[XA_WIN_WORKSPACE], XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &desktop, 1L); /* WindowMaker/FreeDesktop.org compatible WM */ if (desktop >= 0 && desktop <= 64 && IS_ATOM(r->h->xa[XA_NET_WM_DESKTOP])) XChangeProperty(r->Xdisplay, r->TermWin.parent, r->h->xa[XA_NET_WM_DESKTOP], XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &desktop, 1L); } /* EXTPROTO */ CARD32 rxvt_get_desktop( rxvt_t* r ) { Atom ret_type; int format; unsigned long nitems; unsigned long bytes_after; unsigned char *prop; CARD32 desktop; if (NOT_ATOM(r->h->xa[XA_NET_WM_DESKTOP])) return 0; if( XGetWindowProperty( r->Xdisplay, r->TermWin.parent, r->h->xa[XA_NET_WM_DESKTOP], 0L, LONG_MAX, False, XA_CARDINAL, &ret_type, &format, &nitems, &bytes_after, &prop) != Success ) return 0; if( ret_type == XA_CARDINAL && format == 32 ) { desktop = ((CARD32*) prop)[0]; if (desktop < 0 || desktop > 64) desktop = 0; } else desktop = 0; XFree( prop); rxvt_dbgmsg(( DBG_DEBUG, DBG_INIT, "Desktop: %lu\n", desktop )); return desktop; } /*----------------------------------------------------------------------*/ /* rxvt_create_show_windows() - Open and map the window */ /* EXTPROTO */ void rxvt_create_show_windows( rxvt_t *r, int argc, const char *const *argv ) { XClassHint class_hint; XWMHints wm_hint; XTextProperty win_prop; XTextProperty icon_prop; XGCValues gcvalue; unsigned long gcmask; #ifndef NO_FRILLS CARD32 pid = (CARD32) getpid (); #endif #ifdef TRANSPARENT register int i; #endif #ifdef POINTER_BLANK static const XColor blackcolour = { 0, 0, 0, 0, 0, 0 }; #endif Window parent; /* WinID to use for parent window */ #ifdef PREFER_24BIT XSetWindowAttributes attributes; XWindowAttributes gattr; XCMAP = DefaultColormap(r->Xdisplay, XSCREEN); XVISUAL = DefaultVisual(r->Xdisplay, XSCREEN); if (ISSET_OPTION(r, Opt_transparent)) { XGetWindowAttributes(r->Xdisplay, RootWindow(r->Xdisplay, XSCREEN), &gattr); XDEPTH = gattr.depth; } else { XDEPTH = DefaultDepth(r->Xdisplay, XSCREEN); /* * If depth is not 24, look for a 24bit visual. */ if (XDEPTH != 24) { XVisualInfo vinfo; if (XMatchVisualInfo(r->Xdisplay, XSCREEN, 24, TrueColor, &vinfo)) { XDEPTH = 24; XVISUAL = vinfo.visual; XCMAP = XCreateColormap(r->Xdisplay, RootWindow(r->Xdisplay, XSCREEN), XVISUAL, AllocNone); } } } #endif /* grab colors before netscape does */ rxvt_init_colors (r); /* * Initialize fonts. * . Always load X11 fonts since pointer_blank uses it * . Load XFT font after X11 fonts. If succeeds, XFT font will * update font width/height and be used by default * * 03/09/2006 gi1242: TODO Don't load the X11 font unless absolutely * necessary. It will speed up startup (minimaly), and reduce resource * usage (minimaly). */ #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { if (!rxvt_init_font_xft (r)) { rxvt_msg (DBG_INFO, DBG_INIT, "Failed to load FreeType font, fallback to X11 font\n"); /* disable xft */ UNSET_OPTION(r, Opt_xft); } else xftInitACS (r->Xdisplay, XROOT, XDEPTH); } #endif /* init fallback X11 font */ rxvt_init_font_x11( r ); /* * must initialize scrollbar before initialize window size and * create windows. */ #ifdef HAVE_SCROLLBARS rxvt_scrollbar_init (r); #endif rxvt_init_win_size (r); /* * Use window specified by -into option as the parent window. */ if( r->h->rs[Rs_container_window] ) { XWindowAttributes attrs; r->h->allowedxerror = 1; /* Enable Xerror reporting */ r->h->xerror_return = Success; parent = strtoul( r->h->rs[Rs_container_window], NULL, 0 ); XGetWindowAttributes( r->Xdisplay, parent, &attrs ); /* Check if we have valid attributes */ if( r->h->xerror_return != Success || attrs.class == InputOnly ) { rxvt_msg (DBG_ERROR, DBG_INIT, "Unable to embed into Win 0x%lx", parent ); parent = XROOT; } r->h->allowedxerror = 0; /* Disable Xerror reporting */ } else parent = XROOT; /* * parent window - reverse video so we can see placement errors sub-window * placement & size in rxvt_resize_subwindows() */ #ifdef PREFER_24BIT attributes.background_pixel = r->pixColorsFocus[Color_bg]; attributes.border_pixel = r->pixColorsFocus[Color_border]; attributes.colormap = XCMAP; r->TermWin.parent = XCreateWindow(r->Xdisplay, parent, r->szHint.x, r->szHint.y, r->szHint.width, r->szHint.height, r->TermWin.ext_bwidth, XDEPTH, InputOutput, XVISUAL, CWBackPixel | CWBorderPixel | CWColormap, &attributes); #else r->TermWin.parent = XCreateSimpleWindow(r->Xdisplay, parent, r->szHint.x, r->szHint.y, r->szHint.width, r->szHint.height, r->TermWin.ext_bwidth, r->pixColorsFocus[Color_border], r->pixColorsFocus[Color_bg]); #endif #ifdef XFT_SUPPORT if (ISSET_OPTION(r, Opt_xft)) { /* create XFT draw, test only */ XftDraw* xftdraw = XftDrawCreate( r->Xdisplay, r->TermWin.parent, XVISUAL, XCMAP); if (xftdraw) { XftDrawDestroy (xftdraw); /* some cleanup work if successfully create xft window */ # ifdef POINTER_BLANK /* * 2006-01-21 gi1242: I'm not sure why pointer blank is disabled * with xft. It works fine for me, so I re-enabled it. */ # if 0 /* disable pointer blank */ UNSET_OPTION(r, Opt_pointerBlank); # endif # endif } } #endif # ifdef HAVE_X11_SM_SMLIB_H if (ISSET_OPTION(r, Opt2_enableSessionMgt)) rxvt_session_init (r); # endif /* * Now set window properties, like title, icon name and hints */ /* window title name */ win_prop.value = (unsigned char*) r->h->rs[Rs_title]; win_prop.nitems = STRLEN (win_prop.value); win_prop.encoding = XA_STRING; win_prop.format = 8; /* icon name */ icon_prop.value = (unsigned char*) r->h->rs[Rs_iconName]; icon_prop.nitems = STRLEN (icon_prop.value); icon_prop.encoding = XA_STRING; icon_prop.format = 8; /* window manager hints */ wm_hint.flags = (InputHint | StateHint | WindowGroupHint); wm_hint.input = True; wm_hint.initial_state = ISSET_OPTION(r, Opt_iconic) ? IconicState : NormalState; wm_hint.window_group = r->TermWin.parent; /* window icon hint */ #ifdef HAVE_LIBXPM if( r->h->rs[Rs_appIcon] ) { Pixmap appIcon, appIconMask; XpmReadFileToPixmap( r->Xdisplay, r->TermWin.parent, (char*) r->h->rs[Rs_appIcon], &appIcon, &appIconMask, 0); if( appIcon != None && appIconMask != None ) { wm_hint.icon_pixmap = appIcon; wm_hint.icon_mask = appIconMask; wm_hint.flags |= IconPixmapHint | IconMaskHint; } } #endif /* HAVE_LIBXPM */ /* class hints */ class_hint.res_name = (char*) r->h->rs[Rs_name]; class_hint.res_class = (char*) APL_CLASS; XSetWMProperties (r->Xdisplay, r->TermWin.parent, &win_prop, &icon_prop, (char**)argv, argc, &r->szHint, &wm_hint, &class_hint); #if 0 /* If the pixmap's are free'ed, then the WM will not display them. */ if( wm_hint.flags & IconPixmapHint ) { XFreePixmap( r->Xdisplay, wm_hint.icon_pixmap ); XFreePixmap( r->Xdisplay, wm_hint.icon_mask ); } #endif /* set terminal title */ rxvt_set_term_title (r, win_prop.value); /* set icon title */ rxvt_set_icon_name (r, icon_prop.value); /* command line */ XSetCommand (r->Xdisplay, r->TermWin.parent, (char**) argv, argc); /* override redirect */ if (ISSET_OPTION(r, Opt2_overrideRedirect)) { XSetWindowAttributes attrib; attrib.override_redirect = True; XChangeWindowAttributes(r->Xdisplay, r->TermWin.parent, CWOverrideRedirect, &attrib); } #ifndef NO_FRILLS XChangeProperty (r->Xdisplay, r->TermWin.parent, r->h->xa[XA_NET_WM_PID], XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &pid, 1); #endif if (ISSET_OPTION(r, Opt2_borderLess)) { rxvt_set_borderless (r); } if (r->h->rs[Rs_desktop]) { CARD32 desktop = (CARD32) atoi (r->h->rs[Rs_desktop]); rxvt_set_desktop (r, desktop); } /* * set WM_CLIENT_LEADER property so that session management proxy can handle * us even session management is not enabled. */ if (IS_ATOM(r->h->xa[XA_WM_CLIENT_LEADER])) XChangeProperty( r->Xdisplay, r->TermWin.parent, r->h->xa[XA_WM_CLIENT_LEADER], XA_WINDOW, 32, PropModeReplace, (unsigned char*) &(r->TermWin.parent), 1L ); # ifdef HAVE_X11_SM_SMLIB_H if (NOT_NULL(r->TermWin.sm_conn) && NOT_NULL(r->TermWin.sm_client_id) && STRCMP (r->TermWin.sm_client_id, "") ) { if (IS_ATOM(r->h->xa[XA_SM_CLIENT_ID])) XChangeProperty(r->Xdisplay, r->TermWin.parent, r->h->xa[XA_SM_CLIENT_ID], XA_STRING, 8, PropModeReplace, (unsigned char*) r->TermWin.sm_client_id, STRLEN(r->TermWin.sm_client_id)); } # endif /* HAVE_X11_SM_SMLIB_H */ #ifdef TRANSPARENT r->TermWin.parenttree[0] = r->TermWin.parent; for (i = 1; i < PARENT_NUMBER; i ++) UNSET_WIN(r->TermWin.parenttree[i]); /* * XXX 2006-01-02 gi1242: This is inefficient. If window is pseudo * transparent, then the background pixmap will be reset later to something * else. */ #if 0 if (ISSET_OPTION(r, Opt_transparent)) { XSetWindowBackgroundPixmap (r->Xdisplay, r->TermWin.parent, ParentRelative); } #endif #endif /* TRANSPARENT */ XSelectInput(r->Xdisplay, r->TermWin.parent, (KeyPressMask #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) | KeyReleaseMask #endif | FocusChangeMask #ifdef MONITOR_ENTER_LEAVE | EnterWindowMask | LeaveWindowMask #endif | VisibilityChangeMask | StructureNotifyMask)); /* ** vt cursor: Black-on-White is standard, but this is more ** popular */ r->term_pointer = XCreateFontCursor(r->Xdisplay, XC_xterm); /* scrollbar/menubar/tabbar window pointer */ r->h->bar_pointer = XCreateFontCursor(r->Xdisplay, XC_left_ptr); #ifdef POINTER_BLANK if (NOTSET_OPTION(r, Opt_pointerBlank)) UNSET_CURSOR(r->h->blank_pointer); else r->h->blank_pointer = XCreateGlyphCursor(r->Xdisplay, r->TermWin.font->fid, r->TermWin.font->fid, ' ', ' ', (XColor*) &blackcolour, (XColor*) &blackcolour); #endif /* graphics context for the vt window */ #ifdef XFT_SUPPORT if (NOTSET_OPTION(r, Opt_xft)) #endif gcvalue.font = r->TermWin.font->fid; gcvalue.foreground = r->pixColorsFocus[Color_fg]; gcvalue.background = r->pixColorsFocus[Color_bg]; gcvalue.graphics_exposures = 1; gcmask = GCForeground | GCBackground | GCGraphicsExposures; #ifdef XFT_SUPPORT if (NOTSET_OPTION(r, Opt_xft)) #endif gcmask |= GCFont; r->TermWin.gc = XCreateGC(r->Xdisplay, r->TermWin.parent, gcmask, &gcvalue); #ifdef HAVE_SCROLLBARS rxvt_scrollbar_create (r); if (ISSET_OPTION(r, Opt_scrollBar)) { rxvt_scrollbar_show (r); } #endif #ifdef HAVE_MENUBAR if (r->h->rs[Rs_menu] && STRCASECMP( r->h->rs[Rs_menu], "none")) { /* * Only load menubar if arg of -menu option is not none */ rxvt_menubar_load_file (r, (unsigned char*) r->h->rs[Rs_menu]); } else rxvt_menubar_load_file( r, (unsigned char*) "default.menu"); rxvt_menubar_create (r); if (ISSET_OPTION(r, Opt_showMenu)) rxvt_menubar_show (r); /* * 2006-05-28 gi1242: If popup menu 1 is not defined, set it to an empty * menu (so that the tab list will be popped up on control clicks and right * clicks on the tabbar). */ if (IS_NULL(r->h->popupMenu[0])) { rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "Setting popup menu 1 to a tab list\n")); r->h->popupMenu[0] = (menu_t *) rxvt_calloc( 1, sizeof(menu_t) ); r->h->popupMenu[0]->len = sizeof( "Switch to tab" ); r->h->popupMenu[0]->name = (unsigned char*) STRDUP ("Switch to tab"); } # endif rxvt_tabbar_create (r); if (NOTSET_OPTION(r, Opt2_hideTabbar)) rxvt_tabbar_show (r); XMapWindow (r->Xdisplay, r->TermWin.parent); /* * We have to wait till our window is mapped before we can set the maximized * or fullscreen options. */ if( ISSET_OPTION(r, Opt2_maximized)) ewmh_message( r->Xdisplay, XROOT, r->TermWin.parent, XInternAtom( r->Xdisplay, "_NET_WM_STATE", True), _NET_WM_STATE_ADD, XInternAtom( r->Xdisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", True), XInternAtom( r->Xdisplay, "_NET_WM_STATE_MAXIMIZED_VERT", True), 0, 0); else if (ISSET_OPTION (r, Opt2_fullscreen)) ewmh_message( r->Xdisplay, XROOT, r->TermWin.parent, XInternAtom( r->Xdisplay, "_NET_WM_STATE", True), _NET_WM_STATE_ADD, XInternAtom( r->Xdisplay, "_NET_WM_STATE_FULLSCREEN", True), 0, 0, 0); } /*----------------------------------------------------------------------*/ /* * Executes a command in the background, and returns immediately. Returns 1 on * success, 0 otherwise. */ int rxvt_async_exec( rxvt_t *r, const char *cmd) { int pid; int argc; char **argv; if( r->nAsyncChilds >= MAX_CHILDS ) { rxvt_msg (DBG_ERROR, DBG_INIT, "Too many childs." " Increase MAX_CHILDS in src/feature.h" ); return 0; } pid = fork(); switch( pid ) { case -1: rxvt_msg (DBG_ERROR, DBG_INIT, "Unable to fork" ); return 0; /* Failure */ /* NOT REACHED */ case 0: /* * Close all file descriptors, and reset signal masks to their * default values before exec'ing the child process. */ clean_sigmasks_and_fds( r, ATAB(r) ); argv = rxvt_string_to_argv( cmd, &argc ); execvp( argv[0], argv ); rxvt_msg (DBG_ERROR, DBG_INIT, "Failed to exec %s", argv[0] ); exit(1); /* NOT REACHED */ default: rxvt_dbgmsg ((DBG_VERBOSE, DBG_INIT, "Forked %s", cmd)); r->asyncChilds[ r->nAsyncChilds++ ] = pid; return 1; } } /* * Run the command in a subprocess and return a file descriptor for the * master end of the pseudo-teletype pair with the command talking to * the slave. */ /* EXTPROTO */ int rxvt_run_command(rxvt_t *r, int page, const char **argv) { int cfd, er; rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "%s(%d, argv)", __func__, page)); /* get master (pty) */ if ((cfd = rxvt_get_pty(&(PVTS(r, page)->tty_fd), (char**) &(PVTS(r, page)->ttydev))) < 0) { rxvt_msg (DBG_ERROR, DBG_INIT, "can't open pseudo-tty"); return -1; } #ifdef FD_SETSIZE if (r->Xfd > FD_SETSIZE || cfd > FD_SETSIZE) { rxvt_msg (DBG_ERROR, DBG_INIT, "fd too high: %d max", FD_SETSIZE); return -1; } #endif fcntl(cfd, F_SETFL, O_NDELAY); /* get slave (tty) */ if (PVTS(r, page)->tty_fd < 0) { #if !defined(NO_SETOWNER_TTYDEV) && !defined(OS_CYGWIN) rxvt_privileged_ttydev(r, page, SAVE); #endif if ((PVTS(r, page)->tty_fd = rxvt_get_tty(PVTS(r, page)->ttydev)) < 0) { close(cfd); rxvt_msg (DBG_ERROR, DBG_INIT, "can't open slave tty %s", PVTS(r, page)->ttydev); return -1; } } /* Get tty mode before fork */ #ifndef NO_BACKSPACE_KEY if (r->h->key_backspace[0] && !r->h->key_backspace[1]) er = r->h->key_backspace[0]; else if (STRCMP(r->h->key_backspace, "DEC") == 0) er = '\177'; /* the initial state anyway */ else #endif er = -1; rxvt_get_ttymode(&(PVTS(r, page)->tio), er); rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "argv = 0x%x\n", (unsigned int) argv)); #ifndef __QNX__ /* * Spin off the command interpreter */ switch (PVTS(r, page)->cmd_pid = fork()) { case -1: rxvt_msg (DBG_ERROR, DBG_INIT, "can't fork"); close (cfd); return -1; case 0: /* * To debug the child, follow these steps: * * - enable sleep in the following * - launch gdb, set breakpoint before fork * - run the program, step over fork, then get child pid * - launch another gdb, attach to child process via pid * - in child's gdb, set breakpoint after sleep * - run 'continue' in child's gdb, debug child process */ #if 0 sleep(10); #endif if( rxvt_control_tty( PVTS(r, page)->tty_fd, PVTS(r, page)->ttydev ) < 0 ) { rxvt_msg (DBG_ERROR, DBG_INIT, "Could not obtain control of tty"); } else { /* * Reopen stdin, stdout and stderr over the tty file * descriptor */ dup2( PVTS(r, page)->tty_fd, STDIN_FILENO ); dup2( PVTS(r, page)->tty_fd, STDOUT_FILENO ); dup2( PVTS(r, page)->tty_fd, STDERR_FILENO ); clean_sigmasks_and_fds( r, page ); /* * Spin off command interpreter. */ rxvt_run_child(r, page, argv); /* * If we got here, then we failed to exec the child process. */ rxvt_msg (DBG_ERROR, DBG_INIT, "Could not execute %s.\n", (argv && argv[0]) ? argv[0] : "shell"); } /* Something went wrong. Kill the child. */ if( !(PVTS(r,page)->holdOption & HOLD_STATUSBIT) && !(PVTS(r,page)->holdOption & HOLD_ALWAYSBIT) ) /* If tab won't be held open, wait a little */ sleep(5); exit( EXIT_FAILURE ); /* NOT REACHED */ default: { #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) int fdstdin; fdstdin = dup(STDIN_FILENO); dup2(PVTS(r, page)->tty_fd, STDIN_FILENO); #endif #ifdef UTMP_SUPPORT # ifdef UTEMPTER_SUPPORT /* utempter hack, it needs cmd_fd */ PVTS(r, page)->cmd_fd = cfd; # endif rxvt_privileged_utmp(r, page, SAVE); # ifdef UTEMPTER_SUPPORT /* utempter hack, restore cmd_fd */ PVTS(r, page)->cmd_fd = -1; # endif #endif #if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) dup2(fdstdin, STDIN_FILENO); close(fdstdin); #endif } /* * keep STDERR_FILENO, PVTS(r, page)->cmd_fd, r->Xfd open */ close(PVTS(r, page)->tty_fd); PVTS(r, page)->tty_fd = -1; break; } #else /* __QNX__ uses qnxspawn() */ fchmod(PVTS(r, page)->tty_fd, 0622); fcntl(PVTS(r, page)->tty_fd, F_SETFD, FD_CLOEXEC); fcntl(cfd, F_SETFD, FD_CLOEXEC); PVTS(r, page)->cmd_fd = cfd; if (rxvt_run_child(r, page, argv) == -1) /*exit(EXIT_FAILURE);*/ return -1; #endif return cfd; } /* ------------------------------------------------------------------------- * * CHILD PROCESS OPERATIONS * * ------------------------------------------------------------------------- */ /* * Reset signal masks to their default values, and close all open file * descriptors. */ /* EXTPROTO */ void clean_sigmasks_and_fds( rxvt_t* r, int page ) { #ifdef SIGTSTP struct sigaction ignore; #endif struct sigaction deflt; register int i; /* Close all file descriptors except STDXXX */ for (i = STDERR_FILENO + 1; i < r->num_fds; i ++) close (i); if (PVTS(r, page)->tty_fd > 2) { close (PVTS(r, page)->tty_fd); PVTS(r, page)->tty_fd = -1; } /* reset signal handlers */ deflt.sa_handler = SIG_DFL; deflt.sa_flags = 0; sigemptyset( &deflt.sa_mask ); sigaction( SIGINT, &deflt, NULL ); sigaction( SIGQUIT, &deflt, NULL ); sigaction( SIGTERM, &deflt, NULL ); sigaction( SIGHUP, &deflt, NULL ); sigaction( SIGPIPE, &deflt, NULL ); sigaction( SIGCHLD, &deflt, NULL ); /* * Mimick login's behavior by disabling the job control signals a shell that * wants them can turn them back on */ #ifdef SIGTSTP ignore.sa_handler = SIG_IGN; ignore.sa_flags = 0; sigemptyset( &ignore.sa_mask ); sigaction( SIGTSTP, &ignore, NULL ); sigaction( SIGTTIN, &ignore, NULL ); sigaction( SIGTTOU, &ignore, NULL ); #endif /* SIGTSTP */ } /* * The only open file descriptor is the slave tty - so no error messages. * returns are fatal */ /* INTPROTO */ int rxvt_run_child(rxvt_t* r, int page, const char **argv) { char* login; /* rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "argv = %x\n", argv)); */ /* init terminal attributes */ SET_TTYMODE( STDIN_FILENO, &(PVTS(r, page)->tio) ); if (ISSET_OPTION(r, Opt_console)) /* be virtual console, fail * silently */ { #ifdef TIOCCONS unsigned int on = 1; ioctl(STDIN_FILENO, TIOCCONS, &on); #elif defined (SRIOCSREDIR) int fd; fd = open( CONSOLE, O_WRONLY, 0 ); if (fd >= 0) { if( ioctl( fd, SRIOCSREDIR, NULL ) < 0 ) close( fd ); } #endif /* SRIOCSREDIR */ } /* set window size */ rxvt_tt_winsize( STDIN_FILENO, r->TermWin.ncol, r->TermWin.nrow, 0 ); #ifndef __QNX__ /* command interpreter path */ if (NOT_NULL(argv)) { int i; for (i = 0; argv[i]; i++) rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "argv [%d] = \"%s\"\n", i, argv[i])); execvp(argv[0], (char *const *)argv); /* no error message: STDERR is closed! */ } else { const char *argv0, *shell; if (IS_NULL(shell = getenv("SHELL")) || ((char) 0 == *shell) ) { # ifdef HAVE_GETPWUID struct passwd* pwent = getpwuid( getuid () ); if (IS_NULL(pwent) || IS_NULL(shell = pwent->pw_shell) || (char) 0 == *shell ) # endif /* HAVE_GETPWUID */ shell = "/bin/sh"; } argv0 = (const char *) rxvt_r_basename( shell); if (ISSET_OPTION(r, Opt_loginShell)) { int l = STRLEN(argv0) + 2; if (l <= 0 || l > 4096) /* possible integer overflow */ l = 4096; login = rxvt_malloc(l * sizeof(char)); login[0] = '-'; STRNCPY(&login[1], argv0, l-2); login[l-1] = (char) 0; argv0 = login; } execlp( shell, argv0, NULL ); /* no error message: STDERR is closed! */ } #else /* __QNX__ uses qnxspawn() */ { char iov_a[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; char* command = NULL, fullcommand[_MAX_PATH]; char** arg_v, *arg_a[2] = { NULL, NULL }; if (argv != NULL) { if (access(argv[0], X_OK) == -1) { if (IS_NULL(STRCHR(argv[0], '/'))) { searchenv(argv[0], "PATH", fullcommand); if (fullcommand[0] != '\0') command = fullcommand; } if (access(command, X_OK) == -1) return -1; } else command = argv[0]; arg_v = argv; } else { if (IS_NULL(command = getenv("SHELL")) || (char) 0 == *command) command = "/bin/sh"; arg_a[0] = my_basename(command); if (ISSET_OPTION(r, Opt_loginShell)) { int l = STRLEN(arg_a[0]) + 2; if (l <= 0 || l > 4096) /* possible integer overflow */ l = 4096; login = rxvt_malloc(l * sizeof(char)); login[0] = '-'; STRNCPY(&login[1], arg_a[0], l-2); login[l-1] = (char) 0; arg_a[0] = login; } arg_v = arg_a; } iov_a[0] = iov_a[1] = iov_a[2] = PVTS(r, page)->tty_fd; PVTS(r, page)->cmd_pid = qnx_spawn(0, 0, 0, -1, -1, _SPAWN_SETSID | _SPAWN_TCSETPGRP, command, arg_v, environ, iov_a, 0); if (login) rxvt_free(login); close(PVTS(r, page)->tty_fd); PVTS(r, page)->tty_fd = -1; return PVTS(r, page)->cmd_fd; } #endif return -1; } /* ------------------------------------------------------------------------- * * GET TTY CURRENT STATE * * ------------------------------------------------------------------------- */ /* rxvt_get_ttymode() */ /* INTPROTO */ void rxvt_get_ttymode(ttymode_t *tio, int erase) { #ifdef HAVE_TERMIOS_H /* * standard System V termios interface */ if (GET_TERMIOS(STDIN_FILENO, tio) < 0) { /* return error - use system defaults */ tio->c_cc[VINTR] = CINTR; tio->c_cc[VQUIT] = CQUIT; tio->c_cc[VERASE] = CERASE; tio->c_cc[VKILL] = CKILL; tio->c_cc[VSTART] = CSTART; tio->c_cc[VSTOP] = CSTOP; tio->c_cc[VSUSP] = CSUSP; # ifdef VDSUSP tio->c_cc[VDSUSP] = CDSUSP; # endif # ifdef VREPRINT tio->c_cc[VREPRINT] = CRPRNT; # endif # ifdef VDISCRD tio->c_cc[VDISCRD] = CFLUSH; # endif # ifdef VWERSE tio->c_cc[VWERSE] = CWERASE; # endif # ifdef VLNEXT tio->c_cc[VLNEXT] = CLNEXT; # endif } tio->c_cc[VEOF] = CEOF; tio->c_cc[VEOL] = VDISABLE; # ifdef VEOL2 tio->c_cc[VEOL2] = VDISABLE; # endif # ifdef VSWTC tio->c_cc[VSWTC] = VDISABLE; # endif # ifdef VSWTCH tio->c_cc[VSWTCH] = VDISABLE; # endif # if VMIN != VEOF tio->c_cc[VMIN] = 1; # endif # if VTIME != VEOL tio->c_cc[VTIME] = 0; # endif if (erase != -1) tio->c_cc[VERASE] = (char)erase; /* input modes */ tio->c_iflag = (BRKINT | IGNPAR | ICRNL # ifdef IMAXBEL | IMAXBEL # endif | IXON); /* output modes */ tio->c_oflag = (OPOST | ONLCR); /* control modes */ tio->c_cflag = (CS8 | CREAD); /* line discipline modes */ tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO # if defined (ECHOCTL) && defined (ECHOKE) | ECHOCTL | ECHOKE # endif | ECHOE | ECHOK); # else /* HAVE_TERMIOS_H */ /* * sgtty interface */ /* get parameters -- gtty */ if (ioctl(STDIN_FILENO, TIOCGETP, &(tio->sg)) < 0) { tio->sg.sg_erase = CERASE; /* ^H */ tio->sg.sg_kill = CKILL; /* ^U */ } if (erase != -1) tio->sg.sg_erase = (char)erase; tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP); /* get special characters */ if (ioctl(STDIN_FILENO, TIOCGETC, &(tio->tc)) < 0) { tio->tc.t_intrc = CINTR; /* ^C */ tio->tc.t_quitc = CQUIT; /* ^\ */ tio->tc.t_startc = CSTART; /* ^Q */ tio->tc.t_stopc = CSTOP; /* ^S */ tio->tc.t_eofc = CEOF; /* ^D */ tio->tc.t_brkc = -1; } /* get local special chars */ if (ioctl(STDIN_FILENO, TIOCGLTC, &(tio->lc)) < 0) { tio->lc.t_suspc = CSUSP; /* ^Z */ tio->lc.t_dsuspc = CDSUSP; /* ^Y */ tio->lc.t_rprntc = CRPRNT; /* ^R */ tio->lc.t_flushc = CFLUSH; /* ^O */ tio->lc.t_werasc = CWERASE; /* ^W */ tio->lc.t_lnextc = CLNEXT; /* ^V */ } /* get line discipline */ ioctl(STDIN_FILENO, TIOCGETD, &(tio->line)); # ifdef NTTYDISC tio->line = NTTYDISC; # endif /* NTTYDISC */ tio->local = (LCRTBS | LCRTERA | LCTLECH | LPASS8 | LCRTKIL); #endif /* HAVE_TERMIOS_H */ /* * Debugging */ #ifdef DEBUG #ifdef HAVE_TERMIOS_H /* c_iflag bits */ rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "Input flags\n")); /* cpp token stringize doesn't work on all machines */ # define FOO(flag,name) \ if ((tio->c_iflag) & flag) \ rxvt_msg (DBG_DEBUG, DBG_INIT, "%s ", name) /* c_iflag bits */ FOO(IGNBRK, "IGNBRK"); FOO(BRKINT, "BRKINT"); FOO(IGNPAR, "IGNPAR"); FOO(PARMRK, "PARMRK"); FOO(INPCK, "INPCK"); FOO(ISTRIP, "ISTRIP"); FOO(INLCR, "INLCR"); FOO(IGNCR, "IGNCR"); FOO(ICRNL, "ICRNL"); FOO(IXON, "IXON"); FOO(IXOFF, "IXOFF"); # ifdef IUCLC FOO(IUCLC, "IUCLC"); # endif # ifdef IXANY FOO(IXANY, "IXANY"); # endif # ifdef IMAXBEL FOO(IMAXBEL, "IMAXBEL"); # endif rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\n")); # undef FOO # define FOO(entry, name) \ rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "%-8s = %#04o\n", name, tio->c_cc [entry])) FOO(VINTR, "VINTR"); FOO(VQUIT, "VQUIT"); FOO(VERASE, "VERASE"); FOO(VKILL, "VKILL"); FOO(VEOF, "VEOF"); FOO(VEOL, "VEOL"); # ifdef VEOL2 FOO(VEOL2, "VEOL2"); # endif # ifdef VSWTC FOO(VSWTC, "VSWTC"); # endif # ifdef VSWTCH FOO(VSWTCH, "VSWTCH"); # endif FOO(VSTART, "VSTART"); FOO(VSTOP, "VSTOP"); FOO(VSUSP, "VSUSP"); # ifdef VDSUSP FOO(VDSUSP, "VDSUSP"); # endif # ifdef VREPRINT FOO(VREPRINT, "VREPRINT"); # endif # ifdef VDISCRD FOO(VDISCRD, "VDISCRD"); # endif # ifdef VWERSE FOO(VWERSE, "VWERSE"); # endif # ifdef VLNEXT FOO(VLNEXT, "VLNEXT"); # endif rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\n")); # undef FOO # endif /* HAVE_TERMIOS_H */ #endif /* DEBUG */ } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/init.h0000644000175000001440000000774210756127602011540 00000000000000/*--------------------------------*-H-*---------------------------------* * File: init.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __INIT_H__ #define __INIT_H__ /* ways to deal with getting/setting termios structure */ #ifdef HAVE_TERMIOS_H /* termios interface */ # ifdef TCSANOW /* POSIX */ # define GET_TERMIOS(fd,tios) tcgetattr (fd, tios) # define SET_TERMIOS(fd,tios) \ cfsetospeed (tios, BAUDRATE), \ cfsetispeed (tios, BAUDRATE), \ tcsetattr (fd, TCSANOW, tios) # else # ifdef TIOCSETA # define GET_TERMIOS(fd,tios) ioctl (fd, TIOCGETA, tios) # define SET_TERMIOS(fd,tios) \ tios->c_cflag |= BAUDRATE, \ ioctl (fd, TIOCSETA, tios) # else # define GET_TERMIOS(fd,tios) ioctl (fd, TCGETS, tios) # define SET_TERMIOS(fd,tios) \ tios->c_cflag |= BAUDRATE, \ ioctl (fd, TCSETS, tios) # endif # endif # define SET_TTYMODE(fd,tios) SET_TERMIOS (fd, tios) #else /* sgtty interface */ # define SET_TTYMODE(fd,tt) \ tt->sg.sg_ispeed = tt->sg.sg_ospeed = BAUDRATE, \ ioctl (fd, TIOCSETP, &(tt->sg)), \ ioctl (fd, TIOCSETC, &(tt->tc)), \ ioctl (fd, TIOCSLTC, &(tt->lc)), \ ioctl (fd, TIOCSETD, &(tt->line)), \ ioctl (fd, TIOCLSET, &(tt->local)) #endif /* HAVE_TERMIOS_H */ /* use the fastest baud-rate */ #ifdef B38400 # define BAUDRATE B38400 #else # ifdef B19200 # define BAUDRATE B19200 # else # define BAUDRATE B9600 # endif #endif /* Disable special character functions */ #ifdef _POSIX_VDISABLE # define VDISABLE _POSIX_VDISABLE #else # define VDISABLE 255 #endif /*----------------------------------------------------------------------* * system default characters if defined and reasonable */ #ifndef CINTR # define CINTR '\003' /* ^C */ #endif #ifndef CQUIT # define CQUIT '\034' /* ^\ */ #endif #ifndef CERASE # ifdef linux # define CERASE '\177' /* ^? */ # else # define CERASE '\010' /* ^H */ # endif #endif #ifndef CKILL # define CKILL '\025' /* ^U */ #endif #ifndef CEOF # define CEOF '\004' /* ^D */ #endif #ifndef CSTART # define CSTART '\021' /* ^Q */ #endif #ifndef CSTOP # define CSTOP '\023' /* ^S */ #endif #ifndef CSUSP # define CSUSP '\032' /* ^Z */ #endif #ifndef CDSUSP # define CDSUSP '\031' /* ^Y */ #endif #ifndef CRPRNT # define CRPRNT '\022' /* ^R */ #endif #ifndef CFLUSH # define CFLUSH '\017' /* ^O */ #endif #ifndef CWERASE # define CWERASE '\027' /* ^W */ #endif #ifndef CLNEXT # define CLNEXT '\026' /* ^V */ #endif #ifndef VDISCRD # ifdef VDISCARD # define VDISCRD VDISCARD # endif #endif #ifndef VWERSE # ifdef VWERASE # define VWERSE VWERASE # endif #endif #ifndef O_NOCTTY # define O_NOCTTY 0 #endif #ifndef O_NDELAY # define O_NDELAY O_NONBLOCK /* QNX, at least */ #endif #ifndef ONLCR # define ONLCR 0 /* QNX, at least */ #endif #define CONSOLE "/dev/console" /* console device */ #endif /* __INIT_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/scrollbar.c0000644000175000001440000003330410756127602012544 00000000000000/*--------------------------------*-C-*---------------------------------* * File: scrollbar.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1998 Alfredo K. Kojima * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef HAVE_SCROLLBARS /* ** Note: These beg/end values save the length of scrollbar ** EXCLUDING the top/bottom arrow button if there are!!! */ #define R_SCROLLBEG_PLAIN (0) #define R_SCROLLEND_PLAIN VT_HEIGHT(r) #define R_SCROLLBEG_XTERM (0) #define R_SCROLLEND_XTERM VT_HEIGHT(r) #define R_SCROLLBEG_NEXT (0) #define R_SCROLLEND_NEXT (VT_HEIGHT(r) - (NEXT_SB_TBTN_HEIGHT + \ NEXT_SB_PAD)) #define R_SCROLLBEG_RXVT (r->scrollBar.width + 1) + r->sb_shadow #define R_SCROLLEND_RXVT (VT_HEIGHT(r) - R_SCROLLBEG_RXVT - \ ((r->sb_shadow)<<1)) #define R_SCROLLBEG_SGI (SGI_SB_BUTTON_HEIGHT) #define R_SCROLLEND_SGI (VT_HEIGHT(r) - R_SCROLLBEG_SGI - \ ((r->sb_shadow)<<1)) /*----------------------------------------------------------------------*/ /* EXTPROTO */ void rxvt_scrollbar_init(rxvt_t* r) { char* scrollalign = (char*) r->h->rs[Rs_scrollBar_align]; char* scrollstyle = (char*) r->h->rs[Rs_scrollBar_style]; char* thickness = (char*) r->h->rs[Rs_scrollBar_thickness]; int i; short style = R_SB_UNKNOWN, width = 0; if (scrollstyle) { /* use specified style by default */ # ifdef PLAIN_SCROLLBAR if (0 == STRNCASECMP (scrollstyle, "plain", 5)) style = R_SB_PLAIN; # endif # ifdef XTERM_SCROLLBAR if (0 == STRNCASECMP (scrollstyle, "xterm", 5)) style = R_SB_XTERM; # endif # ifdef RXVT_SCROLLBAR if (0 == STRNCASECMP (scrollstyle, "rxvt", 4)) style = R_SB_RXVT; # endif # ifdef NEXT_SCROLLBAR if (0 == STRNCASECMP (scrollstyle, "next", 4)) style = R_SB_NEXT; # endif # ifdef SGI_SCROLLBAR if (0 == STRNCASECMP (scrollstyle, "sgi", 3)) style = R_SB_SGI; # endif } /* ** If something goes wrong with default style, or default style ** is not specified by the user, we decide it. */ if (R_SB_UNKNOWN == style || !scrollstyle) { # ifdef PLAIN_SCROLLBAR style = R_SB_PLAIN; /* may be overrided below */ # endif # ifdef XTERM_SCROLLBAR style = R_SB_XTERM; /* may be overrided below */ # endif # ifdef RXVT_SCROLLBAR style = R_SB_RXVT; /* may be overrided below */ # endif # ifdef NEXT_SCROLLBAR style = R_SB_NEXT; # endif # ifdef SGI_SCROLLBAR if (R_SB_UNKNOWN == style) style = R_SB_SGI; # endif assert (R_SB_UNKNOWN != style); /* impossible case */ } switch (style) { case R_SB_PLAIN: width = SB_WIDTH_PLAIN; break; case R_SB_XTERM: width = SB_WIDTH_XTERM; break; case R_SB_RXVT: width = SB_WIDTH_RXVT; break; case R_SB_NEXT: width = SB_WIDTH_NEXT; break; case R_SB_SGI: width = SB_WIDTH_SGI; break; default : assert (0); /* should not reach here */ } if (style != R_SB_NEXT) /* dishonour request - for now */ if (thickness && (i = atoi(thickness)) >= SB_WIDTH_MINIMUM) width = min(i, SB_WIDTH_MAXIMUM); # ifdef RXVT_SCROLLBAR if (NOTSET_OPTION(r, Opt_scrollBar_floating) && style == R_SB_RXVT) r->sb_shadow = SHADOW; # else r->sb_shadow = 0; # endif r->scrollBar.style = style; r->scrollBar.width = width; /* r->h->scrollbar_align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { if (STRNCASECMP(scrollalign, "top", 3) == 0) r->h->scrollbar_align = R_SB_ALIGN_TOP; else if (STRNCASECMP(scrollalign, "bottom", 6) == 0) r->h->scrollbar_align = R_SB_ALIGN_BOTTOM; } # if defined(PLAIN_SCROLLBAR) if (r->scrollBar.style == R_SB_PLAIN) r->scrollBar.update = rxvt_scrollbar_show_plain; # endif # if defined(XTERM_SCROLLBAR) if (r->scrollBar.style == R_SB_XTERM) r->scrollBar.update = rxvt_scrollbar_show_xterm; # endif # if defined(NEXT_SCROLLBAR) if (r->scrollBar.style == R_SB_NEXT) r->scrollBar.update = rxvt_scrollbar_show_next; # endif # if defined(RXVT_SCROLLBAR) if (r->scrollBar.style == R_SB_RXVT) r->scrollBar.update = rxvt_scrollbar_show_rxvt; # endif # if defined(SGI_SCROLLBAR) if (r->scrollBar.style == R_SB_SGI) r->scrollBar.update = rxvt_scrollbar_show_sgi; # endif UNSET_WIN(r->scrollBar.win); r->scrollBar.state = 0; } /* ** Hide the scrollbar */ /* EXTPROTO */ int rxvt_scrollbar_hide (rxvt_t* r) { int changed = 0; assert (IS_WIN(r->scrollBar.win)); changed = r->scrollBar.state; XUnmapWindow(r->Xdisplay, r->scrollBar.win); r->scrollBar.state = 0; /* scrollbar_setIdle(); */ return (changed); } /* ** Show the scrollbar */ /* EXTPROTO */ int rxvt_scrollbar_show (rxvt_t* r) { int changed = 0; assert (IS_WIN(r->scrollBar.win)); changed = !r->scrollBar.state; XMapWindow(r->Xdisplay, r->scrollBar.win); r->scrollBar.state = 1; return (changed); } /* EXTPROTO */ void rxvt_scrollbar_create (rxvt_t* r) { int sb_x, sb_y; unsigned int sb_w, sb_h; rxvt_dbgmsg ((DBG_VERBOSE, DBG_SCROLLBAR, "Create scrollbar\n")); assert (IS_WIN(r->TermWin.parent)); sb_x = ISSET_OPTION(r, Opt_scrollBar_right) ? VT_WIDTH(r) : 0; sb_y = r->h->window_vt_y; sb_w = rxvt_scrollbar_rwidth (r); /* real scrollbar width */ sb_h = VT_HEIGHT(r); /* same height as vt window */ /* set scrollbar parameters */ # ifdef PLAIN_SCROLLBAR if (r->scrollBar.style == R_SB_PLAIN) { r->scrollBar.beg = R_SCROLLBEG_PLAIN; r->scrollBar.end = R_SCROLLEND_PLAIN; } # endif # ifdef XTERM_SCROLLBAR if (r->scrollBar.style == R_SB_XTERM) { r->scrollBar.beg = R_SCROLLBEG_XTERM; r->scrollBar.end = R_SCROLLEND_XTERM; } # endif # ifdef NEXT_SCROLLBAR if (r->scrollBar.style == R_SB_NEXT) { r->scrollBar.beg = R_SCROLLBEG_NEXT; r->scrollBar.end = R_SCROLLEND_NEXT; } # endif # ifdef RXVT_SCROLLBAR if (r->scrollBar.style == R_SB_RXVT) { r->scrollBar.beg = R_SCROLLBEG_RXVT; r->scrollBar.end = R_SCROLLEND_RXVT; } # endif # ifdef SGI_SCROLLBAR if (r->scrollBar.style == R_SB_SGI) { r->scrollBar.beg = R_SCROLLBEG_SGI; r->scrollBar.end = R_SCROLLEND_SGI; } # endif r->scrollBar.win = XCreateSimpleWindow(r->Xdisplay, r->TermWin.parent, sb_x, sb_y, sb_w, sb_h, 0, r->pixColorsFocus[Color_fg], r->pixColorsFocus[Color_bg]); assert (IS_WIN(r->scrollBar.win)); # ifdef DEBUG rxvt_set_win_title (r, r->scrollBar.win, "scrollbar"); # endif XDefineCursor(r->Xdisplay, r->scrollBar.win, r->h->bar_pointer); XSelectInput(r->Xdisplay, r->scrollBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask)); # ifdef BACKGROUND_IMAGE UNSET_PIXMAP(r->scrollBar.pixmap); /* initialize it to None */ # ifdef TRANSPARENT if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) # endif if (r->h->rs[Rs_scrollbarPixmap]) { long w = 0, h = 0; r->scrollBar.pixmap = rxvt_load_pixmap (r, r->h->rs[Rs_scrollbarPixmap], &w, &h); if (IS_PIXMAP(r->scrollBar.pixmap)) XSetWindowBackgroundPixmap (r->Xdisplay, r->scrollBar.win, r->scrollBar.pixmap); } # endif # ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) { XSetWindowBackgroundPixmap (r->Xdisplay, r->scrollBar.win, ParentRelative); } # endif r->scrollBar.state = 0; /* Final initialization of the scrollbars */ # ifdef PLAIN_SCROLLBAR if (r->scrollBar.style == R_SB_PLAIN) rxvt_scrollbar_init_plain (r); # endif # ifdef XTERM_SCROLLBAR if (r->scrollBar.style == R_SB_XTERM) rxvt_scrollbar_init_xterm (r); # endif # ifdef RXVT_SCROLLBAR if (r->scrollBar.style == R_SB_RXVT) rxvt_scrollbar_init_rxvt (r); # endif # ifdef NEXT_SCROLLBAR if (r->scrollBar.style == R_SB_NEXT) rxvt_scrollbar_init_next (r); # endif # ifdef SGI_SCROLLBAR if (r->scrollBar.style == R_SB_SGI) rxvt_scrollbar_init_sgi (r); # endif } /* EXTPROTO */ void rxvt_scrollbar_clean_exit (rxvt_t* r) { UNSET_WIN(r->scrollBar.win); /* Destroyed by XDestroySubwindows */ if (IS_GC(r->scrollBar.gc)) { XFreeGC (r->Xdisplay, r->scrollBar.gc); UNSET_GC(r->scrollBar.gc); } #ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->scrollBar.pixmap)) { XFreePixmap (r->Xdisplay, r->scrollBar.pixmap); UNSET_PIXMAP(r->scrollBar.pixmap); } #endif # ifdef PLAIN_SCROLLBAR if (r->scrollBar.style == R_SB_PLAIN) rxvt_scrollbar_exit_plain (r); # endif # ifdef XTERM_SCROLLBAR if (r->scrollBar.style == R_SB_XTERM) rxvt_scrollbar_exit_xterm (r); # endif # ifdef RXVT_SCROLLBAR if (r->scrollBar.style == R_SB_RXVT) rxvt_scrollbar_exit_rxvt (r); # endif # ifdef NEXT_SCROLLBAR if (r->scrollBar.style == R_SB_NEXT) rxvt_scrollbar_exit_next (r); # endif # ifdef SGI_SCROLLBAR if (r->scrollBar.style == R_SB_SGI) rxvt_scrollbar_exit_sgi (r); # endif } /* EXTPROTO */ void rxvt_scrollbar_resize(rxvt_t *r) { int sb_x, sb_y; unsigned int sb_w, sb_h; sb_x = ISSET_OPTION(r, Opt_scrollBar_right) ? VT_WIDTH(r) : 0; sb_y = r->h->window_vt_y; sb_w = rxvt_scrollbar_rwidth (r); /* real scrollbar width */ sb_h = VT_HEIGHT(r); /* same height as vt window */ XMoveResizeWindow (r->Xdisplay, r->scrollBar.win, sb_x, sb_y, sb_w, sb_h); # ifdef PLAIN_SCROLLBAR if (r->scrollBar.style == R_SB_PLAIN) { r->scrollBar.beg = R_SCROLLBEG_PLAIN; r->scrollBar.end = R_SCROLLEND_PLAIN; } # endif # ifdef XTERM_SCROLLBAR if (r->scrollBar.style == R_SB_XTERM) { r->scrollBar.beg = R_SCROLLBEG_XTERM; r->scrollBar.end = R_SCROLLEND_XTERM; } # endif # ifdef NEXT_SCROLLBAR if (r->scrollBar.style == R_SB_NEXT) { r->scrollBar.beg = R_SCROLLBEG_NEXT; r->scrollBar.end = R_SCROLLEND_NEXT; } # endif # ifdef RXVT_SCROLLBAR if (r->scrollBar.style == R_SB_RXVT) { r->scrollBar.beg = R_SCROLLBEG_RXVT; r->scrollBar.end = R_SCROLLEND_RXVT; } # endif # ifdef SGI_SCROLLBAR if (r->scrollBar.style == R_SB_SGI) { r->scrollBar.beg = R_SCROLLBEG_SGI; r->scrollBar.end = R_SCROLLEND_SGI; } # endif rxvt_scrollbar_update(r, 0); } /* EXTPROTO */ int rxvt_scrollbar_visible(rxvt_t *r) { return (IS_WIN(r->scrollBar.win) && r->scrollBar.state); } /* * Update current scrollbar view w.r.t. slider heights, etc. */ /* EXTPROTO */ int rxvt_scrollbar_update (rxvt_t* r, int update) { int ret = 0; int top, bot, len, adj; if (!rxvt_scrollbar_visible(r)) return 0; if (update) { /* first line in the view */ top = (AVTS(r)->nscrolled - AVTS(r)->view_start); /* last line in the view */ bot = top + (r->TermWin.nrow - 1); /* total lines in scroll and view */ len = max((AVTS(r)->nscrolled + (r->TermWin.nrow - 1)), 1); adj = (((bot - top) * scrollbar_size()) % len) > 0 ? 1 : 0; /* ** scrollBar.beg : beginning of scrollbar, always 0 ** scrollBar.end : end of scrollbar excluding buttons ** scrollbar_size : scrollbar length excluding minimal height ** ** scrollBar.top : beginning of scroller ** scrollBar.bot : end of scroller ** scroller_len : length of scroller */ r->scrollBar.top = (r->scrollBar.beg + (top * scrollbar_size()) / len); r->h->scroller_len = ((bot - top) * scrollbar_size()) / len + scrollbar_minheight() + adj; r->scrollBar.bot = (r->scrollBar.top + r->h->scroller_len); /* no change */ if (r->scrollBar.top == r->h->last_top && r->scrollBar.bot == r->h->last_bot && (r->scrollBar.state == r->h->last_state || !scrollbar_isUpDn())) return 0; } ret = r->scrollBar.update(r, update, r->h->last_top, r->h->last_bot, r->h->scroller_len); r->h->last_top = r->scrollBar.top; r->h->last_bot = r->scrollBar.bot; r->h->last_state = r->scrollBar.state; return ret; } /* EXTPROTO */ unsigned short rxvt_scrollbar_width(rxvt_t *r) { if (NOT_WIN(r->scrollBar.win) || !r->scrollBar.state) return 0; return (r->scrollBar.width + r->sb_shadow * 2); } /* EXTPROTO */ unsigned short rxvt_scrollbar_rwidth(rxvt_t *r) { return (r->scrollBar.width + r->sb_shadow * 2); } /* EXTPROTO */ int rxvt_is_scrollbar_win(rxvt_t *r, Window w) { return (w == r->scrollBar.win); } /* * Return the scrollbar background color. */ /* EXTPROTO */ unsigned long rxvt_scrollbar_bg( rxvt_t *r ) { switch (r->scrollBar.style) { # ifdef PLAIN_SCROLLBAR case R_SB_PLAIN: return r->scrollBar.plain_bg; # endif # ifdef XTERM_SCROLLBAR case R_SB_XTERM: return r->scrollBar.xterm_bg; # endif # ifdef RXVT_SCROLLBAR case R_SB_RXVT: return r->scrollBar.rxvt_bg; # endif # ifdef NEXT_SCROLLBAR case R_SB_NEXT: return r->scrollBar.next_bg; # endif # ifdef SGI_SCROLLBAR case R_SB_SGI: return r->scrollBar.sgi_bg; # endif default: assert (0); return VTBG( r, 0); } /* switch */ } #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/main.c0000644000175000001440000023713211014346032011476 00000000000000/*--------------------------------*-C-*---------------------------------* * File: main.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey * Copyright (c) 1994 Robert Nation * Copyright (c) 1995 Garrett D'Amore * Copyright (c) 1997 mj olesen * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 1998-2001 Geoff Wing * Copyright (c) 2000 Xianping Ge * Copyright (c) 2003-2004 Marc Lehmann * Copyright (c) 2005 Burgers A.R. * Copyright (c) 2004-2006 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef XFT_SUPPORT # include "xftacs.h" #endif /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ void rxvt_alarm_signal ( __attribute__((unused)) int sig ); void rxvt_pre_show_init (rxvt_t* r); void rxvt_clean_commands (rxvt_t* r, int command_number); void rxvt_free_hidden (rxvt_t*); void rxvt_font_up_down (rxvt_t*, int, int); int rxvt_get_font_widest (XFontStruct*); void rxvt_set_colorfgbg (rxvt_t*); void rxvt_resize_sub_windows (rxvt_t*); #ifdef USE_XIM void rxvt_IM_set_size (rxvt_t*, XRectangle*); void rxvt_IM_set_position (rxvt_t*, XPoint*); void rxvt_IM_set_color (rxvt_t*, unsigned long*, unsigned long*); Bool rxvt_IM_is_running (rxvt_t*); void rxvt_IM_change_fontset (rxvt_t*, int); void rxvt_IM_set_preedit_area (rxvt_t*, XRectangle*, XRectangle*, XRectangle*); void rxvt_IM_destroy_callback (XIM, XPointer, XPointer); Bool rxvt_IM_get_IC (rxvt_t*); void rxvt_IM_send_size (rxvt_t*); void rxvt_IM_set_status_pos (rxvt_t*); #endif void rxvt_set_r (rxvt_t*); #ifdef XFT_SUPPORT void xftFreeUnusedFont (rxvt_t*, XftFont*); void setXftWeight (XftPattern *, const char *, int); void rxvt_init_font_fixed (rxvt_t*); # ifndef NO_BOLDFONT void rxvt_init_bfont_xft (rxvt_t*, XftPattern*); # endif # ifdef MULTICHAR_SET int rxvt_init_mfont_xft (rxvt_t*, XftPattern*, const char*); int isDoubleWidthFont (Display *dpy, XftFont *font); # endif #endif /* XFT_SUPPORT */ /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ const char** cmd_argv; /*----------------------------------------------------------------------*/ /* * Initialization done after reading command line options, and before calling * rxvt_create_show_windows(). */ /* INTPROTO */ void rxvt_pre_show_init( rxvt_t *r ) { /* * 2006-08-18 gi1242 TODO: If we're using Xft, then we don't need to * initialize this array. */ r->pixColorsFocus = rxvt_malloc( sizeof(unsigned long) * (TOTAL_COLORS)); r->pixColors = r->pixColorsFocus; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) { r->xftColorsFocus = rxvt_malloc( sizeof(XftColor) * (TOTAL_COLORS) ); r->xftColors = r->xftColorsFocus; } else { SET_NULL( r->xftColors ); SET_NULL( r->xftColorsFocus ); } #endif if( r->TermWin.fade ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "Allocating space for fade colors\n")); r->pixColorsUnfocus = rxvt_malloc( sizeof(unsigned long) * (TOTAL_COLORS) ); # ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) r->xftColorsUnfocus = rxvt_malloc( sizeof(XftColor) * TOTAL_COLORS ); else SET_NULL( r->xftColorsUnfocus ); # endif /* XFT_SUPPORT */ } else { SET_NULL( r->pixColorsUnfocus ); # ifdef XFT_SUPPORT SET_NULL( r->xftColorsUnfocus ); # endif } } /* rxvt_init() */ /* LIBPROTO */ rxvt_t * rxvt_init(int argc, const char *const *argv) { register int i; register int itnum; /* initial terminal number */ rxvt_t* r; /* Allocate memory for "r" and initialize contents to 0 */ r = (rxvt_t *) rxvt_calloc(1, sizeof(rxvt_t)); /* Save "r" in _rxvt_vars. This is the only assignment to _rxvt_vars */ rxvt_set_r(r); /* Initialize vars in "r" */ if (rxvt_init_vars(r) < 0) { rxvt_msg (DBG_ERROR, DBG_MAIN, "Could not initialize." ); rxvt_free(r); return NULL; } /* save global argc and argv */ r->global_argc = argc; r->global_argv = (char**) argv; rxvt_init_secondary(r); cmd_argv = rxvt_init_resources(r, argc, argv); rxvt_pre_show_init( r ); rxvt_create_show_windows(r, argc, argv); #ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent)) { XSelectInput(r->Xdisplay, XROOT, PropertyChangeMask); /* * Our "parents" will automatically be checked on the first expose and * ConfigureNotify event respectively. Forcefully calling it is just a * waste of time. */ # if 0 rxvt_check_our_parents(r); # endif } #endif rxvt_init_env(r); rxvt_init_command(r); rxvt_init_screen (r); /* * Initialize the pages */ if( r->h->rs[Rs_initProfiles] ) { /* Split into a comma separated string */ char *s = (char *) r->h->rs[Rs_initProfiles]; do { int profile = atoi( s ); rxvt_append_page( r, profile, NULL, NULL ); s = STRCHR( s, ',' ); } while (NULL != s++); } /* Backward compatibility: Open profiles 0 .. n-1 if tnum=n. */ else if( r->h->rs[Rs_init_term_num] ) { rxvt_msg (DBG_ERROR, DBG_MAIN, "Option tnum is obsolete." " Use --initProfileList instead" ); itnum = atoi( r->h->rs[Rs_init_term_num] ); itnum = max( 1, itnum ); itnum = min( itnum, MAX_PAGES ); for (i = 0; i < itnum; i ++) rxvt_append_page( r, (i < MAX_PROFILES) ? i : 0 , NULL, NULL ); } /* Just open the default tab */ else rxvt_append_page( r, 0, NULL, NULL ); /* Activate the tab */ rxvt_activate_page (r, 0); /* Initialize xlocale after VT is created */ rxvt_init_xlocale(r); return r; } /* ------------------------------------------------------------------------- * * SIGNAL HANDLING & EXIT HANDLER * * ------------------------------------------------------------------------- */ /* * Catch a SIGCHLD signal and exit if the direct child has died */ /* ARGSUSED */ /* EXTPROTO */ RETSIGTYPE rxvt_Child_signal(int sig __attribute__((unused))) { /* * Sometimes the child process could exit before we have a chance to * initialize the term structure. So we just count the number of calls to * this function here. We will wait for our dead children later. */ rxvt_t *r; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "\e[31mrxvt_Child_signal()\e[0m\n")); r = rxvt_get_r(); r->ndead_childs++; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "done rxvt_Child_signal()\n")); } /* * Catch a fatal signal and tidy up before quitting */ /* EXTPROTO */ RETSIGTYPE rxvt_Exit_signal(int sig) { #ifdef UTMP_SUPPORT register int i; #endif rxvt_t* r; rxvt_msg (DBG_INFO, DBG_MAIN, "Received signal %d\n", (int) sig); r = rxvt_get_r(); #ifdef UTMP_SUPPORT for (i = 0; i <= LTAB(r); i ++) { rxvt_privileges( RESTORE ); rxvt_cleanutent( r, i ); rxvt_privileges( IGNORE ); } #endif /* resend signal to default handler */ /* kill (getpid (), sig); */ rxvt_close_all_tabs( r ); } void rxvt_alarm_signal( __attribute__((unused)) int sig ) { int i; rxvt_t *r = rxvt_get_r(); if( LTAB(r) >= 0 ) { rxvt_msg (DBG_WARN, DBG_MAIN, APL_NAME ": WARNING Processes "); for( i=0; i <= LTAB(r); i ++ ) rxvt_msg (DBG_WARN, DBG_MAIN, "%d%c", PVTS(r, i)->cmd_pid, i == LTAB(r) ? ' ' : ',' ); rxvt_msg (DBG_WARN, DBG_MAIN, " have not responded to SIGHUP, and are still " "running. Either 'kill -9' these processes or close the " APL_NAME " window again within 3 seconds.\n"); } } /* INTPROTO */ void rxvt_free_hidden( rxvt_t* r ) { #ifdef DEBUG if (IS_CURSOR(r->h->bar_pointer)) { XFreeCursor( r->Xdisplay, r->h->bar_pointer ); UNSET_CURSOR(r->h->bar_pointer); } # ifdef POINTER_BLANK if (IS_CURSOR(r->h->blank_pointer)) { XFreeCursor( r->Xdisplay, r->h->blank_pointer ); UNSET_CURSOR(r->h->blank_pointer); } # endif #endif /* DEBUG */ #ifdef USE_XIM if( r->h->Input_Context ) { XDestroyIC( r->h->Input_Context ); SET_NULL(r->h->Input_Context); } #endif } /* * If we're protecting the secondary screen, or have multiple tabs with a hidden * tabbar, then avoid exiting. */ /* EXTPROTO */ void rxvt_exit_request( rxvt_t *r ) { /* Avoid exiting if there are multiple tabs with hidden tabbar */ if( LTAB(r) > 0 && !rxvt_tabbar_visible( r ) ) { XBell( r->Xdisplay, 0 ); if( rxvt_tabbar_show(r) ) rxvt_resize_on_subwin (r, SHOW_TABBAR); return; } /* Avoid exiting if some tab is in the secondary screen */ if(ISSET_OPTION(r, Opt2_protectSecondary)) { int i, dontExit = 0; for( i=0; i <= LTAB(r); i++) { if( PVTS(r, i)->current_screen == SECONDARY ) { dontExit = 1; if( i != ATAB(r) ) rxvt_tabbar_highlight_tab( r, i, False); } } if( dontExit ) { XBell( r->Xdisplay, 0); return; } } rxvt_close_all_tabs(r); } /* * Remove all held tabs, and send SIGHUP to processes in all live tabs * * 2006-09-22 gi1242: In mrxvt-0.5.1 and before, we would exit mrxvt by calling * rxvt_clean_exit(). This would send SIGHUP to all child processes, and then * call exit(). This however is flawed! If some processes do not exit on SIGHUP, * then they will remain in the background and the user will not know. * * To fix this issue, we call rxvt_close_all_tabs() instead of rxvt_clean_exit() * when we want to exit mrxvt. rxvt_close_all_tabs() will send SIGHUP's to all * child processes, and remove all held tabs. If mrxvt does not exit within two * seconds, then it will sound an alarm warning the user of the offending * processes which ignored SIGHUP. The user can either kill -9 those processes * manually, or request another exit of mrxvt within the next 3 seconds to have * mrxvt forcefully exit (but leaving the child processes running). */ /* EXTPROTO */ void rxvt_close_all_tabs( rxvt_t *r) { static struct timeval lastRequest = {0, 0}; struct timeval now; int i; for( i=LTAB(r); i >=0; i-- ) { if( PVTS(r, i)->dead ) rxvt_remove_page( r, i ); else { PVTS(r, i)->holdOption = 0; kill( PVTS(r, i)->cmd_pid, SIGHUP ); } } gettimeofday( &now, NULL ); if( lastRequest.tv_sec != 0 && now.tv_sec - lastRequest.tv_sec < 5 ) /* Second request within 5 seconds. Kill mrxvt */ rxvt_clean_exit(r); else { lastRequest = now; /* Just in case the processes don't exit on SIGHUP, warn the user */ signal( SIGALRM, rxvt_alarm_signal ); alarm( 2 ); } } /* EXTPROTO */ void rxvt_clean_exit (rxvt_t* r) { #ifdef HAVE_X11_SM_SMLIB_H if (ISSET_OPTION(r, Opt2_enableSessionMgt)) rxvt_session_exit (r); #endif #if 0 /* * Now kill all child processes, zsh puts them into background if we do not * do so. * * 2006-09-22 gi1242: No! See comments before rxvt_close_all_tabs(). */ for (i = 0; i <= LTAB(r); i ++) kill (PVTS(r, i)->cmd_pid, SIGHUP); #endif /* * 2006-01-27 gi1242: Free all used resources. This used to be done only in * debug mode, but I think it's good practice to do it always. It can't hurt * anything. */ /* #ifdef DEBUG */ rxvt_free_hidden (r); /* Destroy windows before other X resources */ if (IS_WIN(r->TermWin.parent)) { XDestroySubwindows (r->Xdisplay, r->TermWin.parent); XDestroyWindow (r->Xdisplay, r->TermWin.parent); UNSET_WIN(r->TermWin.parent); } # ifdef HAVE_SCROLLBARS rxvt_scrollbar_clean_exit (r); # endif # ifdef HAVE_MENUBAR rxvt_menubar_clean_exit (r); # endif rxvt_tabbar_clean_exit (r); if (NOT_NULL(r->TermWin.font)) XFreeFont (r->Xdisplay, r->TermWin.font); # ifndef NO_BOLDFONT if (NOT_NULL(r->TermWin.bfont) && r->TermWin.font != r->TermWin.bfont) { XFreeFont (r->Xdisplay, r->TermWin.bfont); SET_NULL(r->TermWin.bfont); } # endif # ifdef MULTICHAR_SET if (NOT_NULL(r->TermWin.mfont) && r->TermWin.font != r->TermWin.mfont) { XFreeFont (r->Xdisplay, r->TermWin.mfont); SET_NULL(r->TermWin.mfont); } # endif SET_NULL(r->TermWin.font); /* clear font */ # ifdef XFT_SUPPORT if (NOT_NULL(r->TermWin.xftfont)) { XftFont *fn; XftFontClose (r->Xdisplay, r->TermWin.xftfont); xftCloseACS (r->Xdisplay); if( (fn = r->TermWin.xftpfont) ) { SET_NULL(r->TermWin.xftpfont); xftFreeUnusedFont( r, fn); } if( (fn = r->TermWin.xftPfont) ) { SET_NULL(r->TermWin.xftPfont); xftFreeUnusedFont( r, fn); } # ifndef NO_BOLDFONT fn = r->TermWin.xftbfont; SET_NULL(r->TermWin.xftbfont); xftFreeUnusedFont( r, fn); # endif # ifdef MULTICHAR_SET fn = r->TermWin.xftmfont; SET_NULL(r->TermWin.xftmfont); xftFreeUnusedFont( r, fn); # endif } SET_NULL(r->TermWin.xftfont); /* clear font */ /* * XXX gi1242 2006-01-27: Xft bug. Patterns passed to XftFontOpenPattern * can't always be safely freed. */ # if 0 if( r->TermWin.xftpattern ) XftPatternDestroy( r->TermWin.xftpattern); # ifdef MULTICHAR_SET if( r->TermWin.xftmpattern ) XftPatternDestroy( r->TermWin.xftmpattern ); # endif # endif # endif if (IS_CURSOR(r->term_pointer)) { XFreeCursor (r->Xdisplay, r->term_pointer); UNSET_CURSOR(r->term_pointer); } if (IS_GC(r->TermWin.gc)) { XFreeGC (r->Xdisplay, r->TermWin.gc); UNSET_GC(r->TermWin.gc); } XCloseDisplay (r->Xdisplay); SET_NULL(r->Xdisplay); #ifdef USE_FIFO if( r->fifo_fd != -1 ) { close( r->fifo_fd ); r->fifo_fd = -1; unlink( r->fifo_name ); rxvt_free( r->fifo_name ); SET_NULL( r->fifo_name ); } #endif/*USE_FIFO*/ rxvt_free (r->tabstop); SET_NULL(r->tabstop); rxvt_free (r->pixColorsFocus); SET_NULL(r->pixColorsFocus); if( NOT_NULL( r->pixColorsUnfocus ) ) { rxvt_free (r->pixColorsUnfocus); SET_NULL(r->pixColorsUnfocus); } # ifdef XFT_SUPPORT if( NOT_NULL( r->xftColorsUnfocus ) ) { rxvt_free( r->xftColorsUnfocus ); SET_NULL( r->xftColorsUnfocus ); } # endif /* XFT_SUPPORT */ # ifdef XFT_SUPPORT if( NOT_NULL( r->xftColors ) ) { rxvt_free (r->xftColors); SET_NULL(r->xftColors); } # endif rxvt_free (r->h); SET_NULL(r->h); rxvt_free (r); SET_NULL(r); /* #endif */ /* DEBUG */ exit(EXIT_SUCCESS); } /* ------------------------------------------------------------------------- * * PRIVILEGED OPERATIONS * * ------------------------------------------------------------------------- */ #if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(OS_CYGWIN) static uid_t g_euid; static gid_t g_egid; #endif /* take care of suid/sgid super-user (root) privileges */ /* EXTPROTO */ void rxvt_privileges(int mode) { #if !defined(OS_CYGWIN) # if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) /* setreuid() is the poor man's setuid(), seteuid() */ # define seteuid(a) setreuid(-1, (a)) # define setegid(a) setregid(-1, (a)) # define HAVE_SETEUID # endif # ifdef HAVE_SETEUID switch (mode) { case IGNORE: /* * change effective uid/gid - not real uid/gid - so we can switch * back to root later, as required */ seteuid(getuid()); setegid(getgid()); break; case SAVE: g_euid = geteuid(); g_egid = getegid(); break; case RESTORE: seteuid(g_euid); setegid(g_egid); break; } # else switch (mode) { case IGNORE: if (setuid(getuid()) < 0) exit (EXIT_FAILURE); if (setgid(getgid()) < 0) exit (EXIT_FAILURE); /* FALLTHROUGH */ case SAVE: /* FALLTHROUGH */ case RESTORE: break; } # endif #endif } #ifdef UTMP_SUPPORT /* EXTPROTO */ void rxvt_privileged_utmp(rxvt_t* r, int page, char action) { rxvt_msg (DBG_INFO, DBG_MAIN, "rxvt_privileged_utmp %d (%c); waiting for: %c (pid: %d)\n", page, action, PVTS(r, page)->next_utmp_action, (int) getpid()); if (PVTS(r, page)->next_utmp_action != action || (action != SAVE && action != RESTORE) || ISSET_OPTION(r, Opt_utmpInhibit) || IS_NULL(PVTS(r, page)->ttydev) || (char) 0 == *(PVTS(r, page)->ttydev)) return; rxvt_privileges(RESTORE); if (action == SAVE) { PVTS(r, page)->next_utmp_action = RESTORE; rxvt_makeutent(r, page, PVTS(r, page)->ttydev, r->h->rs[Rs_display_name]); } else /* action == RESTORE */ { PVTS(r, page)->next_utmp_action = IGNORE; rxvt_cleanutent(r, page); } rxvt_privileges(IGNORE); } #endif #ifndef NO_SETOWNER_TTYDEV /* EXTPROTO */ void rxvt_privileged_ttydev(rxvt_t* r, int page, char action) { rxvt_msg (DBG_INFO, DBG_MAIN, "rxvt_privileged_ttydev %d (r, %c); waiting for: %c (pid: %d)\n", page, action, PVTS(r, page)->next_tty_action, getpid()); if (PVTS(r, page)->next_tty_action != action || (action != SAVE && action != RESTORE) || IS_NULL(PVTS(r, page)->ttydev) || (char) 0 == *(PVTS(r, page)->ttydev)) return; rxvt_privileges(RESTORE); if (action == SAVE) { PVTS(r, page)->next_tty_action = RESTORE; # ifndef RESET_TTY_TO_COMMON_DEFAULTS /* * store original tty status for restoration rxvt_clean_exit() -- rgg * 04/12/95 */ if (lstat(PVTS(r, page)->ttydev, &h->ttyfd_stat) < 0) /* you lose out */ PVTS(r, page)->next_tty_action = IGNORE; else # endif { /* fail silently */ chown(PVTS(r, page)->ttydev, getuid(), r->h->ttygid); chmod(PVTS(r, page)->ttydev, PVTS(r, page)->ttymode); # ifdef HAVE_REVOKE revoke(PVTS(r, page)->ttydev); # endif } } else /* action == RESTORE */ { PVTS(r, page)->next_tty_action = IGNORE; # ifndef RESET_TTY_TO_COMMON_DEFAULTS chmod(PVTS(r, page)->ttydev, PVTS(r, page)->ttyfd_stat.st_mode); chown(PVTS(r, page)->ttydev, PVTS(r, page)->ttyfd_stat.st_uid, PVTS(r, page)->ttyfd_stat.st_gid); # else chmod(PVTS(r, page)->ttydev, (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)); chown(PVTS(r, page)->ttydev, 0, 0); # endif } rxvt_privileges(IGNORE); # ifndef RESET_TTY_TO_COMMON_DEFAULTS rxvt_msg (DBG_INFO, DBG_MAIN, "%s \"%s\": mode %03o, uid %d, gid %d\n", action == RESTORE ? "Restoring" : (action == SAVE ? "Saving" : "UNKNOWN ERROR for"), PVTS(r, page)->ttydev, PVTS(r, page)->ttyfd_stat.st_mode, PVTS(r, page)->ttyfd_stat.st_uid, PVTS(r, page)->ttyfd_stat.st_gid); # endif } #endif /*----------------------------------------------------------------------*/ /* * Tell the teletype handler what size the window is. * Called after a window size change. */ /* EXTPROTO */ void rxvt_tt_winsize(int fd, unsigned short col, unsigned short row, pid_t pid) { struct winsize ws; #ifdef DEBUG if( pid && fd > STDERR_FILENO ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "%s( fd=%d, col=%hu, row=%hu, pid=%d )\n", __func__, fd, col, row, pid)); } #endif if (fd < 0) return; ws.ws_col = col; ws.ws_row = row; ws.ws_xpixel = ws.ws_ypixel = 0; if (ioctl(fd, TIOCSWINSZ, &ws) < 0) { #ifdef DEBUG if( pid && fd > STDERR_FILENO ) { rxvt_msg (DBG_WARN, DBG_MAIN, "Failed to send TIOCSWINSZ to fd %d\n", fd); } #endif } #ifdef SIGWINCH else if( pid ) /* force through to the command */ kill(pid, SIGWINCH); #endif } #define IDX2FNUM(i) ((FONT0_IDX + i) % MAX_NFONTS) #define FNUM2IDX(f) ((FONT0_IDX + f) % MAX_NFONTS) #ifdef XFT_SUPPORT # ifndef NO_BOLDFONT /* INTPROTO */ void rxvt_init_bfont_xft (rxvt_t* r, XftPattern* xpold) { XftResult fr; XftPattern* xp, *xftbpattern; # ifdef DEBUG FT_Face face; # endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_init_bfont_xft()")); xp = XftPatternDuplicate (xpold); if (IS_NULL(xp)) return ; /* set font weight */ XftPatternDel (xp, XFT_WEIGHT); setXftWeight( xp, r->h->rs[Rs_xftBwt], XFT_WEIGHT_BOLD ); xftbpattern = XftFontMatch (r->Xdisplay, XSCREEN, xp, &fr); if (NOT_NULL(xftbpattern)) { r->TermWin.xftbfont = XftFontOpenPattern (r->Xdisplay, xftbpattern); if (IS_NULL(r->TermWin.xftbfont)) { /* fall back to normal font */ XftPatternDestroy (xftbpattern); SET_NULL(xftbpattern); } else { rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "Opened bold font: h=%d(%d), w=%d(%d)", r->TermWin.xftbfont->height, r->TermWin.xftfont->height, r->TermWin.xftbfont->max_advance_width, r->TermWin.xftfont->max_advance_width)); #ifdef DEBUG FcPatternPrint( xftbpattern ); #endif /* * If the bold font is of different dimensions from the regular * font, we should draw it like a proportionally spaced font. */ if (r->TermWin.xftbfont->max_advance_width < r->TermWin.fwidth) r->TermWin.propfont |= PROPFONT_BOLD; else { if (r->TermWin.xftbfont->max_advance_width > r->TermWin.fwidth) { rxvt_msg (DBG_ERROR, DBG_MAIN, "Bold font too wide. Using overstrike" ); XftFontClose( r->Xdisplay, r->TermWin.xftbfont ); SET_NULL( r->TermWin.xftbfont ); } /* * Now we're either overstriking, or using a correctly sized * bold font, so clear PROPFONT_BOLD. */ r->TermWin.propfont &= ~PROPFONT_BOLD; } } # ifdef DEBUG { if (!IS_NULL(r->TermWin.xftbfont)) { face = XftLockFace (r->TermWin.xftbfont); XftUnlockFace (r->TermWin.xftbfont); } } # endif } XftPatternDestroy (xp); } # endif /* NO_BOLDFONT */ # ifdef MULTICHAR_SET /* INTPROTO */ int rxvt_init_mfont_xft (rxvt_t* r, XftPattern* xp, const char* ofname) { XftResult fr; int len, olen; /* font name length */ char* mfname; /* mfont name to open */ FcChar8* omfname = NULL; /* actually opened mfont name */ int width, height; # ifdef DEBUG FT_Face face; # endif /* temporary XftPattern */ assert (NOT_NULL(xp)); /* actually opened normal font name */ assert (NOT_NULL(ofname)); /* ** Now try to open freetype mfont */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "load freetype mfont\n")); /* font family */ mfname = (char*) r->h->rs[Rs_xftmfont]; if (IS_NULL(mfname)) mfname = rxvt_fallback_mfont_xft (r); /* * If we should not use mfont, then we always use normal font */ if (ISSET_OPTION(r, Opt2_xftNomFont)) { r->TermWin.xftmpattern = r->TermWin.xftpattern; r->TermWin.xftmfont = r->TermWin.xftfont; return 1; } /* * shortcut: * mfont is the same as font, just alias mfont to font */ if (0 == STRCASECMP (ofname, mfname)) { r->TermWin.xftmpattern = r->TermWin.xftpattern; r->TermWin.xftmfont = r->TermWin.xftfont; return 1; } /* font family */ XftPatternDel (xp, XFT_FAMILY); XftPatternAddString (xp, XFT_FAMILY, mfname); XftPatternDel (xp, XFT_SIZE); /* * 2006-02-11 gi1242: This is however HORRIBLE for regular fonts. It's * probably better to fall back to xftsz. Thus the random user who knows * nothing about mrxvt (or encodings) will get a reasonable looking terminal * by default. */ #if 0 /* this seems to be optimal for simsun font */ XftPatternAddDouble (xp, XFT_SIZE, r->h->rs[Rs_xftmsz] ? (double) r->TermWin.xftmsize : (double) (r->TermWin.xftfont->height - 1)); #endif XftPatternAddDouble( xp, XFT_SIZE, (r->h->rs[Rs_xftmsz] ? (double) r->TermWin.xftmsize : (double) r->TermWin.xftsize)); /* * XXX 2006-01-26 gi1242: I don't know anything about mfont. Not sure if it * should be monospaced or not. Original mrxvt code did not have mono space * for any font, so I remove it here for the mfont. */ #if 0 XftPatternDel (xp, XFT_SPACING); #endif /* font pattern */ r->TermWin.xftmpattern = XftFontMatch (r->Xdisplay, XSCREEN, xp, &fr); if (IS_NULL(r->TermWin.xftmpattern)) return 0; /* globaladvance */ if (ISSET_OPTION(r, Opt2_xftGlobalAdvance)) { XftPatternDel (r->TermWin.xftmpattern, FC_GLOBAL_ADVANCE); XftPatternAddBool (r->TermWin.xftmpattern, FC_GLOBAL_ADVANCE, FcTrue); } # ifdef DEBUG FcPatternPrint (r->TermWin.xftmpattern); # endif /* * Print a warning if our matched mfont is different from the user supplied * font. */ XftPatternGetString( r->TermWin.xftmpattern, XFT_FAMILY, 0, &omfname ); assert (NOT_NULL(omfname)); /* shouldn't be NULL */ len = STRLEN(mfname); olen = STRLEN(omfname); if( STRCMP( mfname, DEFAULT_XFT_FONT_NAME) /* Not the default font */ /* Not opened font */ && (len != olen || STRNCASECMP((char*) omfname, mfname, len)) ) rxvt_msg( DBG_ERROR, DBG_MAIN, "Cannot open mfont '%s'. Using mfont '%s' instead.\n", mfname, omfname); rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "create xftmpattern = 0x%x on mfont %d\n", (unsigned int) r->TermWin.xftmpattern, r->h->rs[Rs_xftmsz] ? r->TermWin.xftmsize : r->TermWin.xftfont->height-1)); /* * Actually open the mfont. */ r->TermWin.xftmfont = XftFontOpenPattern(r->Xdisplay, r->TermWin.xftmpattern); if (IS_NULL(r->TermWin.xftmfont)) goto Failure; # ifdef DEBUG face = XftLockFace (r->TermWin.xftmfont); XftUnlockFace (r->TermWin.xftmfont); # endif width = r->TermWin.xftmfont->max_advance_width; if ((width & 0x01) == 1) /* in case width is not even */ r->TermWin.xftmono = 0; else if ( STRCASECMP (ofname, (char*) omfname) && (r->TermWin.fwidth != (width >> 1)) ) r->TermWin.xftmono = 0; else if (ISSET_OPTION(r, Opt2_xftSlowOutput)) r->TermWin.xftmono = 0; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "xftmono is %d\n", r->TermWin.xftmono)); MAX_IT (r->TermWin.fwidth, (width >> 1)); if( !r->TermWin.xftpfont ) r->TermWin.pwidth = r->TermWin.fwidth; height = r->TermWin.xftmfont->ascent + r->TermWin.xftmfont->descent; # ifndef NO_LINESPACE height += r->TermWin.lineSpace; # endif MAX_IT (r->TermWin.fheight, height); if( !r->TermWin.xftpfont ) r->TermWin.pheight = r->TermWin.fheight; return 1; Failure: if (r->TermWin.xftmpattern) { XftPatternDestroy (r->TermWin.xftmpattern); SET_NULL(r->TermWin.xftmpattern); } return 0; } # endif /* MULTICHAR_SET */ /* * Set the weight of an Xft font from the weight description. */ /* INTPROTO */ void setXftWeight( XftPattern *xp, const char *weightString, int defaultWeight ) { assert(xp); /* font weight */ if ( NOT_NULL(weightString) ) { if (0 == STRCASECMP (weightString, "light")) XftPatternAddInteger (xp, XFT_WEIGHT, XFT_WEIGHT_LIGHT); else if (0 == STRCASECMP (weightString, "medium")) XftPatternAddInteger (xp, XFT_WEIGHT, XFT_WEIGHT_MEDIUM); else if (0 == STRCASECMP (weightString, "demibold")) XftPatternAddInteger (xp, XFT_WEIGHT, XFT_WEIGHT_DEMIBOLD); else if (0 == STRCASECMP (weightString, "bold")) XftPatternAddInteger (xp, XFT_WEIGHT, XFT_WEIGHT_BOLD); else if (0 == STRCASECMP (weightString, "black")) XftPatternAddInteger (xp, XFT_WEIGHT, XFT_WEIGHT_BLACK); else XftPatternAddInteger (xp, XFT_WEIGHT, defaultWeight); } else XftPatternAddInteger( xp, XFT_WEIGHT, defaultWeight ); } /* EXTPROTO */ int rxvt_init_font_xft (rxvt_t* r) { XftResult fr; XftPattern* xp; XGlyphInfo ext1, ext2; int len, olen; /* font name length */ char* fname; /* font name to open */ FcChar8* ofname = NULL; /* actually opened font name */ # ifdef DEBUG FT_Face face; # endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_init_font_xft\n")); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "load freetype font\n")); xp = XftPatternCreate (); if (IS_NULL(xp)) return 0; /* font family */ fname = (char*) r->h->rs[Rs_xftfont]; if (IS_NULL(fname)) fname = DEFAULT_XFT_FONT_NAME; XftPatternAddString (xp, XFT_FAMILY, fname); /* No spacing between lines */ XftPatternAddBool (xp, XFT_MINSPACE, FcFalse); /* antialias */ if (ISSET_OPTION(r, Opt2_xftAntialias)) XftPatternAddBool (xp, XFT_ANTIALIAS, FcTrue); else XftPatternAddBool (xp, XFT_ANTIALIAS, FcFalse); /* hinting */ if (ISSET_OPTION(r, Opt2_xftHinting)) XftPatternAddBool (xp, FC_HINTING, FcTrue); else XftPatternAddBool (xp, FC_HINTING, FcFalse); /* autohint */ if (ISSET_OPTION(r, Opt2_xftAutoHint)) XftPatternAddBool (xp, FC_AUTOHINT, FcTrue); else XftPatternAddBool (xp, FC_AUTOHINT, FcFalse); /* font size, we always set it. if it's not set by the user, we ** have chosen a default value (12) for it */ XftPatternAddDouble (xp, XFT_SIZE, (double) r->TermWin.xftsize); /* Enforce Size/Pixel_Size = 1.0 */ XftPatternAddDouble (xp, XFT_SCALE, (double) 1.0); /* font width */ if (r->h->rs[Rs_xftwd]) { if (0 == STRCASECMP (r->h->rs[Rs_xftwd], "ultracondensed")) XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_ULTRACONDENSED); else if (0 == STRCASECMP (r->h->rs[Rs_xftwd], "condensed")) XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_CONDENSED); else if (0 == STRCASECMP (r->h->rs[Rs_xftwd], "normal")) XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_NORMAL); else if (0 == STRCASECMP (r->h->rs[Rs_xftwd], "expanded")) XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_EXPANDED); else if (0 == STRCASECMP (r->h->rs[Rs_xftwd], "ultraexpanded")) XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_ULTRAEXPANDED); else XftPatternAddInteger (xp, FC_WIDTH, FC_WIDTH_NORMAL); } setXftWeight( xp, r->h->rs[Rs_xftwt], XFT_WEIGHT_MEDIUM ); /* font slant */ if (r->h->rs[Rs_xftst]) { if (0 == STRCASECMP (r->h->rs[Rs_xftst], "roman")) XftPatternAddInteger (xp, XFT_SLANT, XFT_SLANT_ROMAN); else if (0 == STRCASECMP (r->h->rs[Rs_xftst], "italic")) XftPatternAddInteger (xp, XFT_SLANT, XFT_SLANT_ITALIC); else if (0 == STRCASECMP (r->h->rs[Rs_xftst], "oblique")) XftPatternAddInteger (xp, XFT_SLANT, XFT_SLANT_OBLIQUE); else /* default is roman */ XftPatternAddInteger (xp, XFT_SLANT, XFT_SLANT_ROMAN); } /* font rgba */ if (r->h->rs[Rs_xftrgb]) { if (0 == STRCASECMP (r->h->rs[Rs_xftrgb], "rgb")) XftPatternAddInteger (xp, XFT_RGBA, XFT_RGBA_RGB); else if (0 == STRCASECMP (r->h->rs[Rs_xftrgb], "bgr")) XftPatternAddInteger (xp, XFT_RGBA, XFT_RGBA_BGR); else if (0 == STRCASECMP (r->h->rs[Rs_xftrgb], "vrgb")) XftPatternAddInteger (xp, XFT_RGBA, XFT_RGBA_VRGB); else if (0 == STRCASECMP (r->h->rs[Rs_xftrgb], "vbgr")) XftPatternAddInteger (xp, XFT_RGBA, XFT_RGBA_VBGR); else XftPatternAddInteger (xp, XFT_RGBA, XFT_RGBA_NONE); } /* * 2006-01-26 gi1242: Monospaced fonts seem a good idea. * 2006-01-27 gi1242: Maybe not such a good idea. When we ask for a * monospaced font from a propotionally spaced font, we just get the same * old prop font, with a bigass textwidth. That's no use to us. If it * returned the closest matching mono-spaced font, then that would be * useful. */ #if 0 XftPatternAddInteger (xp, XFT_SPACING, XFT_MONO); #endif r->TermWin.xftpattern = XftFontMatch (r->Xdisplay, XSCREEN, xp, &fr); if (IS_NULL(r->TermWin.xftpattern)) goto Failure; /* globaladvance */ if (ISSET_OPTION(r, Opt2_xftGlobalAdvance)) { XftPatternDel (r->TermWin.xftpattern, FC_GLOBAL_ADVANCE); XftPatternAddBool (r->TermWin.xftpattern, FC_GLOBAL_ADVANCE, FcTrue); } # ifdef DEBUG FcPatternPrint (r->TermWin.xftpattern); # endif /* * Print a warning if our matched font is different from the user supplied * font. */ XftPatternGetString (r->TermWin.xftpattern, XFT_FAMILY, 0, &ofname); assert (NOT_NULL(ofname)); /* shouldn't be NULL */ len = STRLEN(fname); olen = STRLEN(ofname); if( STRCMP( fname, DEFAULT_XFT_FONT_NAME) /* Not the default font */ /* Not opened font */ && (len != olen || STRNCASECMP((char*) ofname, fname, len)) ) rxvt_msg( DBG_ERROR, DBG_MAIN, "Cannot open font '%s'. Using font '%s' instead.\n", fname, ofname); rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "create xftpattern = 0x%x on font %d\n", (unsigned int) r->TermWin.xftpattern, r->TermWin.xftsize)); /* * Actually open the font. */ r->TermWin.xftfont = XftFontOpenPattern( r->Xdisplay, r->TermWin.xftpattern); /* * Now open the prop font. */ if (IS_NULL(r->h->rs[Rs_xftpfn])) fname = DEFAULT_XFT_PFONT_NAME; else if( !STRCASECMP( r->h->rs[Rs_xftpfn], "none")) SET_NULL(fname); else fname = (char *) r->h->rs[Rs_xftpfn]; if (NOT_NULL(fname) && IS_NULL(r->TermWin.xftpfont) && IS_NULL(r->TermWin.xftPfont)) { XftPattern *ppat = XftPatternDuplicate( xp ); XftPattern *match; XftPatternDel( ppat, XFT_FAMILY); XftPatternAddString (ppat, XFT_FAMILY, fname); XftPatternDel( ppat, XFT_SIZE); XftPatternAddDouble( ppat, XFT_SIZE, (double) r->TermWin.xftpsize); /* * If one ever adds a XFT_MONO flag to the pattern, then it should be * removed here. */ #if 0 XftPatternDel( ppat, XFT_SPACING); #endif match = XftFontMatch (r->Xdisplay, XSCREEN, ppat, &fr); r->TermWin.xftpfont = XftFontOpenPattern( r->Xdisplay, match); /* * XXX gi1242 2006-01-27: Xft bug. Patterns passed to XftFontOpenPattern * can't always be safely freed. */ #if 0 FcPatternPrint( match); XftPatternDestroy( match); #endif /* * Try and open a bold version of the same font to use for the active * tab title / etc. */ XftPatternDel (ppat, XFT_WEIGHT); XftPatternAddInteger (ppat, XFT_WEIGHT, XFT_WEIGHT_BOLD); match = XftFontMatch (r->Xdisplay, XSCREEN, ppat, &fr); r->TermWin.xftPfont = XftFontOpenPattern( r->Xdisplay, match); /* * If we couldn't open the bold font, then use the regular font. */ if( !r->TermWin.xftPfont ) r->TermWin.xftPfont = r->TermWin.xftpfont; /* * XXX gi1242 2006-01-27: Xft bug. Patterns passed to XftFontOpenPattern * can't always be safely freed. */ #if 0 XftPatternDestroy( match); #endif XftPatternDestroy( ppat); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "Opened prop fonts %p, %p\n", r->TermWin.xftpfont, r->TermWin.xftPfont)); } if (IS_NULL(r->TermWin.xftfont)) goto Failure; r->TermWin.fwidth = r->TermWin.xftfont->max_advance_width; r->TermWin.fheight = r->TermWin.xftfont->ascent + r->TermWin.xftfont->descent; # ifndef NO_LINESPACE r->TermWin.fheight += r->TermWin.lineSpace; # endif /* * Failure opening prop fonts can be handled gracefully: Fall back to the * usual font. */ #ifdef MULTICHAR_SET if (IS_NULL(r->TermWin.xftpfont) && isDoubleWidthFont(r->Xdisplay, r->TermWin.xftfont) ) { /* * 2006-04-28 gi1242: Double width fonts are only handled correctly by * the screen drawing functions. The problem is that these need to be * drawn one character at a time to get correct output, which is not * done by the menu / tabbar functions. It will be a waste to write * extra code to do that, so we pretend that we *have* a pfont. * * This will however make the font spacing in tab titles incorrect for * double width fonts. */ rxvt_msg (DBG_WARN, DBG_MAIN, "Warning: Double width font, with no pfont\n"); r->TermWin.xftpfont = r->TermWin.xftfont; r->TermWin.xftPfont = r->TermWin.xftfont; } #endif /* MULTICHAR_SET */ if( r->TermWin.xftpfont ) { r->TermWin.pheight = max( r->TermWin.xftpfont->height, r->TermWin.xftPfont->height); r->TermWin.pwidth = r->TermWin.xftpfont->max_advance_width / 2; } else { r->TermWin.pheight = r->TermWin.fheight; r->TermWin.pwidth = r->TermWin.fwidth; } #ifdef DEBUG face = XftLockFace (r->TermWin.xftfont); XftUnlockFace (r->TermWin.xftfont); # endif /* * Do not trust the font width */ #ifdef MULTICHAR_SET if( isDoubleWidthFont( r->Xdisplay, r->TermWin.xftfont ) ) { rxvt_msg (DBG_INFO, DBG_MAIN, "Got double width font. Halving width\n"); r->TermWin.xftmono = 0; r->TermWin.fwidth >>= 1; } else #endif { XftTextExtents8 (r->Xdisplay, r->TermWin.xftfont, (unsigned char*) "W", 1, &ext1); XftTextExtents8 (r->Xdisplay, r->TermWin.xftfont, (unsigned char*) "i", 1, &ext2); if (ext1.xOff == ext2.xOff) r->TermWin.xftfnmono = r->TermWin.xftmono = 1; else r->TermWin.xftfnmono = r->TermWin.xftmono = 0; } rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "xftfnmono is %d\n", r->TermWin.xftfnmono)); # ifndef NO_BOLDFONT rxvt_init_bfont_xft( r, xp ); # endif # ifdef MULTICHAR_SET if (!rxvt_init_mfont_xft (r, xp, (char*) ofname)) goto Failure; # endif /* MULTICHAR_SET */ XftPatternDestroy (xp); return 1; Failure: if (xp) { XftPatternDestroy (xp); } if (r->TermWin.xftpattern && r->TermWin.xftpattern != xp) { XftPatternDestroy (r->TermWin.xftpattern); SET_NULL(r->TermWin.xftpattern); } return 0; } /*----------------------------------------------------------------------*/ /* rxvt_init_font_fixed () - initialize fixed font */ /* INTPROTO */ void rxvt_init_font_fixed (rxvt_t* r) { XFontStruct* xfont; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load font (fixed)\n")); xfont = XLoadQueryFont( r->Xdisplay, "fixed" ); if (IS_NULL(xfont)) { rxvt_msg( DBG_FATAL, DBG_MAIN, "Could not load font 'fixed'.\n" ); exit(EXIT_FAILURE); } r->TermWin.font = xfont; #ifndef NO_BOLDFONT /* r->TermWin.bfont = r->TermWin.xftbfont? xfont : NULL; */ SET_NULL(r->TermWin.bfont); #endif #ifdef MULTICHAR_SET r->TermWin.mfont = xfont; #endif } #endif /* XFT_SUPPORT */ /* rxvt_init_font_x11 () - initialize font */ /* EXTPROTO */ void rxvt_init_font_x11 (rxvt_t *r) { char* msg = "can't load font \"%s\"\n"; XFontStruct* xfont; #ifndef NO_BOLDFONT XFontStruct* bfont; int ckfont; #endif int fh = 0, fw = 0; int idx = 0; /* index into rs_font[] */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_init_font_x11 \n")); #ifdef XFT_SUPPORT /* Only load fixed font if we use freetype font */ if (ISSET_OPTION(r, Opt_xft) && r->TermWin.xftfont) { rxvt_init_font_fixed (r); return; } #endif r->h->fnum = FONT0_IDX; idx = FNUM2IDX(r->h->fnum); /* OK, now it's time to load the default font */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load font (%s)\n", r->h->rs[Rs_font+idx])); xfont = XLoadQueryFont (r->Xdisplay, r->h->rs[Rs_font+idx]); if (IS_NULL(xfont)) { /* failed to load font */ rxvt_msg( DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_font+idx] ); /* try to load fixed font */ r->h->rs[Rs_font+idx] = "fixed"; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load font (%s)\n", r->h->rs[Rs_font+idx])); xfont = XLoadQueryFont(r->Xdisplay, r->h->rs[Rs_font+idx]); if (IS_NULL(xfont)) { /* still failed to load font */ rxvt_msg( DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_font+idx] ); /* cannot load any font, fatal error, abort the program */ goto Abort; } } /* Font loading succeeded */ if (NOT_NULL(xfont)) { r->TermWin.font = xfont; } /* set the font sizes */ fw = rxvt_get_font_widest (r->TermWin.font); fh = r->TermWin.font->ascent + r->TermWin.font->descent; #ifndef NO_LINESPACE fh += r->TermWin.lineSpace; #endif if (fw == r->TermWin.font->min_bounds.width) /* Mono-spaced (fixed width) font */ r->TermWin.propfont &= ~PROPFONT_NORMAL; else /* Proportional font */ r->TermWin.propfont |= PROPFONT_NORMAL; #ifndef NO_BOLDFONT ckfont = !(fw == r->TermWin.fwidth && fh == r->TermWin.fheight); #endif r->TermWin.fwidth = fw; r->TermWin.fheight = fh; #ifdef XFT_SUPPORT r->TermWin.pwidth = fw; r->TermWin.pheight = fh; #endif #ifndef NO_BOLDFONT SET_NULL(bfont); if (ckfont) { /* try to load boldFont, fail silently */ if (NOT_NULL(r->h->rs[Rs_boldFont+idx])) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load bfont (%s)\n", r->h->rs[Rs_boldFont+idx])); bfont = XLoadQueryFont (r->Xdisplay, r->h->rs[Rs_boldFont+idx]); } if (NOT_NULL(bfont)) { /* Loading bold font succeeded */ fw = rxvt_get_font_widest (bfont); fh = bfont->ascent + bfont->descent; #ifndef NO_LINESPACE fh += r->TermWin.lineSpace; #endif if (fw <= r->TermWin.fwidth && fh <= r->TermWin.fheight) { r->TermWin.bfont = bfont; if (fw == r->TermWin.fwidth) r->TermWin.propfont &= ~PROPFONT_BOLD; else r->TermWin.propfont |= PROPFONT_BOLD; } else { XFreeFont (r->Xdisplay, bfont); } } } #endif /* NO_BOLDFONT */ #ifdef MULTICHAR_SET /* load font or substitute */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load mfont (%s)\n", r->h->rs[Rs_mfont+idx])); xfont = XLoadQueryFont(r->Xdisplay, r->h->rs[Rs_mfont+idx]); if (IS_NULL(xfont)) { char* ptr; /* failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_mfont+idx]); ptr = rxvt_fallback_mfont_x11 (r); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load mfont (%s)\n", ptr)); xfont = XLoadQueryFont(r->Xdisplay, ptr); if (NOT_NULL(xfont)) r->h->rs[Rs_mfont+idx] = ptr; else { /* still failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, ptr); /* cannot load any mfont, fatal error, abort the program */ goto Abort; } } if (NOT_NULL(xfont)) { r->TermWin.mfont = xfont; } #endif /* MULTICHAR_SET */ /* Succeeded to load font, return now */ return ; Abort: rxvt_msg (DBG_ERROR, DBG_MAIN, "fatal error, aborting..."); exit(EXIT_FAILURE); } #ifdef XFT_SUPPORT # ifdef MULTICHAR_SET /* * 2006-04-27 gi1242: Stolen from xterm-207. Some fonts (e.g. aquafont) report * their width to be double the actual width (see below). Test for this here. */ # define HALF_WIDTH_TEST_STRING "1234567890" /* '1234567890' in Chinese characters in UTF-8 */ # define FULL_WIDTH_TEST_STRING "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89" \ "\xe5\x9b\x9b\xe4\xba\x94" \ "\xef\xa7\x91\xe4\xb8\x83\xe5\x85\xab" \ "\xe4\xb9\x9d\xef\xa6\xb2" /* '1234567890' in Korean script in UTF-8 */ # define FULL_WIDTH_TEST_STRING2 "\xec\x9d\xbc\xec\x9d\xb4\xec\x82\xbc" \ "\xec\x82\xac\xec\x98\xa4" \ "\xec\x9c\xa1\xec\xb9\xa0\xed\x8c\x94" \ "\xea\xb5\xac\xec\x98\x81" # define HALF_WIDTH_CHAR1 0x0031 /* 'l' */ # define HALF_WIDTH_CHAR2 0x0057 /* 'W' */ # define FULL_WIDTH_CHAR1 0x4E00 /* CJK Ideograph 'number one' */ # define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */ /*INTPROTO*/ int isDoubleWidthFont(Display * dpy, XftFont * font) { XGlyphInfo gi1, gi2; FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2; char *fwstr = FULL_WIDTH_TEST_STRING; char *hwstr = HALF_WIDTH_TEST_STRING; /* Some Korean fonts don't have Chinese characters at all. */ if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR1)) { if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR2)) return 0; /* Not a CJK font */ else /* a Korean font without CJK Ideographs */ fwstr = FULL_WIDTH_TEST_STRING2; } XftTextExtents32(dpy, font, &c1, 1, &gi1); XftTextExtents32(dpy, font, &c2, 1, &gi2); if (gi1.xOff != gi2.xOff) /* Not a fixed-width font */ return 0; XftTextExtentsUtf8(dpy, font, (FcChar8 *) hwstr, (int) strlen(hwstr), &gi1); XftTextExtentsUtf8(dpy, font, (FcChar8 *) fwstr, (int) strlen(fwstr), &gi2); /* * fontconfig and Xft prior to 2.2(?) set the width of half-width characters * identical to that of full-width character in CJK double-width (bi-width / * monospace) font even though the former is half as wide as the latter. * This was fixed sometime before the release of fontconfig 2.2 in early * 2003. See * * http://bugzilla.mozilla.org/show_bug.cgi?id=196312 * * In the meantime, we have to check both possibilities. */ return ((2 * gi1.xOff == gi2.xOff) || (gi1.xOff == gi2.xOff)); } # endif /*MULTICHAR_SET*/ /* * Close font f if it is not one of xftfont, xftpfont, xftbfont, xftmfont. */ /* INTPROTO */ void xftFreeUnusedFont( rxvt_t *r, XftFont *f) { if( f && f != r->TermWin.xftfont && f != r->TermWin.xftpfont && f != r->TermWin.xftPfont # ifdef MULTICHAR_SET && f != r->TermWin.xftmfont # endif # ifndef NO_BOLDFONT && f != r->TermWin.xftbfont # endif ) XftFontClose( r->Xdisplay, f); } /* EXTPROTO */ int rxvt_change_font_xft (rxvt_t* r, const char* fontname) { XftPattern* xp; XftFont *xf, *pxf, *Pxf; # ifdef MULTICHAR_SET XftPattern* mxp; XftFont* mxf; # endif int resize, oldsize = r->TermWin.xftsize; assert (fontname); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_change_font_xft (%s)\n", fontname)); /* we only accept FONT_CMD now for XFT font ;-) */ if (FONT_CMD != fontname[0]) return 0; if ((char) 0 != fontname[1] && '+' != fontname[1] && '-' != fontname[1] && !isdigit((int) fontname[1])) return 0; if (('+' == fontname[1]) && ((char) 0 == fontname[2])) resize = +1; else if (('-' == fontname[1]) && ((char) 0 == fontname[2])) resize = -1; else resize = atoi (fontname+1); r->TermWin.xftsize += resize; /* adjust for minimal font size */ if (r->TermWin.xftsize < MIN_XFT_FONT_SIZE) r->TermWin.xftsize = MIN_XFT_FONT_SIZE; /* no change of font size */ if (r->TermWin.xftsize == oldsize) return 0; /* Change pfont size and mfont size */ r->TermWin.xftpsize += resize; if (r->TermWin.xftpsize < MIN_XFT_FONT_SIZE) r->TermWin.xftpsize = MIN_XFT_FONT_SIZE; # ifdef MULTICHAR_SET if (r->h->rs[Rs_xftmsz]) { r->TermWin.xftmsize += resize; if (r->TermWin.xftmsize < MIN_XFT_FONT_SIZE) r->TermWin.xftmsize = MIN_XFT_FONT_SIZE; } # endif /* ** Now reload xft font with new size using rxvt_init_font_xft. ** We can reuse it since we have only changed the font size. ** Before doing so, let us backup the old xft info in case ** we cannot load new xft font. In that case, we can still ** fallback to the old font. */ xp = r->TermWin.xftpattern; SET_NULL(r->TermWin.xftpattern); xf = r->TermWin.xftfont; SET_NULL(r->TermWin.xftfont); pxf = r->TermWin.xftpfont; SET_NULL(r->TermWin.xftpfont); Pxf = r->TermWin.xftPfont; SET_NULL(r->TermWin.xftPfont); # ifdef MULTICHAR_SET mxp = r->TermWin.xftmpattern; SET_NULL(r->TermWin.xftmpattern); mxf = r->TermWin.xftmfont; SET_NULL(r->TermWin.xftmfont); # endif if (!rxvt_init_font_xft (r)) { /* fallback to old font */ r->TermWin.xftpattern = xp; r->TermWin.xftfont = xf; r->TermWin.xftpfont = pxf; r->TermWin.xftPfont = Pxf; # ifdef MULTICHAR_SET r->TermWin.xftmpattern = mxp; r->TermWin.xftmfont = mxf; # endif return 0; } /* The old Xft font (if differnt) can now be freed */ xftFreeUnusedFont( r, xf ); if( pxf != xf) xftFreeUnusedFont( r, pxf ); if( Pxf != xf && Pxf != pxf) xftFreeUnusedFont( r, Pxf); #ifdef MULTICHAR_SET if( mxf != xf && mxf != pxf) xftFreeUnusedFont( r, mxf ); #endif /* * XXX It is safe now to free old XftPattern, but apparently there is some * problems if we change the font size in reverse direction, e.g., increase * font size then decrease it, or decrease font size then increase it. It * can crash the terminal. * * 12-19-2004: Is it because the pattern is got via XftFontMatch, which * actually returns a *static* pattern that we should not manually destroy? * Anyway, to avoid the crash, let us comment out the XftPatternDestroy * calls below. I hope there is a more clear documentation about these Xft * functions!!! * * 2006-01-27 gi1242: After grepping through the Xft source code, I think I * know the problem. XftFontOpenInfo destroys the font pattern if the * pattern corresponds to an already open font. Thus when we destroy it, * it's a double free leading to a friendly segfault. This is a bug in * Xft. * * To make matters worse, closing previously opened fonts won't work. Xft * caches fonts ... and only closes them when necessary. Thus calling * XftFontClose them won't guarentee the font is actually closed. So untill * the Xft folks fix this, we have to live with a temporary memory leak. */ #if 0 rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "Destroy %p, (xftpattern %p, xftmpattern %p)\n", xp, r->TermWin.xftpattern, r->TermWin.xftmpattern))); /* FcPatternPrint (xp); FcPatternPrint (r->TermWin.xftpattern); */ XftPatternDestroy (xp); # ifdef MULTICHAR_SET if (xp != mxp) XftPatternDestroy (mxp); # endif #endif return 1; } #endif /* XFT_SUPPORT */ /*----------------------------------------------------------------------*/ /* rxvt_change_font_x11 () - Switch to a new font */ /* * init = 1 - initialize * * fontname == FONT_UP - switch to bigger font * fontname == FONT_DN - switch to smaller font */ /* EXTPROTO */ int rxvt_change_font_x11 (rxvt_t* r, const char *fontname) { char* msg = "can't load font \"%s\""; XFontStruct* xfont; #ifndef NO_BOLDFONT XFontStruct* bfont; int ckfont; #endif int fh = 0, fw = 0; int idx = 0; /* index into rs_font[] */ assert (fontname); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_change_font_x11 (%s)\n", fontname)); switch (fontname[0]) { /* special (internal) prefix for font commands */ case FONT_CMD: /* FONT_CMD =='#' */ idx = atoi (fontname + 1); switch (fontname[1]) { case '+': /* corresponds to FONT_UP */ r->h->fnum += (idx ? idx : 1); /* "#+" or "#+3"? */ r->h->fnum %= MAX_NFONTS; break; case '-': /* corresponds to FONT_DN */ r->h->fnum += (idx ? idx : -1); /* "#-" or "#-3"? */ r->h->fnum %= MAX_NFONTS; break; default: /* input is not a logical font number */ if (fontname[1] != '\0' && !isdigit((int) fontname[1])) return 0; /* * input logical font number too big, but don't worry, we * will handle it gracefully ;-) */ r->h->fnum = IDX2FNUM(idx); break; } SET_NULL(fontname); break; default: /* search for existing fontname */ for (idx = 0; idx < MAX_NFONTS; idx++) { if (!STRCMP (r->h->rs[Rs_font+idx], fontname)) { r->h->fnum = IDX2FNUM(idx); SET_NULL(fontname); break; } } break; } /* re-position around the normal font */ if (r->h->fnum < 0) r->h->fnum += (-(r->h->fnum / MAX_NFONTS - 1) * MAX_NFONTS); idx = FNUM2IDX(r->h->fnum); /* ** If fontname != NULL, it's some new font not in the rs_font. ** We try to load it and replace font in rs_font if succeed. */ if (NOT_NULL(fontname)) { xfont = XLoadQueryFont(r->Xdisplay, fontname); if (xfont) { /* load new font succeessfully */ char* ptr = STRDUP (fontname); if (ptr) { if (NOT_NULL(r->h->newfont[idx])) rxvt_free (r->h->newfont[idx]); r->h->newfont[idx] = ptr; r->h->rs[Rs_font+idx] = r->h->newfont[idx]; } else { assert (0); /* shouldn't happen */ } /* Free it by now */ XFreeFont (r->Xdisplay, xfont); } } /* ** OK, now it's time to load font or substitute */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load font (%s)\n", r->h->rs[Rs_font+idx])); xfont = XLoadQueryFont (r->Xdisplay, r->h->rs[Rs_font+idx]); if (!xfont) { /* failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_font+idx]); /* try to load fixed font */ r->h->rs[Rs_font+idx] = "fixed"; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load font (%s)\n", r->h->rs[Rs_font+idx])); xfont = XLoadQueryFont(r->Xdisplay, r->h->rs[Rs_font+idx]); if (!xfont) { /* still failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_font+idx]); return 0; } } /* Font loading succeeded */ if (xfont) { /* ** if the previous font exists, replace it with new font. ** otherwise, keep the old font, and do nothing */ if (r->TermWin.font) XFreeFont (r->Xdisplay, r->TermWin.font); r->TermWin.font = xfont; } /* set the font sizes */ fw = rxvt_get_font_widest (r->TermWin.font); fh = r->TermWin.font->ascent + r->TermWin.font->descent; #ifndef NO_LINESPACE fh += r->TermWin.lineSpace; #endif if (fw == r->TermWin.font->min_bounds.width) /* Mono-spaced (fixed width) font */ r->TermWin.propfont &= ~PROPFONT_NORMAL; else /* Proportional font */ r->TermWin.propfont |= PROPFONT_NORMAL; #ifndef NO_BOLDFONT ckfont = !(fw == r->TermWin.fwidth && fh == r->TermWin.fheight); #endif #ifdef XFT_SUPPORT /* Set font size when XFT is not enabled */ if (!(ISSET_OPTION(r, Opt_xft) && r->TermWin.xftfont)) #endif { #ifdef XFT_SUPPORT r->TermWin.pwidth = fw; r->TermWin.pheight = fh; #endif r->TermWin.fwidth = fw; r->TermWin.fheight = fh; } #ifndef NO_BOLDFONT SET_NULL(bfont); if (ckfont) { if (r->TermWin.bfont) { XFreeFont (r->Xdisplay, r->TermWin.bfont); SET_NULL(r->TermWin.bfont); } /* try to load boldFont, fail silently */ if (IS_NULL(r->TermWin.bfont) && NOT_NULL(r->h->rs[Rs_boldFont+idx])) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load bfont (%s)\n", r->h->rs[Rs_boldFont+idx])); bfont = XLoadQueryFont (r->Xdisplay, r->h->rs[Rs_boldFont+idx]); } if (bfont) { /* Loading bold font succeeded */ fw = rxvt_get_font_widest (bfont); fh = bfont->ascent + bfont->descent; #ifndef NO_LINESPACE fh += r->TermWin.lineSpace; #endif if (fw <= r->TermWin.fwidth && fh <= r->TermWin.fheight) { r->TermWin.bfont = bfont; if (fw == r->TermWin.fwidth) r->TermWin.propfont &= ~PROPFONT_NORMAL; else r->TermWin.propfont |= PROPFONT_NORMAL; } else { XFreeFont (r->Xdisplay, bfont); } } } #endif /* NO_BOLDFONT */ #ifdef HAVE_MENUBAR /* * 2006-01-29 gi1242: We should do something to resize the menubar font. * However just changing it in the appropriate GC from here doesn't seem to * work at all. */ /* Resize the menubar font too. Only needed for X11 font. */ if( #ifdef XFT_SUPPORT NOTSET_OPTION(r, Opt_xft) && #endif IS_WIN(r->menuBar.win)) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "Resized menubar font\n")); XSetFont( r->Xdisplay, r->menuBar.gc, r->TermWin.font->fid); } #endif #ifdef MULTICHAR_SET /* load font or substitute */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load mfont (%s)\n", r->h->rs[Rs_mfont+idx])); xfont = XLoadQueryFont(r->Xdisplay, r->h->rs[Rs_mfont+idx]); if (!xfont) { char* ptr; /* failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, r->h->rs[Rs_mfont+idx]); /* try to load default font */ ptr = rxvt_fallback_mfont_x11 (r); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, " load mfont (%s)\n", ptr)); xfont = XLoadQueryFont(r->Xdisplay, ptr); if (xfont) r->h->rs[Rs_mfont+idx] = ptr; else { /* still failed to load font */ rxvt_msg (DBG_ERROR, DBG_MAIN, msg, ptr); return 0; } } if (xfont) { /* ** if the previous font exists, replace it with new font. ** otherwise, keep the old font, and do nothing */ if (r->TermWin.mfont) XFreeFont (r->Xdisplay, r->TermWin.mfont); r->TermWin.mfont = xfont; } #endif /* MULTICHAR_SET */ #ifdef USE_XIM rxvt_IM_change_fontset(r, idx); #endif return 1; } /* INTPROTO */ void rxvt_font_up_down(rxvt_t* r, int n, int direction) { const char *p; int initial, j; for (j = 0; j < n; j++) { initial = r->h->fnum; for (;;) { r->h->fnum += direction; if (r->h->fnum == MAX_NFONTS || r->h->fnum == -1) { r->h->fnum = initial; return; } p = r->h->rs[Rs_font + FNUM2IDX(r->h->fnum)]; if (NOT_NULL(p) && STRLEN(p) > 1) break; } } } #undef IDX2FNUM #undef FNUM2IDX /* INTPROTO */ int rxvt_get_font_widest(XFontStruct *f) { int i, cw, fw = 0; if (f->min_bounds.width == f->max_bounds.width) return f->min_bounds.width; if (IS_NULL(f->per_char)) return f->max_bounds.width; for (i = f->max_char_or_byte2 - f->min_char_or_byte2; --i >= 0;) { cw = f->per_char[i].width; MAX_IT(fw, cw); } return fw; } /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ #ifdef X_HAVE_UTF8_STRING /* INTPROTO */ void rxvt_set_utf8_property (rxvt_t* r, Atom prop, Window win, const char* str) { #ifdef HAVE_WCHAR_H # if !defined (OS_FREEBSD) || _FreeBSD_version >= 500000 wchar_t* ws = rxvt_mbstowcs (str); char* s = rxvt_wcstoutf8 (ws); XChangeProperty (r->Xdisplay, win, prop, r->h->xa[XA_UTF8_STRING], 8, PropModeReplace, (unsigned char*) s, STRLEN (s)); rxvt_free (s); rxvt_free (ws); # endif /* !defined (OS_FREEBSD) ||... */ #endif /* HAVE_WCHAR_H */ } #endif /* X_HAVE_UTF8_STRING */ /* xterm sequences - title, iconName, color (exptl) */ /* EXTPROTO */ void rxvt_set_win_title (rxvt_t* r, Window win, const char* str) { XChangeProperty (r->Xdisplay, win, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (unsigned char*) str, STRLEN (str)); #ifdef X_HAVE_UTF8_STRING rxvt_set_utf8_property (r, r->h->xa[XA_NET_WM_NAME], r->TermWin.parent, str); #endif } /* EXTPROTO */ void rxvt_set_term_title (rxvt_t* r, const unsigned char *str) { #ifdef SMART_WINDOW_TITLE XTextProperty prop; if (XGetWMName (r->Xdisplay, r->TermWin.parent, &prop) == 0) SET_NULL(prop.value); if (IS_NULL(prop.value) || STRCMP(prop.value, str)) #endif { rxvt_set_win_title (r, r->TermWin.parent, (char*) str); } } /* EXTPROTO */ void rxvt_set_icon_name (rxvt_t* r, const unsigned char *str) { XTextProperty prop; #ifdef SMART_WINDOW_TITLE if (XGetWMIconName(r->Xdisplay, r->TermWin.parent, &prop) == 0) SET_NULL(prop.value); if (IS_NULL(prop.value) || STRCMP(prop.value, str)) #endif { XChangeProperty (r->Xdisplay, r->TermWin.parent, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (unsigned char*) str, STRLEN (str)); #ifdef X_HAVE_UTF8_STRING rxvt_set_utf8_property (r, r->h->xa[XA_NET_WM_ICON_NAME], r->TermWin.parent, (char*) str); #endif } } #ifdef XTERM_COLOR_CHANGE /* EXTPROTO */ void rxvt_set_window_color(rxvt_t* r, int page, int idx, const char *color) { XColor xcol; int color_set; register int i; rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "%s( r, %d, %d, %s), ATAB=%d\n", __func__, page, idx, color, ATAB(r))); if (IS_NULL(color) || (char) 0 == *color) return; /* * Set the fg/bg colors from this page, just in case the fg/bg is to be * changed. */ rxvt_set_fgbg_colors( r, page ); color_set = ISSET_PIXCOLOR(r->h, idx); /* handle color aliases */ if( isdigit((int) *color) ) { i = atoi(color); if (i >= 8 && i <= 15) /* bright colors */ { i -= 8; # ifndef NO_BRIGHTCOLOR rxvt_copy_color( r, idx, minBrightCOLOR + i ); goto Done; # endif } if (i >= 0 && i <= 7) /* normal colors */ { rxvt_copy_color( r, idx, minCOLOR + i ); goto Done; } } if( !rxvt_parse_alloc_color(r, &xcol, color) ) /* Could not alloc color */ return; /* XStoreColor (r->Xdisplay, XCMAP, XColor*); */ /* * FIXME: should free colors here, but no idea how to do it so instead, * so just keep gobbling up the colormap */ # if 0 /*{{{*/ for (i = Color_Black; i <= Color_White; i++) if (r->pixColors[idx] == r->pixColors[i]) break; if (i > Color_White) { fprintf (stderr, "XFreeColors: r->pixColors [%d] = %lu\n", idx, r->pixColors [idx]); XFreeColors(r->Xdisplay, XCMAP, (r->pixColors + idx), 1, DisplayPlanes(r->Xdisplay, XSCREEN)); } # endif /*}}}*/ rxvt_set_color( r, idx, &xcol ); Done: if( idx == Color_bg ) { PVTS( r, page )->p_bg = r->pixColorsFocus[idx]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) PVTS( r, page )->p_xftbg = r->xftColorsFocus[idx]; #endif if( r->TermWin.fade ) { PVTS( r, page )->p_bgfade = r->pixColorsUnfocus[idx]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) PVTS( r, page )->p_xftbgfade = r->xftColorsUnfocus[idx]; #endif } /* * Update the GC / window background if necessary. */ if( page == ATAB(r) ) r->fgbg_tabnum = -1; } else if ( idx == Color_fg ) { PVTS( r, page )->p_fg = r->pixColorsFocus[idx]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) PVTS( r, page )->p_xftfg = r->xftColorsFocus[idx]; #endif if( r->TermWin.fade ) { PVTS( r, page )->p_fgfade = r->pixColorsUnfocus[idx]; #ifdef XFT_SUPPORT if( ISSET_OPTION( r, Opt_xft ) ) PVTS( r, page )->p_xftfgfade = r->xftColorsUnfocus[idx]; #endif } if( page == ATAB(r) ) /* Force rxvt_set_vt_colors() to update the GC / background. */ r->fgbg_tabnum = -1; } /* handle Color_BD, scrollbar background, etc. */ #if 0 /*{{{*/ /* * Setting the environment will not propogate to an already running child * process. */ rxvt_set_colorfgbg(r); #endif /*}}}*/ if( idx == Color_pointer ) rxvt_recolour_cursor(r); #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) # ifdef TINTING_SUPPORT if (idx == Color_tint) { # ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent)) /* reset background */ rxvt_check_our_parents (r); else # endif # ifdef BACKGROUND_IMAGE { /* reset background */ for (i = 0; i <= LTAB(r); i ++) rxvt_resize_pixmap (r, i); } # endif { /* empty body to suppress compile error */ } } # endif /* TINTING_SUPPORT */ #endif /* TRANSPARENT || BACKGROUND_IMAGE */ /* * Restore the fg/bg colors from the active tab. Call rxvt_set_vt_colors * instead of rxvt_set_fgbg_colors, so that the GC fgbg & window background * will be refreshed if necessary. */ rxvt_set_vt_colors( r, ATAB(r) ); /* * If our palette has changed, the screen must be refreshed. */ XClearArea( r->Xdisplay, AVTS(r)->vt, 0, 0, 0, 0, True ); } #else # define rxvt_set_window_color(r, idx,color) ((void)0) #endif /* XTERM_COLOR_CHANGE */ /* EXTPROTO */ void rxvt_recolour_cursor(rxvt_t *r) { XColor xcol[2]; xcol[0].pixel = r->pixColorsFocus[Color_pointer]; xcol[1].pixel = VTBG(r, 0); XQueryColors(r->Xdisplay, XCMAP, xcol, 2); XRecolorCursor(r->Xdisplay, r->term_pointer, &(xcol[0]), &(xcol[1])); rxvt_dbgmsg ((DBG_DEBUG, DBG_MAIN, "%s(r): fg=%06lx, bg=%06lx\n", __func__, xcol[0].pixel, xcol[1].pixel)); } /*----------------------------------------------------------------------*/ /* * find if fg/bg matches any of the normal (low-intensity) colors */ /* INTPROTO */ void rxvt_set_colorfgbg(rxvt_t *r) { unsigned int i; const char *xpmb = "\0"; char fstr[sizeof("default") + 1], bstr[sizeof("default") + 1]; r->h->env_colorfgbg = rxvt_malloc(sizeof("COLORFGBG=default;default;bg") + 1); STRCPY(fstr, "default"); STRCPY(bstr, "default"); for (i = Color_Black; i <= Color_White; i++) if (r->pixColorsFocus[Color_fg] == r->pixColorsFocus[i]) { sprintf(fstr, "%d", (i - Color_Black)); break; } for (i = Color_Black; i <= Color_White; i++) if (r->pixColorsFocus[Color_bg] == r->pixColorsFocus[i]) { sprintf(bstr, "%d", (i - Color_Black)); #ifdef BACKGROUND_IMAGE xpmb = "default;"; #endif break; } sprintf(r->h->env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); putenv(r->h->env_colorfgbg); #ifndef NO_BRIGHTCOLOR r->h->colorfgbg = DEFAULT_RSTYLE; for (i = minCOLOR; i <= maxCOLOR; i++) { if ( r->pixColorsFocus[Color_fg] == r->pixColorsFocus[i] # ifndef NO_BOLD_UNDERLINE_REVERSE && r->pixColorsFocus[Color_fg] == r->pixColorsFocus[Color_BD] # endif /* if we wanted boldFont to have precedence */ # if 0 /* was ifndef NO_BOLDFONT */ && IS_NULL(r->TermWin.bfont) # endif ) r->h->colorfgbg = SET_FGCOLOR(r->h->colorfgbg, i); if (r->pixColorsFocus[Color_bg] == r->pixColorsFocus[i]) r->h->colorfgbg = SET_BGCOLOR(r->h->colorfgbg, i); } #endif /* NO_BRIGHTCOLOR */ } /*----------------------------------------------------------------------*/ /* * Colour determination for low colour displays, routine from * Hans de Goede */ #ifdef XFT_SUPPORT /* EXTPROTO */ int rxvt_alloc_xft_color( rxvt_t* r, const XColor *xcol, XftColor* xftcolor ) { /* * xcol is an already allocated color, so we don't need a round trip to the * server. */ xftcolor->color.red = xcol->red; xftcolor->color.green = xcol->green; xftcolor->color.blue = xcol->blue; xftcolor->color.alpha = 0xffff; xftcolor->pixel = xcol->pixel; return 1; #if 0 XRenderColor render; assert (xftcolor); render.red = xcol->red; render.green = xcol->green; render.blue = xcol->blue; render.alpha = 0xffff; return XftColorAllocValue(r->Xdisplay, XVISUAL, XCMAP, &render, xftcolor); #endif } #endif /* XFT_SUPPORT */ /* EXTPROTO */ int rxvt_parse_alloc_color(rxvt_t* r, XColor *screen_in_out, const char *colour) { int res = 0; if (!XParseColor(r->Xdisplay, XCMAP, colour, screen_in_out)) rxvt_msg (DBG_ERROR, DBG_MAIN, "can't determine colour: %s", colour); else res = rxvt_alloc_color(r, screen_in_out, colour); return res; } /* EXTPROTO */ int rxvt_alloc_color( rxvt_t* r, XColor *screen_in_out, const char *colour ) { return XAllocColor( r->Xdisplay, XCMAP, screen_in_out ); #if 0 /* 2006-05-27 gi1242: Really bad code. */ int res; if( (res = XAllocColor(r->Xdisplay, XCMAP, screen_in_out)) ) return res; /* try again with closest match */ /* * XXX 2006-05-25 gi1242: This is really inefficient. There must be a better * way! */ if (XDEPTH >= 4 && XDEPTH <= 8) { int i, numcol; int best_pixel = 0; unsigned long best_diff, diff; XColor *colors; #define rSQR(x) ((x)*(x)) best_diff = 0; numcol = 0x01 << XDEPTH; if( (colors = rxvt_malloc(numcol * sizeof(XColor))) ) { for (i = 0; i < numcol; i++) colors[i].pixel = i; XQueryColors(r->Xdisplay, XCMAP, colors, numcol); for (i = 0; i < numcol; i++) { diff = rSQR(screen_in_out->red - colors[i].red) + rSQR(screen_in_out->green - colors[i].green) + rSQR(screen_in_out->blue - colors[i].blue); if (i == 0 || diff < best_diff) { best_pixel = colors[i].pixel; best_diff = diff; } } *screen_in_out = colors[best_pixel]; rxvt_free(colors); res = XAllocColor(r->Xdisplay, XCMAP, screen_in_out); } } if (res == 0) rxvt_msg (DBG_ERROR, DBG_MAIN, "can't allocate color: %s", colour); return res; #endif } /* -------------------------------------------------------------------- * * - X INPUT METHOD ROUTINES - * * -------------------------------------------------------------------- */ #ifdef USE_XIM /* INTPROTO */ void rxvt_IM_set_size(rxvt_t* r, XRectangle *size) { XWindowAttributes xwa; XGetWindowAttributes(r->Xdisplay, AVTS(r)->vt, &xwa); size->x = xwa.x + r->TermWin.int_bwidth; size->y = xwa.y + r->TermWin.int_bwidth; size->width = Width2Pixel(r->TermWin.ncol); size->height = Row2Pixel(r->TermWin.nrow); } /* INTPROTO */ void rxvt_IM_set_position(rxvt_t* r, XPoint *pos) { XWindowAttributes xwa; XGetWindowAttributes(r->Xdisplay, AVTS(r)->vt, &xwa); pos->x = xwa.x + Col2Pixel(ASCR(r).cur.col); pos->y = xwa.y + Row2Pixel(ASCR(r).cur.row) + r->TermWin.font->ascent; } /* INTPROTO */ void rxvt_IM_set_color(rxvt_t* r, unsigned long *fg, unsigned long *bg) { *fg = r->pixColorsFocus[Color_fg]; *bg = r->pixColorsFocus[Color_bg]; } /* Checking whether input method is running. */ /* INTPROTO */ Bool rxvt_IM_is_running(rxvt_t *r) { char *p; Atom atom; Window win; char server[IMBUFSIZ]; /* get current locale modifier */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_IM_is_running ()\n")); if (NOT_NULL(p = XSetLocaleModifiers(NULL))) { STRCPY(server, "@server="); STRNCAT(server, &(p[4]), IMBUFSIZ - 9); /* skip "@im=" */ if (NOT_NULL(p = STRCHR(server + 1, '@'))) /* first one only */ *p = '\0'; atom = XInternAtom(r->Xdisplay, server, False); win = XGetSelectionOwner (r->Xdisplay, atom); if (IS_WIN(win)) return True; } return False; } /* EXTPROTO */ void rxvt_IM_send_spot (rxvt_t *r) { XPoint spot; XVaNestedList preedit_attr; if (IS_NULL(r->h->Input_Context) || !r->TermWin.focus || !(r->h->input_style & XIMPreeditPosition) || !(r->h->event_type == KeyPress || r->h->event_type == Expose || r->h->event_type == NoExpose || r->h->event_type == SelectionNotify || r->h->event_type == ButtonRelease || r->h->event_type == FocusIn) || !rxvt_IM_is_running(r)) return; rxvt_IM_set_position(r, &spot); preedit_attr = XVaCreateNestedList(0, XNSpotLocation, &spot, NULL); XSetICValues(r->h->Input_Context, XNPreeditAttributes, preedit_attr, NULL); XFree(preedit_attr); } /* EXTPROTO */ void rxvt_IM_set_fontset (rxvt_t* r, int idx) { char *string; size_t length; XFontSet prev_fontset; int success = 0; if (idx < 0 || idx >= MAX_NFONTS) return; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_setTermFontSet()\n")); prev_fontset = r->TermWin.fontset; SET_NULL(r->TermWin.fontset); length = 0; if (r->h->rs[Rs_font + idx]) length += STRLEN(r->h->rs[Rs_font + idx]) + 1; # ifdef MULTICHAR_SET if (r->h->rs[Rs_mfont + idx]) length += STRLEN(r->h->rs[Rs_mfont + idx]) + 1; # endif /* possible integer overflow? */ assert (length >= 0 && length+1 > 0); if (length == 0 || IS_NULL(string = rxvt_malloc(length + 1))) SET_NULL(r->TermWin.fontset); else { int missing_charsetcount; char **missing_charsetlist, *def_string; string[0] = '\0'; if (r->h->rs[Rs_font + idx]) { STRCAT(string, r->h->rs[Rs_font + idx]); STRCAT(string, ","); } # ifdef MULTICHAR_SET if (r->h->rs[Rs_mfont + idx]) { STRCAT(string, r->h->rs[Rs_mfont + idx]); STRCAT(string, ","); } # endif string[STRLEN(string) - 1] = '\0'; r->TermWin.fontset = XCreateFontSet(r->Xdisplay, string, &missing_charsetlist, &missing_charsetcount, &def_string); rxvt_free(string); if (NOT_NULL(r->TermWin.fontset)) success = 1; } if (success) { if (NOT_NULL(prev_fontset)) XFreeFontSet(r->Xdisplay, prev_fontset); } else r->TermWin.fontset = prev_fontset; } /* INTPROTO */ void rxvt_IM_change_fontset(rxvt_t* r, int idx) { XVaNestedList preedit_attr, status_attr; rxvt_IM_set_fontset(r, idx); preedit_attr = XVaCreateNestedList(0, XNFontSet, r->TermWin.fontset, XNLineSpace, r->TermWin.fheight, NULL); status_attr = XVaCreateNestedList(0, XNFontSet, r->TermWin.fontset, NULL); XSetICValues(r->h->Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL); XFree(preedit_attr); XFree(status_attr); } /* INTPROTO */ void rxvt_IM_set_preedit_area(rxvt_t* r, XRectangle *preedit_rect, XRectangle *status_rect, XRectangle *needed_rect) { XWindowAttributes xwa; XGetWindowAttributes(r->Xdisplay, AVTS(r)->vt, &xwa); preedit_rect->x = xwa.x + r->TermWin.int_bwidth + needed_rect->width; preedit_rect->y = xwa.y + Row2Pixel(r->TermWin.nrow - 1); preedit_rect->width = Width2Pixel(r->TermWin.ncol) - needed_rect->width; preedit_rect->height = Height2Pixel(1); status_rect->x = xwa.x + r->TermWin.int_bwidth; status_rect->y = xwa.y + Row2Pixel(r->TermWin.nrow - 1); status_rect->width = needed_rect->width ? needed_rect->width : Width2Pixel(r->TermWin.ncol); status_rect->height = Height2Pixel(1); } /* ARGSUSED */ /* INTPROTO */ void rxvt_IM_destroy_callback(XIM xim __attribute__((unused)), XPointer client_data __attribute__((unused)), XPointer call_data __attribute__((unused))) { rxvt_t *r = rxvt_get_r(); SET_NULL(r->h->Input_Context); /* To avoid Segmentation Fault in C locale: Solaris only? */ if (STRCMP(r->h->locale, "C")) XRegisterIMInstantiateCallback(r->Xdisplay, NULL, NULL, NULL, rxvt_IM_init_callback, NULL); } /* * X manual pages and include files don't match on some systems: * some think this is an XIDProc and others an XIMProc so we can't * use the first argument - need to update this to be nice for * both types via some sort of configure detection */ /* ARGSUSED */ /* EXTPROTO */ void rxvt_IM_init_callback (Display *unused __attribute__((unused)), XPointer client_data __attribute__((unused)), XPointer call_data __attribute__((unused))) { int i, found, had_im; const char *p; char **s; rxvt_t *r = rxvt_get_r(); char buf[IMBUFSIZ]; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_IM_init_callback()\n")); if (r->h->Input_Context) return; found = had_im = 0; p = r->h->rs[Rs_inputMethod]; if (p && *p) { had_im = 1; s = rxvt_splitcommastring(p); for (i = 0; s[i]; i++) { if (*s[i]) { STRCPY(buf, "@im="); STRNCAT(buf, s[i], IMBUFSIZ - 5); if (NOT_NULL(p = XSetLocaleModifiers(buf)) && *p && (rxvt_IM_get_IC(r) == True) ) { found = 1; break; } } } for (i = 0; s[i]; i++) rxvt_free(s[i]); rxvt_free(s); } if (found) return; /* try with XMODIFIERS env. var. */ if (NOT_NULL(p = XSetLocaleModifiers("")) && *p) { rxvt_IM_get_IC(r); return; } /* try with no modifiers base IF the user didn't specify an IM */ if (!had_im && NOT_NULL(p = XSetLocaleModifiers("@im=none")) && *p && rxvt_IM_get_IC(r) == True) return; } /* * Try to open a XIM with the current modifiers, then see if we can * open a suitable preedit type */ /* INTPROTO */ Bool rxvt_IM_get_IC(rxvt_t *r) { int i, j, found; XIM xim; XPoint spot; XRectangle rect, status_rect, needed_rect; unsigned long fg, bg; const char *p; char **s; XIMStyles *xim_styles; XVaNestedList preedit_attr, status_attr; XIMCallback ximcallback; struct rxvt_hidden *h = r->h; long im_event_mask = 0; rxvt_dbgmsg ((DBG_VERBOSE, DBG_MAIN, "rxvt_IM_get_IC()\n")); xim = XOpenIM(r->Xdisplay, NULL, NULL, NULL); if (IS_NULL(xim)) { rxvt_msg (DBG_WARN, DBG_MAIN, "Unalbe to open IM\n"); return False; } SET_NULL(xim_styles); if ( XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles || !xim_styles->count_styles ) { XCloseIM(xim); return False; } p = h->rs[Rs_preeditType] ? h->rs[Rs_preeditType] : "OverTheSpot,OffTheSpot,Root"; s = rxvt_splitcommastring(p); for (i = found = 0; !found && s[i]; i++) { if (!STRCMP(s[i], "OverTheSpot")) h->input_style = (XIMPreeditPosition | XIMStatusNothing); else if (!STRCMP(s[i], "OffTheSpot")) h->input_style = (XIMPreeditArea | XIMStatusArea); else if (!STRCMP(s[i], "Root")) h->input_style = (XIMPreeditNothing | XIMStatusNothing); for (j = 0; j < xim_styles->count_styles; j++) if (h->input_style == xim_styles->supported_styles[j]) { found = 1; break; } } for (i = 0; s[i]; i++) rxvt_free(s[i]); rxvt_free(s); XFree(xim_styles); if (!found) { XCloseIM(xim); return False; } ximcallback.callback = rxvt_IM_destroy_callback; /* XXX: not sure why we need this (as well as IC one below) */ XSetIMValues(xim, XNDestroyCallback, &ximcallback, NULL); SET_NULL(preedit_attr); SET_NULL(status_attr); if (h->input_style & XIMPreeditPosition) { rxvt_IM_set_size(r, &rect); rxvt_IM_set_position(r, &spot); rxvt_IM_set_color(r, &fg, &bg); preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, r->TermWin.fontset, XNLineSpace, r->TermWin.fheight, NULL); } else if (h->input_style & XIMPreeditArea) { rxvt_IM_set_color(r, &fg, &bg); /* * The necessary width of preedit area is unknown * until create input context. */ needed_rect.width = 0; rxvt_IM_set_preedit_area(r, &rect, &status_rect, &needed_rect); preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNForeground, fg, XNBackground, bg, XNFontSet, r->TermWin.fontset, NULL); status_attr = XVaCreateNestedList(0, XNArea, &status_rect, XNForeground, fg, XNBackground, bg, XNFontSet, r->TermWin.fontset, NULL); } h->Input_Context = XCreateIC(xim, XNInputStyle, h->input_style, XNClientWindow, r->TermWin.parent, XNFocusWindow, r->TermWin.parent, XNDestroyCallback, &ximcallback, preedit_attr ? XNPreeditAttributes : NULL, preedit_attr, status_attr ? XNStatusAttributes : NULL, status_attr, NULL); if (preedit_attr) XFree(preedit_attr); if (status_attr) XFree(status_attr); if (IS_NULL(h->Input_Context)) { rxvt_msg (DBG_ERROR, DBG_MAIN, "failed to create input context"); XCloseIM(xim); return False; } if (h->input_style & XIMPreeditArea) rxvt_IM_set_status_pos (r); /* this is necessary to avoid crash after XIM quits */ XGetICValues(h->Input_Context, XNFilterEvents, &im_event_mask, NULL); im_event_mask |= (KeyPressMask | StructureNotifyMask | ExposureMask #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) | KeyReleaseMask #endif #ifdef MONITOR_ENTER_LEAVE | EnterWindowMask | LeaveWindowMask #endif | FocusChangeMask | VisibilityChangeMask); XSelectInput(r->Xdisplay, r->TermWin.parent, im_event_mask); rxvt_msg (DBG_INFO, DBG_MAIN, "rxvt_IM_get_IC() - successful connection\n"); return True; } /* INTPROTO */ void rxvt_IM_send_size(rxvt_t* r) { XRectangle size; XVaNestedList preedit_attr; rxvt_IM_set_size(r, &size); preedit_attr = XVaCreateNestedList(0, XNArea, &size, NULL); XSetICValues(r->h->Input_Context, XNPreeditAttributes, preedit_attr, NULL); XFree(preedit_attr); } /* INTPROTO */ void rxvt_IM_set_status_pos (rxvt_t *r) { XRectangle preedit_rect, status_rect, *needed_rect; XVaNestedList preedit_attr, status_attr; /* Getting the necessary width of preedit area */ status_attr = XVaCreateNestedList(0, XNAreaNeeded, &needed_rect, NULL); XGetICValues(r->h->Input_Context, XNStatusAttributes, status_attr, NULL); XFree(status_attr); rxvt_IM_set_preedit_area(r, &preedit_rect, &status_rect, needed_rect); preedit_attr = XVaCreateNestedList(0, XNArea, &preedit_rect, NULL); status_attr = XVaCreateNestedList(0, XNArea, &status_rect, NULL); XSetICValues(r->h->Input_Context, XNPreeditAttributes, preedit_attr, XNStatusAttributes, status_attr, NULL); XFree(preedit_attr); XFree(status_attr); } /* EXTPROTO */ void rxvt_IM_resize(rxvt_t *r) { if (IS_NULL(r->h->Input_Context) || !rxvt_IM_is_running(r)) return; if (r->h->input_style & XIMPreeditPosition) rxvt_IM_send_size(r); else if (r->h->input_style & XIMPreeditArea) rxvt_IM_set_status_pos(r); } #endif /* USE_XIM */ /*----------------------------------------------------------------------*/ static rxvt_t *_rxvt_vars = NULL; /* EXTPROTO */ rxvt_t* rxvt_get_r(void) { return _rxvt_vars; } /* INTPROTO */ void rxvt_set_r(rxvt_t *r) { _rxvt_vars = r; } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/misc.c0000644000175000001440000003443110756127602011516 00000000000000/*--------------------------------*-C-*---------------------------------* * File: misc.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1996 mj olesen * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 1998-2000 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /* EXTPROTO */ char* rxvt_r_basename(const char *str) { char* base = STRRCHR(str, '/'); return (char *)(base ? base + 1 : str); } /* * check that the first characters of S1 match S2 * * No Match * return: 0 * Match * return: STRLEN (S2) */ /* EXTPROTO */ int rxvt_str_match(const char *s1, const char *s2) { if( IS_NULL(s1) || IS_NULL(s2)) return 0; else { int n = STRLEN(s2); return ( (STRNCMP(s1, s2, n) == 0) ? n : 0 ); } } /* EXTPROTO */ const char* rxvt_str_skip_space(const char *str) { if (str) while (*str && isspace((int) *str)) str++; return str; } /* * remove leading/trailing space and strip-off leading/trailing quotes. * in place. */ /* EXTPROTO */ char* rxvt_str_trim(char *str) { char *r, *s; int n; if (!str || !*str) /* shortcut */ return str; /* skip leading spaces */ for (s = str; *s && isspace((int) *s); s++) ; /* goto end of string */ for (n = 0, r = s; *r++; n++) ; r -= 2; /* dump return */ if (n > 0 && *r == '\n') n--, r--; /* backtrack along trailing spaces */ for (; n > 0 && isspace((int) *r); r--, n--) ; /* skip matching leading/trailing quotes */ if( *s == '"' && *r == '"' && n > 1 ) { s++; n -= 2; } /* copy back over: forwards copy */ for (r = str; n; n--) *r++ = *s++; *r = '\0'; return str; } /* * in-place interpretation of string: * * backslash-escaped: "\a\b\E\e\n\r\t", "\octal" * Ctrl chars: ^@ .. ^_, ^? * * returns the converted string length */ /* EXTPROTO */ int rxvt_str_escaped(char *str) { char ch, *s, *d; int i, num; if (IS_NULL(str) || *str == '\0') return 0; d = s = str; /* * 2006-03-23 gi1242: Disabled, as the user has no 'easy' way to send * strings beginning with M-x to mrxvt. * * 2006-05-24 gi1242: With macros, the user has an 'easy' way to send * strings to mrxvt. However emacs users should use emacs macros do do such * things, and not require code bloat in mrxvt for these random features. * Besides, mrxvt users should use Vim anyway ... :) */ #if 0 if (*s == 'M' && s[1] == '-') { /* Emacs convenience, replace leading `M-..' with `\E..' */ *d++ = C0_ESC; s += 2; if (toupper((int) *s) == 'X') /* append carriage-return for `M-xcommand' */ for (*d++ = 'x', append = '\r', s++; isspace((int) *s); s++) ; } #endif for (; (ch = *s++);) { if (ch == '\\') { ch = *s++; if (ch >= '0' && ch <= '7') /* octal */ { num = ch - '0'; for (i = 0; i < 2; i++, s++) { ch = *s; if (ch < '0' || ch > '7') break; num = num * 8 + ch - '0'; } ch = (char)num; } else if (ch == 'a') ch = C0_BEL; /* bell */ else if (ch == 'b') ch = C0_BS; /* backspace */ else if (ch == 'E' || ch == 'e') ch = C0_ESC; /* escape */ else if (ch == 'n') ch = '\n'; /* newline */ else if (ch == 'r') ch = '\r'; /* carriage-return */ else if (ch == 't') ch = C0_HT; /* tab */ else if (ch != '\\' && ch != '^' ) *d++ = '\\'; /* Copy over backslash */ } else if (ch == '^') { ch = *s++; if( ch == '?' ) ch = 127; else if( toupper(ch) >= 'A' && toupper(ch) <= 'Z' ) ch = toupper(ch) - '@'; else *d++ = '^'; /* Copy over caret */ } *d++ = ch; } #if 0 /* Users can terminate their own stinking strings */ /* ESC] is an XTerm escape sequence, must be terminated */ if (*str == '\0' && str[1] == C0_ESC && str[2] == ']') append = CHAR_ST; /* add trailing character as required */ if (append && d[-1] != append) *d++ = append; #endif *d = '\0'; return (d - str); } /* * % interpolate expand src, and copy into dst. Returns length of the * interpolated string. */ /* EXTPROTO */ int rxvt_percent_interpolate( rxvt_t *r, int page, const char *src, int len, char *dst, int maxLen ) { int i=0, /* Unexpanded string index */ j=0; /* Expanded string index */ rxvt_dbgmsg ((DBG_DEBUG, DBG_MISC, "rxvt_percent_interpolate( r, %d, %s, %d, %s, %d )\n", page, src, len, "dst", maxLen)); /* Must only get here for a valid tab */ assert( page >=0 && page <= LTAB(r) ); assert( NOT_NULL( PVTS( r, page ) ) && PVTS( r, page )->vts_idx != -1 ); while( i < len-1 && j < maxLen-1 ) { if( src[i] == '%' ) { switch( src[++i] ) { case '%': /* Copy % over */ dst[j++] = src[i++]; break; case 'n': /* Active tab number */ j += snprintf( dst + j, maxLen - j, "%d", page+1 ); i ++; break; case 't': /* Active tab title */ j += snprintf( dst + j, maxLen -j, "%s", PVTS(r, page)->tab_title ); i ++; break; case 'S': /* Exit status of dead processes */ if( PVTS( r, page )->dead ) j += snprintf( dst + j, maxLen - j, "%d", WEXITSTATUS( PVTS( r, page )->status ) ); else dst[ j++ ] = src[ i ]; i++; break; case 'N': /* Normal / abnormal exit status of dead processes */ if( PVTS( r, page )->dead ) j += snprintf( dst + j, maxLen - j, "%s", WIFEXITED( PVTS( r, page )->status ) ? "normally" : "abnormally" ); else dst[ j++ ] = src[ i ]; i ++; break; case 's': /* * Selection. TODO Also paste selection if it is not * owned by mrxvt. */ if( NOT_NULL( r->selection.text ) ) j += snprintf( dst + j, maxLen -j, "%s", r->selection.text ); i++; break; case 'p': /* Pid of process in current tab */ j += snprintf( dst + j, maxLen - j, "%d", PVTS(r, page)->cmd_pid ); i++; break; case 'P': /* PID of mrxvt */ j += snprintf( dst + j, maxLen - j, "%d", getpid() ); i++; break; case 'G': /* Global tab number (plus 1) */ j += snprintf( dst + j, maxLen - j, "%d", PVTS( r, page )->globalTabNum + 1 ); i ++; break; case 'T': /* # tabs created so far */ j += snprintf( dst + j, maxLen - j, "%d", r->ntabs + 1 ); i ++; break; default: rxvt_msg (DBG_ERROR, DBG_MISC, "Unrecognized flag %%%c in '%s'", src[i++], src ); break; } } else dst[j++] = src[i++]; } /* Copy last char over */ if( i == len-1 && j < maxLen-1 ) dst[j++] = src[i++]; /* NULL terminate dst */ if( j > maxLen - 1 ) j = maxLen - 1; if( j == 0 || dst[j-1] ) dst[j++] = 0; /* % expansion done. Copy the string and length over */ return j; } /* * Split a comma-separated string into an array, stripping leading and * trailing spaces (and paired quotes) from each entry. Empty strings * are properly returned * Caller should free each entry and array when done */ /* EXTPROTO */ char** rxvt_splitcommastring(const char *cs) { int l, n, p; const char *s, *t; char **ret; if( IS_NULL(s = cs)) s = ""; for( n=1, t=s; *t; t++) if (*t == ',') n++; assert (n >= 0 && n+1 > 0); /* possible integer overflow? */ ret = rxvt_malloc( (n + 1) * sizeof(char *) ); ret[n] = NULL; for( l = 0, t = s; l < n; l++ ) { for( ; *t && *t != ','; t++ ); p = t - s; ret[l] = rxvt_malloc(p + 1); STRNCPY(ret[l], s, p); ret[l][p] = '\0'; rxvt_str_trim(ret[l]); s = ++t; } return ret; } /*----------------------------------------------------------------------* * file searching */ #if defined (BACKGROUND_IMAGE) || defined (HAVE_MENUBAR) /* * search for FILE in the current working directory, and within the * colon-delimited PATHLIST, adding the file extension EXT if required. * * FILE is either semi-colon or zero terminated */ /* INTPROTO */ char * rxvt_File_search_path(const char *pathlist, const char *file, const char *ext) { int maxpath, len; const char *p, *path; char name[256]; if (!access(file, R_OK)) /* found (plain name) in current directory */ return STRDUP(file); /* semi-colon delimited */ if ((p = STRCHR(file, ';'))) len = (p - file); else len = STRLEN(file); #ifdef DEBUG getcwd(name, sizeof(name)); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MISC, "pwd: \"%s\"\n", name)); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MISC, "find: \"%.*s\"\n", len, file)); #endif /* leave room for an extra '/' and trailing '\0' */ maxpath = sizeof(name) - (len + (ext ? STRLEN(ext) : 0) + 2); if (maxpath <= 0) return NULL; /* check if we can find it now */ STRNCPY(name, file, len); name[len] = '\0'; if (!access(name, R_OK)) return STRDUP(name); if (ext) { STRCAT(name, ext); if (!access(name, R_OK)) return STRDUP(name); } for (path = pathlist; NOT_NULL(path) && *path != '\0'; path = p) { int n; /* colon delimited */ if (IS_NULL(p = STRCHR(path, ':'))) p = STRCHR(path, '\0'); n = (p - path); if (*p != '\0') p++; if (n > 0 && n <= maxpath) { STRNCPY(name, path, n); if (name[n - 1] != '/') name[n++] = '/'; name[n] = '\0'; STRNCAT(name, file, len); if (!access(name, R_OK)) return STRDUP(name); if (ext) { STRCAT(name, ext); if (!access(name, R_OK)) return STRDUP(name); } } } return NULL; } /* EXTPROTO */ char * rxvt_File_find(const char *file, const char *ext, const char *path) { char *f; if (IS_NULL(file) || *file == '\0') return NULL; do { char *envpath; if ((f = rxvt_File_search_path(path, file, ext))) break; /* * Failed to get the file from arg path. Try getting it from the env * variable PATH_ENV. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_MISC, "Searching for %s from env %s...\n", file, PATH_ENV)); envpath = getenv( PATH_ENV); if( envpath) if(( f = rxvt_File_search_path( envpath, file, ext) )) break; /* * Check in ~/.mrxvt */ rxvt_dbgmsg ((DBG_DEBUG, DBG_MISC, "Searching for %s in ~/.mrxvt\n", file)); envpath = getenv("HOME"); if( envpath ) { char *homepath; homepath = rxvt_malloc( STRLEN(envpath) + STRLEN(PACKAGE_NAME) + 3); sprintf( homepath, "%s/.%s", envpath, PACKAGE_NAME); f = rxvt_File_search_path( homepath, file, ext); rxvt_free( homepath); } if( f ) break; /* * Last resort: Try a compiled in default. */ rxvt_dbgmsg ((DBG_DEBUG, DBG_MISC, "Searching for %s in %s\n", file, PKG_CONF_DIR)); f = rxvt_File_search_path( PKG_CONF_DIR, file, ext); } while(0); rxvt_dbgmsg ((DBG_DEBUG, DBG_MISC, "Got file %s\n", f ? f : "(nil)")); return f; } #endif /* defined (BACKGROUND_IMAGE) || (HAVE_MENUBAR) */ /*----------------------------------------------------------------------* * miscellaneous drawing routines */ # define CHOOSE_GC_FG(DISP, MYGC, PIXCOL) \ XSetForeground ((DISP), (MYGC), (PIXCOL)) /* * Draw top/left and bottom/right border shadows around windows */ #if defined(RXVT_SCROLLBAR) || defined(HAVE_MENUBAR) /* EXTPROTO */ void rxvt_draw_shadow (Display *Xdisplay, Window win, GC gc, unsigned long topShadow, unsigned long botShadow, int x, int y, int w, int h) { int shadow; shadow = (w == 0 || h == 0) ? 1 : SHADOW; w += x - 1; h += y - 1; for (; shadow-- > 0; x++, y++, w--, h--) { CHOOSE_GC_FG(Xdisplay, gc, topShadow); XDrawLine(Xdisplay, win, gc, x, y, w, y); XDrawLine(Xdisplay, win, gc, x, y, x, h); CHOOSE_GC_FG(Xdisplay, gc, botShadow); XDrawLine(Xdisplay, win, gc, w, h, w, y + 1); XDrawLine(Xdisplay, win, gc, w, h, x + 1, h); } } #endif /* button shapes */ #ifdef HAVE_MENUBAR /* EXTPROTO */ void rxvt_draw_triangle( Display *Xdisplay, Window win, GC gc, unsigned long topShadow, unsigned long botShadow, int x, int y, int w, int type) { switch (type) { case 'r': /* right triangle */ CHOOSE_GC_FG(Xdisplay, gc, topShadow); XDrawLine(Xdisplay, win, gc, x, y, x, y + w); XDrawLine(Xdisplay, win, gc, x, y, x + w, y + w / 2); CHOOSE_GC_FG(Xdisplay, gc, botShadow); XDrawLine(Xdisplay, win, gc, x, y + w, x + w, y + w / 2); break; case 'l': /* left triangle */ CHOOSE_GC_FG(Xdisplay, gc, botShadow); XDrawLine(Xdisplay, win, gc, x + w, y + w, x + w, y); XDrawLine(Xdisplay, win, gc, x + w, y + w, x, y + w / 2); CHOOSE_GC_FG(Xdisplay, gc, topShadow); XDrawLine(Xdisplay, win, gc, x, y + w / 2, x + w, y); break; case 'd': /* down triangle */ CHOOSE_GC_FG(Xdisplay, gc, topShadow); XDrawLine(Xdisplay, win, gc, x, y, x + w / 2, y + w); XDrawLine(Xdisplay, win, gc, x, y, x + w, y); CHOOSE_GC_FG(Xdisplay, gc, botShadow); XDrawLine(Xdisplay, win, gc, x + w, y, x + w / 2, y + w); break; case 'u': /* up triangle */ CHOOSE_GC_FG(Xdisplay, gc, botShadow); XDrawLine(Xdisplay, win, gc, x + w, y + w, x + w / 2, y); XDrawLine(Xdisplay, win, gc, x + w, y + w, x, y + w); CHOOSE_GC_FG(Xdisplay, gc, topShadow); XDrawLine(Xdisplay, win, gc, x, y + w, x + w / 2, y); break; } } #endif /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/mjpg.c0000644000175000001440000003642010756127602011520 00000000000000/*--------------------------------*-C-*---------------------------------* * File: mjpg.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1999-2002 Toshikaz Hirabayashi * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef USE_JPEG static void ehandler (j_common_ptr jinf, int level) { } static void exhandler (j_common_ptr jinf) { } static int chandler (j_decompress_ptr jinf) { return TRUE; } long JpegReadFileToPixmap (Display* display, Window window, GC gc, char* filename, Pixmap* pixmap, long* w, long* h) { int red_mask, green_mask, blue_mask; int red_shift, green_shift, blue_shift; int start_shift, msb_flag; unsigned int start_mask, udat; FILE* ifile; XWindowAttributes win_attr; struct jpeg_decompress_struct jinf; struct jpeg_error_mgr jerr; long rwidth, rheight; long vwidth = *w; long vheight = *h; long stretched =0; long components; unsigned char* buf; JSAMPROW rowptr[1]; long display_depth = XDefaultDepth(display,XDefaultScreen(display)); XImage* image = 0; Visual* visual; char* data1; unsigned char r, g, b; long ptr = 0; long ptr2 = 0; long i; long j; Pixmap pix; red_mask = green_mask = blue_mask = 0; red_shift = green_shift = blue_shift = 0; ifile = fopen(filename,"r"); if (ifile == NULL) { return -1; } jinf.err = jpeg_std_error(&jerr); jinf.err->emit_message = ehandler; jinf.err->error_exit = exhandler; jpeg_create_decompress(&jinf); jpeg_set_marker_processor(&jinf,JPEG_COM,chandler); jpeg_stdio_src(&jinf,ifile); jpeg_read_header(&jinf,TRUE); jpeg_calc_output_dimensions(&jinf); jpeg_start_decompress(&jinf); rwidth = jinf.output_width; rheight = jinf.output_height; if (*w == 0 || *h == 0){ *w = rwidth; *h = rheight; } else{ if ((long)((double)rwidth * vheight/vwidth) < rheight){ *w = (long)((double)vheight * rwidth/rheight); } else { *h = (long)((double)vwidth * rheight/rwidth); } stretched = 1; } vwidth = *w; vheight = *h; /* long bpp = jinf.data_precision; */ components = jinf.output_components; /* possible integer overflow */ assert ((int) components > 0); assert ((int) rheight > 0); assert ((int) rwidth > 0); assert (components * rheight * rwidth * sizeof (JSAMPLE) > 0); buf = (unsigned char*)rxvt_malloc(components * rheight * rwidth*sizeof(JSAMPLE)); /*printf("jpg::readjpg w,h=%d,%d c=%d\n",width,height,components); */ for(i=0; i< rheight; i++){ rowptr[0] = (JSAMPROW)&(buf[i * rwidth * components]); jpeg_read_scanlines(&jinf, rowptr,1); } visual = XDefaultVisual(display,XDefaultScreen(display)); if (display_depth >16){ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,32,0); }else if (display_depth >8){ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,16,0); }else{ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,8,0); } msb_flag = (ImageByteOrder(display) == MSBFirst)?1:0; if (XGetWindowAttributes(display, RootWindow(display, DefaultScreen(display)), &win_attr) == 0) { fclose(ifile); rxvt_free(buf); return -1; } if ((win_attr.depth == 24) || (win_attr.depth == 16)) { unsigned int n; if (win_attr.depth == 24) { start_shift = 24; start_mask = 0x80000000; }else{ start_shift = 8; start_mask = 0x8000; } n = start_mask; red_mask = win_attr.visual->red_mask; red_shift = start_shift; while (!(n & red_mask)) { n >>= 1; red_shift--; } green_mask = win_attr.visual->green_mask; green_shift = start_shift; n = start_mask; while (!(n & green_mask)) { n >>= 1; green_shift--; } blue_mask = win_attr.visual->blue_mask; blue_shift = start_shift; n = start_mask; while (!(n & blue_mask)) { n >>= 1; blue_shift--; } } /* possible integer overflow? */ assert ((int)image->bytes_per_line > 0); assert ((int)vheight > 0); assert (((int)image->bytes_per_line) * ((int)vheight) > 0); data1 = rxvt_malloc(image->bytes_per_line * vheight); ptr = 0; ptr2 = 0; if (image->bits_per_pixel ==32){ if (components == 3){ for(i=0; i= 0){ udat |= (((int)r << red_shift) & red_mask); }else{ udat |= (((int)r >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)g << green_shift) & green_mask); }else{ udat |= (((int)g >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)b << blue_shift) & blue_mask); }else{ udat |= (((int)b >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat & 0xff000000)>>24; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff000000)>>24; } } } }else{ for(i=0; ibits_per_pixel == 24){ if (components == 3){ for(i=0; ibytes_per_line; for(j=0; j= 0){ udat |= (((int)r << red_shift) & red_mask); }else{ udat |= (((int)r >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)g << green_shift) & green_mask); }else{ udat |= (((int)g >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)b << blue_shift) & blue_mask); }else{ udat |= (((int)b >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; } } } }else{ for(i=0; ibits_per_pixel ==16){ if (components == 3){ for(i=0; i= 0){ udat |= (((int)rr << red_shift) & red_mask); }else{ udat |= (((int)rr >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)gg << green_shift) & green_mask); }else{ udat |= (((int)gg >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)bb << blue_shift) & blue_mask); }else{ udat |= (((int)bb >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat >> 8) & 0xff; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; } } } }else{ for(i=0; i>3; g = buf[ptr]>>2; b = buf[ptr++]>>3; ((short*)data1)[ptr2++] = r <<11 | g<<5 | b; } } } }else if (image->bits_per_pixel == 8){ /* printf("components=%d\n",components); */ XColor col[5*5*5]; Colormap cm = DefaultColormap(display,DefaultScreen(display)); long k; long cnt=0; long colptr = 0; long rr = 0,gg = 0,bb = 0; long tr1,tg1,tb1; signed char dr1,dg1,db1; for(i=0; i<5; i++){ for(j=0; j<5; j++){ for(k=0; k<5; k++){ if (i != 4){ col[cnt].red = i*64*256; }else{ col[cnt].red = 0xffff; } if (j != 4){ col[cnt].green = j*64*256; }else{ col[cnt].green = 0xffff; } if (k != 4){ col[cnt].blue = k*64*256; }else{ col[cnt].blue = 0xffff; } XAllocColor(display,cm,&(col[cnt])); cnt++; } } } for(i=0; i 31){ rr = (tr1 + 63) & 0x1c0; }else{ rr = tr1 & 0x1c0; } }else if (tr1 + dr1 > 255){ rr = 0x100; }else{ rr = 0; } dr1 += (tr1 - rr); if (0 < tg1 + dg1 &&tg1 + dg1 < 256){ if (-32 < dg1 && dg1 < 32 ){ gg = (tg1 + dg1 + 31) & 0x1c0; }else if (dg1 > 31){ gg = (tg1 + 63) & 0x1c0; }else{ gg = tg1 & 0x1c0; } }else if (tg1 + dg1 > 255){ gg = 0x100; }else{ gg = 0; } dg1 += (tg1 - gg); if (0 < tb1 + db1 && tb1 + db1 < 256){ if (-32 < db1 && db1 < 32){ bb = (tb1 + db1 + 31) & 0x1c0; }else if (db1 > 31){ bb = (tb1 + 63) & 0x1c0; }else{ bb = tb1 & 0x1c0; } }else if (tb1 + db1 > 255){ bb = 0x100; }else{ bb = 0; } db1 += (tb1 - bb); db1 += (tb1 - bb); colptr = (rr>>6)*5*5 + (gg>>6)*5 + (bb>>6); data1[ptr2++] = col[colptr].pixel; } } } image->data = data1; rxvt_free(buf); pix = XCreatePixmap(display,window, vwidth,vheight,display_depth); *pixmap = pix; XPutImage(display,pix,gc,image,0,0,0,0,vwidth,vheight); jpeg_finish_decompress(&jinf); jpeg_destroy_decompress(&jinf); if (image->data != NULL){ rxvt_free(image->data); image->data = NULL; } XDestroyImage(image); fclose(ifile); return 0; } #endif /* USE_JPEG */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/mpng.c0000644000175000001440000004275010756127602011527 00000000000000/*--------------------------------*-C-*---------------------------------* * File: mpng.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1999-2002 Toshikaz Hirabayashi * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef USE_PNG static void png_cexcept_error (png_structp png_ptr, png_const_charp msg) { if(png_ptr){ rxvt_msg (DBG_ERROR, DBG_IMAGES, "png file read error: %s\n", msg); } } long PngReadFileToPixmap (Display* display, Window window, GC gc, char* filename, Pixmap* pixmap, long* w, long* h) { int red_mask, green_mask, blue_mask; int red_shift, green_shift, blue_shift; int start_shift, msb_flag; unsigned int start_mask, udat; XWindowAttributes win_attr; FILE* ifile; long display_depth; png_byte sig[8]; png_infop info_ptr; png_structp png_ptr; png_uint_32 png_width; png_uint_32 png_height; int png_depth; int png_color_type; png_uint_32 png_row_bytes; png_uint_32 png_channels; long rwidth; long rheight; long components; unsigned char* buf; png_byte** png_row_ptrs; long vwidth; long vheight; long stretched; XImage* image; Visual* visual; Pixmap pix; int i; char* data1; unsigned char r,g,b; long ptr = 0; long ptr2 = 0; long j; red_mask = green_mask = blue_mask = 0; red_shift = green_shift = blue_shift = 0; ifile = fopen(filename,"r"); if (ifile == NULL){ return -1; } display_depth = XDefaultDepth(display,XDefaultScreen(display)); fread(sig, 1, 8, ifile); if (!png_check_sig(sig, 8)){ fclose(ifile); return -1; } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, (png_error_ptr)png_cexcept_error, (png_error_ptr)NULL); if (png_ptr == NULL){ fclose(ifile); return -1; } info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL){ png_destroy_read_struct(&png_ptr, NULL, NULL); fclose(ifile); return -1; } png_init_io(png_ptr, ifile); png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); png_get_IHDR(png_ptr, info_ptr, &png_width, &png_height, &png_depth, &png_color_type, NULL, NULL, NULL); if (png_depth == 16){ png_set_strip_16(png_ptr); } png_row_bytes = png_get_rowbytes(png_ptr, info_ptr); png_channels = png_get_channels(png_ptr, info_ptr); if (png_depth < 8){ if (png_color_type == PNG_COLOR_TYPE_GRAY ){ png_set_gray_1_2_4_to_8(png_ptr); png_row_bytes = png_width; }else{ png_set_expand(png_ptr); png_row_bytes = png_width; png_row_bytes = png_width * 3; png_channels = 3; } } if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)){ png_set_expand(png_ptr); png_row_bytes = png_width; } if (png_color_type == PNG_COLOR_TYPE_GRAY || png_color_type == PNG_COLOR_TYPE_GRAY_ALPHA){ png_set_gray_to_rgb(png_ptr); png_row_bytes = png_width; } if (png_color_type == PNG_COLOR_TYPE_PALETTE){ png_set_palette_to_rgb(png_ptr); png_row_bytes = png_width * 3; png_channels = 3; } rwidth = png_width; rheight = png_height; components = png_channels; /* possible integer overflow? */ assert ((int) png_row_bytes > 0); assert ((int) png_height > 0); assert (((int)png_row_bytes) * ((int)png_height) * sizeof(png_byte) > 0); buf = rxvt_malloc(png_row_bytes * png_height * sizeof(png_byte)); if (buf == NULL){ rxvt_msg (DBG_ERROR, DBG_IMAGES, "png read error: out of memory..\n"); png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(ifile); return -1; } /* possible integer overflow? */ assert ((int) png_height > 0); assert (sizeof(png_bytep) * ((int)png_height) > 0); png_row_ptrs = rxvt_malloc (sizeof(png_bytep)*png_height); if (png_row_ptrs == NULL){ rxvt_msg (DBG_ERROR, DBG_IMAGES, "png read error: out of memory..\n"); png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(ifile); return -1; } for(i = 0; i < (int)png_height; i++){ png_row_ptrs[i] = (png_byte*)(buf + i * png_row_bytes); } png_read_image(png_ptr, png_row_ptrs); png_read_end(png_ptr,NULL); rxvt_free(png_row_ptrs); vwidth = *w; vheight = *h; stretched =0; if (*w == 0 || *h == 0){ *w = rwidth; *h = rheight; }else{ if ((long)((double)rwidth * vheight/vwidth) < rheight){ *w = (long)((double)vheight * rwidth/rheight); }else{ *h = (long)((double)vwidth * rheight/rwidth); } stretched = 1; } vwidth = *w; vheight = *h; image = 0; visual = XDefaultVisual(display,XDefaultScreen(display)); if (display_depth >16){ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,32,0); }else if (display_depth >8){ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,16,0); }else{ image = XCreateImage(display,visual, display_depth, ZPixmap,0,0,vwidth,vheight,8,0); } msb_flag = (ImageByteOrder(display) == MSBFirst)?1:0; if (XGetWindowAttributes(display, RootWindow(display, DefaultScreen(display)), &win_attr) == 0) { fclose(ifile); return -1; } if ((win_attr.depth == 24) || (win_attr.depth == 16)) { unsigned int n; if (win_attr.depth == 24) { start_shift = 24; start_mask = 0x80000000; }else{ start_shift = 8; start_mask = 0x8000; } red_mask = win_attr.visual->red_mask; red_shift = start_shift; n = start_mask; while (!(n & red_mask)) { n >>= 1; red_shift--; } green_mask = win_attr.visual->green_mask; green_shift = start_shift; n = start_mask; while (!(n & green_mask)) { n >>= 1; green_shift--; } blue_mask = win_attr.visual->blue_mask; blue_shift = start_shift; n = start_mask; while (!(n & blue_mask)) { n >>= 1; blue_shift--; } } /* possible integer overflow? */ assert ((int) image->bytes_per_line > 0); assert ((int) vheight > 0); assert (((int)image->bytes_per_line) * ((int)vheight) > 0); data1 = rxvt_malloc(image->bytes_per_line * vheight); if (image->bits_per_pixel ==32){ if (components == 3 || components == 4){ for(i=0; i= 0){ udat |= (((int)r << red_shift) & red_mask); }else{ udat |= (((int)r >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)g << green_shift) & green_mask); }else{ udat |= (((int)g >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)b << blue_shift) & blue_mask); }else{ udat |= (((int)b >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat & 0xff000000)>>24; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff000000)>>24; } } } }else{ for(i=0; ibits_per_pixel == 24){ if (components == 3 || components == 4){ for(i=0; ibytes_per_line; for(j=0; j= 0){ udat |= (((int)r << red_shift) & red_mask); }else{ udat |= (((int)r >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)g << green_shift) & green_mask); }else{ udat |= (((int)g >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)b << blue_shift) & blue_mask); }else{ udat |= (((int)b >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; ((unsigned char*)data1)[ptr2++] = (udat & 0xff0000)>>16; } } } }else{ for(i=0; ibits_per_pixel ==16){ if (components == 3 || components == 4){ for(i=0; i= 0){ udat |= (((int)rr << red_shift) & red_mask); }else{ udat |= (((int)rr >> (-red_shift)) & red_mask); } if (green_shift >= 0){ udat |= (((int)gg << green_shift) & green_mask); }else{ udat |= (((int)gg >> (-green_shift)) & green_mask); } if (blue_shift >= 0){ udat |= (((int)bb << blue_shift) & blue_mask); }else{ udat |= (((int)bb >> (-blue_shift)) & blue_mask); } if (msb_flag){ ((unsigned char*)data1)[ptr2++] = (udat >> 8) & 0xff; ((unsigned char*)data1)[ptr2++] = (udat & 0xff); }else{ ((unsigned char*)data1)[ptr2++] = (udat & 0xff); ((unsigned char*)data1)[ptr2++] = (udat & 0xff00)>>8; } } } }else{ for(i=0; i>3; g = buf[ptr]>>2; b = buf[ptr++]>>3; ((short*)data1)[ptr2++] = r <<11 | g<<5 | b; } } } }else if (image->bits_per_pixel == 8){ /* printf("components=%d\n",components); */ XColor col[5*5*5]; Colormap cm = DefaultColormap(display,DefaultScreen(display)); long k; long cnt=0; long colptr = 0; long rr = 0,gg = 0,bb = 0; long tr1,tg1,tb1; signed char dr1,dg1,db1; for(i=0; i<5; i++){ for(j=0; j<5; j++){ for(k=0; k<5; k++){ if (i != 4){ col[cnt].red = i*64*256; }else{ col[cnt].red = 0xffff; } if (j != 4){ col[cnt].green = j*64*256; }else{ col[cnt].green = 0xffff; } if (k != 4){ col[cnt].blue = k*64*256; }else{ col[cnt].blue = 0xffff; } XAllocColor(display,cm,&(col[cnt])); cnt++; } } } for(i=0; i 31){ rr = (tr1 + 63) & 0x1c0; }else{ rr = tr1 & 0x1c0; } }else if (tr1 + dr1 > 255){ rr = 0x100; }else{ rr = 0; } dr1 += (tr1 - rr); if (0 < tg1 + dg1 &&tg1 + dg1 < 256){ if (-32 < dg1 && dg1 < 32 ){ gg = (tg1 + dg1 + 31) & 0x1c0; }else if (dg1 > 31){ gg = (tg1 + 63) & 0x1c0; }else{ gg = tg1 & 0x1c0; } }else if (tg1 + dg1 > 255){ gg = 0x100; }else{ gg = 0; } dg1 += (tg1 - gg); if (0 < tb1 + db1 && tb1 + db1 < 256){ if (-32 < db1 && db1 < 32){ bb = (tb1 + db1 + 31) & 0x1c0; }else if (db1 > 31){ bb = (tb1 + 63) & 0x1c0; }else{ bb = tb1 & 0x1c0; } }else if (tb1 + db1 > 255){ bb = 0x100; }else{ bb = 0; } db1 += (tb1 - bb); db1 += (tb1 - bb); colptr = (rr>>6)*5*5 + (gg>>6)*5 + (bb>>6); data1[ptr2++] = col[colptr].pixel; } } } image->data = data1; rxvt_free(buf); pix = XCreatePixmap(display,window, vwidth,vheight,display_depth); *pixmap = pix; XPutImage(display,pix,gc,image,0,0,0,0,vwidth,vheight); if (image->data != NULL){ rxvt_free(image->data); image->data = NULL; } XDestroyImage(image); png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(ifile); return 0; } #endif /* USE_PNG */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/pixmap.c0000644000175000001440000003042610756127602012061 00000000000000/*--------------------------------*-C-*---------------------------------* * File: pixmap.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997 Carsten Haitzler * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 1998-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef BACKGROUND_IMAGE /*--------------------------------------------------------------------* * BEGIN `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ void rxvt_pixmap_incr (unsigned int*, unsigned int*, float*, float*, unsigned int, unsigned int); /*--------------------------------------------------------------------* * END `INTERNAL' ROUTINE PROTOTYPES * *--------------------------------------------------------------------*/ /* * These GEOM strings indicate absolute size/position: * @ `WxH+X+Y' * @ `WxH+X' -> Y = X * @ `WxH' -> Y = X = 50 * @ `W+X+Y' -> H = W * @ `W+X' -> H = W, Y = X * @ `W' -> H = W, X = Y = 50 * @ `0xH' -> H *= H/100, X = Y = 50 (W unchanged) * @ `Wx0' -> W *= W/100, X = Y = 50 (H unchanged) * @ `=+X+Y' -> (H, W unchanged) * @ `=+X' -> Y = X (H, W unchanged) * * These GEOM strings adjust position relative to current position: * @ `+X+Y' * @ `+X' -> Y = X * * And this GEOM string is for querying current scale/position: * @ `?' */ /* EXTPROTO */ int rxvt_scale_pixmap(rxvt_t *r, int page, const char *geom) { int flags, changed = 0; int x = 0, y = 0; unsigned int w = 0, h = 0; unsigned int n; char *p, *str; bgPixmap_t *bgpixmap = &(PVTS(r, page)->bg); #define MAXLEN_GEOM sizeof("[1000x1000+1000+1000]") if (geom == NULL) return 0; str = rxvt_malloc(MAXLEN_GEOM + 1); if (!STRCMP(geom, "?")) { sprintf(str, "[%dx%d+%d+%d]", /* can't presume snprintf() ! */ min(bgpixmap->w, 9999), min(bgpixmap->h, 9999), min(bgpixmap->x, 9999), min(bgpixmap->y, 9999)); rxvt_xterm_seq(r, page, XTerm_title, str, CHAR_ST); rxvt_free(str); return 0; } if ((p = STRCHR(geom, ';')) == NULL) p = STRCHR(geom, '\0'); n = (p - geom); if (n <= MAXLEN_GEOM) { STRNCPY(str, geom, n); str[n] = '\0'; flags = XParseGeometry(str, &x, &y, &w, &h); if (!flags) { flags |= WidthValue; w = 0; } /* default is tile */ if (flags & WidthValue) { if (!(flags & XValue)) x = 50; if (!(flags & HeightValue)) h = w; if (w && !h) { w = (bgpixmap->w * w) / 100; h = bgpixmap->h; } else if (h && !w) { w = bgpixmap->w; h = (bgpixmap->h * h) / 100; } if (w > 1000) w = 1000; if (h > 1000) h = 1000; if (bgpixmap->w != (short)w) { bgpixmap->w = (short)w; changed++; } if (bgpixmap->h != (short)h) { bgpixmap->h = (short)h; changed++; } } if (!(flags & YValue)) { if (flags & XNegative) flags |= YNegative; y = x; } if (!(flags & WidthValue) && geom[0] != '=') { x += bgpixmap->x; y += bgpixmap->y; } else { if (flags & XNegative) x += 100; if (flags & YNegative) y += 100; } MIN_IT(x, 100); MIN_IT(y, 100); MAX_IT(x, 0); MAX_IT(y, 0); if (bgpixmap->x != x) { bgpixmap->x = x; changed++; } if (bgpixmap->y != y) { bgpixmap->y = y; changed++; } } rxvt_free(str); return changed; } /* EXTPROTO */ void rxvt_resize_pixmap(rxvt_t *r, int page) { XGCValues gcvalue; GC gc; unsigned int width = VT_WIDTH(r); unsigned int height = VT_HEIGHT(r); if (IS_PIXMAP(PVTS(r, page)->pixmap)) XFreePixmap(r->Xdisplay, PVTS(r, page)->pixmap); if (NOT_PIXMAP(PVTS(r, page)->bg.pixmap)) /* So be it: I'm not using pixmaps */ return; gcvalue.foreground = r->pixColorsFocus[Color_bg]; gc = XCreateGC(r->Xdisplay, PVTS(r, page)->vt, GCForeground, &gcvalue); if (IS_GC(gc) && IS_PIXMAP(PVTS(r, page)->bg.pixmap)) { /* we have a specified pixmap */ unsigned int w = PVTS(r, page)->bg.w; unsigned int h = PVTS(r, page)->bg.h; unsigned int x = PVTS(r, page)->bg.x; unsigned int y = PVTS(r, page)->bg.y; unsigned int xpmh = PVTS(r, page)->xpm_attr.height; unsigned int xpmw = PVTS(r, page)->xpm_attr.width; unsigned int pixmapw, pixmaph; /* * don't zoom pixmap too much nor expand really small pixmaps */ if (w > 1000 || h > 1000) w = 1; else if (width > (10 * xpmw) || height > (10 * xpmh)) w = 0; /* tile */ if (w == 0) { /* basic X tiling - let the X server do it */ PVTS(r, page)->pixmap = XCreatePixmap(r->Xdisplay, PVTS(r, page)->vt, xpmw, xpmh, (unsigned int)XDEPTH); XCopyArea(r->Xdisplay, PVTS(r, page)->bg.pixmap, PVTS(r, page)->pixmap, gc, 0, 0, xpmw, xpmh, 0, 0); pixmapw = xpmw; pixmaph = xpmh; } else { float incr, p; Pixmap tmp; PVTS(r, page)->pixmap = XCreatePixmap(r->Xdisplay, PVTS(r, page)->vt, width, height, (unsigned int)XDEPTH); /* horizontal scaling */ rxvt_pixmap_incr(&w, &x, &incr, &p, width, xpmw); tmp = XCreatePixmap(r->Xdisplay, PVTS(r, page)->vt, width, xpmh, (unsigned int)XDEPTH); XFillRectangle(r->Xdisplay, tmp, gc, 0, 0, width, xpmh); for ( /*nil */ ; x < w; x++, p += incr) { if (p >= xpmw) p = 0; /* copy one column from the original pixmap to the ** tmp pixmap */ XCopyArea(r->Xdisplay, PVTS(r, page)->bg.pixmap, tmp, gc, (int)p, 0, 1, xpmh, (int)x, 0); } /* vertical scaling */ rxvt_pixmap_incr(&h, &y, &incr, &p, height, xpmh); if (y > 0) XFillRectangle(r->Xdisplay, PVTS(r, page)->pixmap, gc, 0, 0, width, y); if (h < height) XFillRectangle(r->Xdisplay, PVTS(r, page)->pixmap, gc, 0, (int)h, width, height - h + 1); for ( /*nil */ ; y < h; y++, p += incr) { if (p >= xpmh) p = 0; /* copy one row from the tmp pixmap to the main ** pixmap */ XCopyArea(r->Xdisplay, tmp, PVTS(r, page)->pixmap, gc, 0, (int)p, width, 1, 0, (int)y); } XFreePixmap(r->Xdisplay, tmp); pixmapw = width; pixmaph = height; } #ifdef TINTING_SUPPORT # ifdef HAVE_LIBXRENDER xrenderShadeParentPixmap( r, PVTS(r, page)->pixmap, 0, 0, pixmapw, pixmaph, False); # else rxvt_shade_pixmap( r, PVTS(r, page)->pixmap, 0, 0, pixmapw, pixmaph); # endif #endif /* TINTING_SUPPORT */ /* Free gc */ XFreeGC(r->Xdisplay, gc); } XSetWindowBackgroundPixmap(r->Xdisplay, PVTS(r, page)->vt, PVTS(r, page)->pixmap); # ifdef TRANSPARENT r->h->am_transparent = 0; r->h->am_pixmap_trans = 0; # endif XClearWindow(r->Xdisplay, PVTS(r, page)->vt); XSync(r->Xdisplay, False); } /* * Calculate tiling sizes and increments * At start, p == 0, incr == xpmwidthheight */ /* INTPROTO */ void rxvt_pixmap_incr(unsigned int *wh, unsigned int *xy, float *incr, float *p, unsigned int widthheight, unsigned int xpmwidthheight) { unsigned int cwh, cxy; float cincr, cp; cp = 0; cincr = (float)xpmwidthheight; cxy = *xy; cwh = *wh; if (cwh == 1) { /* display one image, no horizontal/vertical scaling */ cincr = (float)widthheight; if (xpmwidthheight <= widthheight) { cwh = xpmwidthheight; cxy = (cxy * (widthheight - cwh)) / 100; /* beware! order */ cwh += cxy; } else { cxy = 0; cwh = widthheight; } } else if (cwh < 10) { /* fit WH images across/down screen */ cincr *= cwh; cxy = 0; cwh = widthheight; } else { cincr *= 100.0 / cwh; if (cwh < 100) { /* contract */ float pos; cwh = (cwh * widthheight) / 100; pos = (float)cxy / 100 * widthheight - (cwh / 2); cxy = (widthheight - cwh); if (pos <= 0) cxy = 0; else if (pos < cxy) cxy = pos; cwh += cxy; } else { /* expand */ if (cxy > 0) { /* position */ float pos; pos = (float)cxy / 100 * xpmwidthheight - (cincr / 2); cp = xpmwidthheight - cincr; if (pos <= 0) cp = 0; else if (pos < cp) cp = pos; } cxy = 0; cwh = widthheight; } } cincr /= widthheight; *wh = cwh; *xy = cxy; *incr = cincr; *p = cp; } /* EXTPROTO */ Pixmap rxvt_load_bg_pixmap(rxvt_t *r, int page, const char *file) { Pixmap pixmap; long w = 0, h = 0; assert(file != NULL); pixmap = rxvt_load_pixmap (r, file, &w, &h); if (IS_PIXMAP(PVTS(r, page)->bg.pixmap)) XFreePixmap (r->Xdisplay, PVTS(r, page)->bg.pixmap); PVTS(r, page)->bg.pixmap = pixmap; if( NOT_PIXMAP(pixmap) ) { if( page == ATAB(r) ) { /* Force resetting the background color */ r->fgbg_tabnum = -1; rxvt_set_vt_colors( r, page ); } return None; } PVTS(r, page)->xpm_attr.closeness = 30000; PVTS(r, page)->xpm_attr.colormap = XCMAP; PVTS(r, page)->xpm_attr.visual = XVISUAL; PVTS(r, page)->xpm_attr.depth = XDEPTH; PVTS(r, page)->xpm_attr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | XpmDepth | XpmSize | XpmReturnPixels); PVTS(r, page)->xpm_attr.width = w; PVTS(r, page)->xpm_attr.height = h; rxvt_resize_pixmap(r, page); return (pixmap); } /* EXTPROTO */ Pixmap rxvt_load_pixmap(rxvt_t *r, const char *file, long* pwidth, long* pheight) { char* f; int flen; #if defined(USE_JPEG) || defined(USE_PNG) long w = 0, h = 0; #endif XpmAttributes xpm_attr; Pixmap pixmap; UNSET_PIXMAP(pixmap); assert(file != NULL); if ((char) 0 == *file) { /* No file to load */ return None; } xpm_attr.closeness = 30000; xpm_attr.colormap = XCMAP; xpm_attr.visual = XVISUAL; xpm_attr.depth = XDEPTH; xpm_attr.valuemask = (XpmCloseness | XpmColormap | XpmVisual | XpmDepth | XpmSize | XpmReturnPixels); /* search environment variables here too */ if (NULL == (f = (char*) rxvt_File_find (file, ".xpm", r->h->rs[Rs_path])) #ifdef USE_JPEG && NULL == (f = (char*) rxvt_File_find (file, ".jpg", r->h->rs[Rs_path])) && NULL == (f = (char*) rxvt_File_find (file, ".jpeg", r->h->rs[Rs_path])) #endif #ifdef USE_PNG && NULL == (f = (char*) rxvt_File_find (file, ".png", r->h->rs[Rs_path])) #endif ) { char *p; /* semi-colon delimited */ if (NULL == (p = STRCHR(file, ';'))) p = STRCHR(file, '\0'); rxvt_msg (DBG_ERROR, DBG_PIXMAP, "couldn't load image file \"%.*s\"", (p - file), file); return None; } flen = STRLEN (f); #ifdef USE_JPEG if ((flen >= 4 && !STRNCASECMP (f+flen-4, ".jpg", 4)) || (flen >= 5 && !STRNCASECMP (f+flen-5, ".jpeg",5))) { GC gc = DefaultGC (r->Xdisplay, XSCREEN); if (!JpegReadFileToPixmap (r->Xdisplay, XROOT, gc, f, &pixmap, &w, &h)) { *pwidth = w; *pheight = h; } } else #endif #ifdef USE_PNG if (flen >= 4 && !STRNCASECMP (f+flen-4, ".png", 4)) { GC gc = DefaultGC (r->Xdisplay, XSCREEN); if (!PngReadFileToPixmap (r->Xdisplay, XROOT, gc, f, &pixmap, &w, &h)) { *pwidth = w; *pheight = h; } } else #endif #ifdef HAVE_LIBXPM if (!XpmReadFileToPixmap(r->Xdisplay, XROOT, f, &pixmap, NULL, &xpm_attr)) { *pwidth = xpm_attr.width; *pheight = xpm_attr.height; } #endif { /* empty to suppress compile error */ } rxvt_free(f); if (NOT_PIXMAP(pixmap)) { char *p; /* semi-colon delimited */ if ((p = STRCHR(file, ';')) == NULL) p = STRCHR(file, '\0'); rxvt_msg (DBG_ERROR, DBG_PIXMAP, "couldn't load image file \"%.*s\"", (p - file), file); } return (pixmap); } #endif /* BACKGROUND_IMAGE */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/rxvt.c0000644000175000001440000000442510756127602011566 00000000000000/*--------------------------------*-C-*---------------------------------* * File: rxvt.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ /* main() */ /* INTPROTO */ int main(int argc, const char *const *argv) { rxvt_t* rxvt_vars; /* * Save and then give up any super-user privileges immediately after program * starts. If we need privileges in any area then we must specifically * request it. * * We should only need to be root in these cases: * * 1. write utmp entries on some systems * 2. chown tty on some systems */ rxvt_privileges(SAVE); rxvt_privileges(IGNORE); /* * Initialize debug level and debug mask. Must do it first in order * to debug memory management system. */ rxvt_parse_dbg_arguments (argc, argv); #ifdef OUR_MALLOC /* initialize our memory management system */ rxvt_mem_init (); #endif if ((rxvt_vars = rxvt_init(argc, argv)) == NULL) return EXIT_FAILURE; rxvt_main_loop(rxvt_vars); /* main processing loop */ #ifdef OUR_MALLOC rxvt_mem_exit (); #endif return EXIT_SUCCESS; } /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/rxvt.h0000644000175000001440000014256011045531257011573 00000000000000/*--------------------------------*-H-*---------------------------------* * File: rxvt.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2003-2004 Marc Lehmann * Copyright (c) 2004 Terry Griffin * Copyright (c) 2005 Teun Burgers * Copyright (c) 2004-2005 Jingmin Zhou * Copyright (c) 2005-2006 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __RXVT_H__ /* include once only */ #define __RXVT_H__ #include "../config.h" #include "feature.h" /* ***************************************************************************** * SYSTEM HACKS ***************************************************************************** */ /* Consistent defines - please report on the necessity * @ Unixware: defines (__svr4__) */ #if defined (SVR4) && !defined (OS_SVR4) # define OS_SVR4 #endif /* #if defined (sun) && !defined (__sun__) # define __sun__ #endif */ #ifdef _SCO_DS # define ALL_NUMERIC_PTYS #endif #include #include #include #include #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_ASSERT_H # include #endif #ifdef HAVE_STDARG_H # include #endif #ifdef HAVE_STDLIB_H # include #endif #if defined(HAVE_STRING_H) && !defined(OUR_STRINGS) # include #endif #ifdef HAVE_LIMITS_H # include #endif #ifdef HAVE_WCHAR_H # if defined(OS_OPENBSD) && (OS_OPENBSD_REL < 39) typedef unsigned int _our_wint_t; typedef struct { int __count; union { _our_wint_t __wch; char __wchb[4] } __value; } mbstate_t; # endif /* defined(OS_OPENBSD) &&... */ # include #endif #ifdef HAVE_FCNTL_H # include #endif #if defined(OS_SOLARIS) && defined(__SVR4) # include #endif #ifdef OS_SOLARIS # include #endif #ifdef OS_SOLARIS # include # undef HAVE_SYS_IOCTL_H #endif #ifdef HAVE_SYS_IOCTL_H # include #endif #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_SYS_SOCKIO_H # include #endif #if defined(PTYS_ARE_PTMX) && defined(HAVE_SYS_STROPTS_H) # include /* for I_PUSH */ #endif #if defined(PTYS_ARE_PTMX) && !defined(OS_CYGWIN) # include # define _NEW_TTY_CTRL /* get proper definition in */ #endif #ifdef HAVE_TIME_H # include #endif #ifdef HAVE_SYS_TIME_H # include #endif #ifdef HAVE_SYS_TIMES_H # include #endif #ifdef HAVE_SYS_STRREDIR_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif #ifdef HAVE_SYS_WAIT_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef HAVE_ARPA_INET_H # include #endif #ifdef HAVE_NETINET_IN_H # include #endif #ifdef HAVE_NET_IF_H # include #endif #ifdef HAVE_NET_IF_ARP_H # include #endif #ifdef HAVE_PTY_H # include #endif #ifdef OS_DARWIN # include #endif #ifdef OS_QNX # include # include # define ut_name ut_user #endif #ifdef TTY_GID_SUPPORT # include #endif #ifdef HAVE_TERMIOS_H # include typedef struct termios ttymode_t; #else # ifdef HAVE_SGTTY_H # include # endif typedef struct { struct sgttyb sg; struct tchars tc; struct ltchars lc; int line; int local; } ttymode_t; #endif # include # include # include # include # include # include # include # include # include # include /* * We really should include openmotif-X.X/Xm/MwmUtil.h, but that will add * openmotif as a dependency. We dont' really need it, except to set WM hints, * thus this ugly hack. */ typedef struct { int flags; int functions; int decorations; int input_mode; int status; } MWMHints; # ifdef HAVE_X11_SM_SMLIB_H # include # endif /* Macros to check X Window IDs. Notice that we can use only one macro ** to check all different type of IDs such as Window and Pixmap. But it ** lose the point that we can possibly check the type of those IDs. */ #undef IS_WIN #undef NOT_WIN #undef UNSET_WIN #define IS_WIN(WINDOW_ID) \ (None != (WINDOW_ID)) #define NOT_WIN(WINDOW_ID) \ (None == (WINDOW_ID)) #define UNSET_WIN(WINDOW_ID) \ ((WINDOW_ID) = None) #undef IS_PIXMAP #undef NOT_PIXMAP #undef UNSET_PIXMAP #define IS_PIXMAP(PIXMAP_ID) \ (None != (PIXMAP_ID)) #define NOT_PIXMAP(PIXMAP_ID) \ (None == (PIXMAP_ID)) #define UNSET_PIXMAP(PIXMAP_ID) \ ((PIXMAP_ID) = None) #undef IS_ATOM #undef NOT_ATOM #undef UNSET_ATOM #define IS_ATOM(ATOM_ID) \ (None != (ATOM_ID)) #define NOT_ATOM(ATOM_ID) \ (None == (ATOM_ID)) #define UNSET_ATOM(ATOM_ID) \ ((ATOM_ID) = None) #undef IS_GC #undef NOT_GC #undef UNSET_GC #define IS_GC(GC_ID) \ (None != (GC_ID)) #define NOT_GC(GC_ID) \ (None == (GC_ID)) #define UNSET_GC(GC_ID) \ ((GC_ID) = None) #undef IS_CURSOR #undef NOT_CURSOR #undef UNSET_CURSOR #define IS_CURSOR(CURSOR_ID) \ (None != (CURSOR_ID)) #define NOT_CURSOR(CURSOR_ID) \ (None == (CURSOR_ID)) #define UNSET_CURSOR(CURSOR_ID) \ ((CURSOR_ID) = None) #undef IS_REGION #undef NOT_REGION #undef UNSET_REGION #define IS_REGION(REGION_ID) \ (None != (REGION_ID)) #define NOT_REGION(REGION_ID) \ (None == (REGION_ID)) #define UNSET_REGION(REGION_ID) \ ((REGION_ID) = None) #undef IS_KEYSYM #undef NOT_KEYSYM #undef UNSET_KEYSYM #define IS_KEYSYM(KEYSYM_ID) \ (None != (KEYSYM_ID)) #define NOT_KEYSYM(KEYSYM_ID) \ (None == (KEYSYM_ID)) #define UNSET_KEYSYM(KEYSYM_ID) \ ((KEYSYM_ID) = None) #ifndef HAVE_XPOINTER typedef char* XPointer; #endif #ifdef HAVE_LIBXPM # include #endif #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) # ifdef USE_JPEG # include # endif # ifdef USE_PNG # ifdef OS_OPENBSD # include # else # include # endif /* OS_OPENBSD */ # endif /* USE_PNG */ #endif #ifdef HAVE_LIBXRENDER # include #endif /* Xft.h seems to conflict with png.h. So we must include it ** after pnt.h */ # ifdef XFT_SUPPORT # include # endif # ifdef HAVE_ICONV_H # include # endif /* ** It seems Mac OS X's fontconfig does not have following definitions */ #ifdef XFT_SUPPORT # ifndef FC_WIDTH # define FC_WIDTH "width" # define FC_WIDTH_ULTRACONDENSED (50) # define FC_WIDTH_EXTRACONDENSED (63) # define FC_WIDTH_CONDENSED (75) # define FC_WIDTH_SEMICONDENSED (87) # define FC_WIDTH_NORMAL (100) # define FC_WIDTH_SEMIEXPANDED (113) # define FC_WIDTH_EXPANDED (125) # define FC_WIDTH_EXTRAEXPANDED (150) # define FC_WIDTH_ULTRAEXPANDED (200) # endif #endif #ifdef HAVE_XSETLOCALE # define X_LOCALE # include #else # ifdef HAVE_LOCALE_H # include # endif #endif #ifdef HAVE_NL_LANGINFO # include #endif #ifdef UTMP_SUPPORT # ifdef UTEMPTER_SUPPORT # include # endif # ifdef HAVE_UTMP_H # include # ifdef HAVE_SETUTENT # define RXVT_UTMP_SYSV # endif # endif # if defined(HAVE_UTMPX_H) && !defined(HAVE_UTMP_H) # include # define RXVT_UTMP_SYSV # endif # ifdef HAVE_LASTLOG_H # include # endif #endif #if defined(UTMP_SUPPORT) || defined(HAVE_GETPWUID) # include #endif #ifdef UTMP_SUPPORT # if defined(HAVE_UTMPX_H) && !defined(HAVE_UTMP_H) # define UTMP_FILENAME UTMPX_FILE # endif # if !defined(UTMP_FILE) && defined(_PATH_UTMP) # define UTMP_FILE _PATH_UTMP # endif # if !defined(UTMP_FILENAME) && defined(UTMP_FILE) # define UTMP_FILENAME UTMP_FILE # endif # define RXVT_UTMP_FILE UTMP_FILENAME #endif #ifdef WTMP_SUPPORT # if defined(HAVE_WTMPX_H) && !defined(HAVE_WTMP_H) # define WTMP_FILENAME WTMPX_FILE # endif # if !defined(WTMP_FILE) && defined(_PATH_WTMP) # define WTMP_FILE _PATH_WTMP # endif # if !defined(WTMP_FILENAME) && defined(WTMP_FILE) # define WTMP_FILENAME WTMP_FILE # endif # define RXVT_WTMP_FILE WTMP_FILENAME #endif #ifdef LASTLOG_SUPPORT # ifdef OS_SOLARIS # define LASTLOG_FILE "/var/adm/lastlog" # endif # ifdef OS_OSF # define LASTLOG_FILE "/var/adm/lastlog" # endif # if !defined(LASTLOG_FILE) && defined(_PATH_LASTLOG) # define LASTLOG_FILE _PATH_LASTLOG # endif # if !defined(LASTLOG_FILENAME) && defined(LASTLOG_FILE) # define LASTLOG_FILENAME LASTLOG_FILE # endif # define RXVT_LASTLOG_FILE LASTLOG_FILENAME #endif #ifdef UTMP_SUPPORT # ifdef RXVT_UTMP_SYSV # ifndef USER_PROCESS # define USER_PROCESS (7) # endif # ifndef DEAD_PROCESS # define DEAD_PROCESS (8) # endif # endif #endif #ifdef NO_SECONDARY_SCREEN # define NSCREENS 0 #else # define NSCREENS 1 #endif /* * Let's try some interesting static program analysis tools. Refer to * http://www.cs.umd.edu/~jfoster/cqual/ * * Tainted defines the type of data that is fetchted from user input, which in * turn is unsafe without checking. Untainted defines the type of data that is * safe. */ #ifdef __GNUC__ # define $tainted # define $untainted # define TAINTED $tainted # define UNTAINTED $untainted #else # define TAINTED # define UNTAINTED #endif /* ********************************************************* ** The following are internal includes ********************************************************* */ #include "debug.h" #include "encoding.h" #include "rxvtlib.h" #ifdef GREEK_SUPPORT # include "grkelot.h" #endif #ifdef HAVE_MENUBAR # include "menubar.h" #endif #include "command.h" #include "init.h" #ifndef STDIN_FILENO # define STDIN_FILENO 0 # define STDOUT_FILENO 1 # define STDERR_FILENO 2 #endif #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) # if defined(PTYS_ARE_GETPT) || defined(PTYS_ARE_PTMX) # define NO_SETOWNER_TTYDEV # endif #endif #if defined(OS_CYGWIN) || defined(PTYS_ARE_OPENPTY) # define NO_SETOWNER_TTYDEV #endif /* Macros to check NULL pointers. This is solely to make the code more ** readable/pretty */ #define IS_NULL(PTR) (NULL == (PTR)) #define NOT_NULL(PTR) (NULL != (PTR)) #define SET_NULL(PTR) ((PTR) = NULL) /* ***************************************************************************** * STRUCTURES AND TYPEDEFS ***************************************************************************** */ struct rxvt_vars; /* Later REDEFINED and typedef'd to rxvt_t */ struct rxvt_hidden; /* Motif window hints, MwmHints.flags */ #define MWM_HINTS_FUNCTIONS (1L << 0) #define MWM_HINTS_DECORATIONS (1L << 1) #define MWM_HINTS_INPUT_MODE (1L << 2) #define MWM_HINTS_STATUS (1L << 3) /* bit definitions for MwmHints.functions */ #define MWM_FUNC_ALL (1L << 0) #define MWM_FUNC_RESIZE (1L << 1) #define MWM_FUNC_MOVE (1L << 2) #define MWM_FUNC_MINIMIZE (1L << 3) #define MWM_FUNC_MAXIMIZE (1L << 4) #define MWM_FUNC_CLOSE (1L << 5) /* bit definitions for MwmHints.decorations */ #define MWM_DECOR_ALL (1L << 0) #define MWM_DECOR_BORDER (1L << 1) #define MWM_DECOR_RESIZEH (1L << 2) #define MWM_DECOR_TITLE (1L << 3) #define MWM_DECOR_MENU (1L << 4) #define MWM_DECOR_MINIMIZE (1L << 5) #define MWM_DECOR_MAXIMIZE (1L << 6) /* bit definitions for MwmHints.inputMode */ #define MWM_INPUT_MODELESS 0 #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 #define MWM_INPUT_SYSTEM_MODAL 2 #define MWM_INPUT_FULL_APPLICATION_MODAL 3 #define PROP_MWM_HINTS_ELEMENTS 5 /* * If we're using either the rxvt scrollbar or menu bars, keep the * scrollColor resource. */ #if defined(RXVT_SCROLLBAR) || defined(PLAIN_SCROLLBAR) || defined(HAVE_MENUBAR) # define KEEP_SCROLLCOLOR 1 #else # undef KEEP_SCROLLCOLOR #endif /* * the 'essential' information for reporting Mouse Events * pared down from XButtonEvent */ struct mouse_event { int clicks; Time time; /* milliseconds */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ }; #ifndef min # define min(a,b) (((a) < (b)) ? (a) : (b)) # define max(a,b) (((a) > (b)) ? (a) : (b)) #endif #define MAX_IT(current, other) if ((other) > (current)) (current) = (other) #define MIN_IT(current, other) if ((other) < (current)) (current) = (other) #define SWAP_IT(one, two, typeof) \ { \ typeof swapittmp; \ (swapittmp) = (one); (one) = (two); (two) = (swapittmp); \ } #define BOUND_POSITIVE_INT16(val) \ (int16_t)( (val) <= 0 ? 0 : min( (val), (((uint16_t)-1)>>1) ) ) /* ***************************************************************************** * NORMAL DEFINES ***************************************************************************** */ #if defined (NO_OLD_SELECTION) && defined(NO_NEW_SELECTION) # error if you disable both selection styles, how can you select, silly? #endif #define APL_CLASS "XTerm" /* class name */ #define APL_SUBCLASS "Mrxvt" /* also check resources under this name */ #define APL_NAME "mrxvt" /* normal name */ /* COLORTERM, TERM environment variables */ #define COLORTERMENV "rxvt" #ifdef BACKGROUND_IMAGE # define COLORTERMENVFULL COLORTERMENV "-xpm" #else # define COLORTERMENVFULL COLORTERMENV #endif #ifndef TERMENV # define TERMENV "xterm" #endif #define TABTITLEENV "MRXVT_TABTITLE=" #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) # define NO_MOUSE_REPORT_SCROLLBAR #endif #ifdef NO_RESOURCES # undef USE_XGETDEFAULT #endif /* now look for other badly set stuff */ #if !defined (EACCESS) && defined(EAGAIN) # define EACCESS EAGAIN #endif #ifndef EXIT_SUCCESS /* missing from */ # define EXIT_SUCCESS 0 /* exit function success */ # define EXIT_FAILURE 1 /* exit function failure */ #endif #define menuBar_esc (10) #define scrollBar_esc (30) #define MENUBAR_MARGIN (2) /* margin below text */ /* width of scrollBar, menuBar shadow, must be 1 or 2 */ #ifdef HALFSHADOW # define SHADOW (1) #else # define SHADOW (2) #endif #define R_SB_ALIGN_CENTRE (0) #define R_SB_ALIGN_TOP (1) #define R_SB_ALIGN_BOTTOM (2) #define R_SB_UNKNOWN (-1) #define R_SB_RXVT (0) #define R_SB_NEXT (1) #define R_SB_XTERM (2) #define R_SB_SGI (3) #define R_SB_PLAIN (4) #define SB_WIDTH_PLAIN (15) #define SB_WIDTH_XTERM (15) #define SB_WIDTH_RXVT (10) #define SB_WIDTH_NEXT (17) #define SB_WIDTH_SGI (16) #ifdef NEXT_SCROLLBAR /* ** NeXT scrollbar definitions */ #define NEXT_SB_WIDTH (SB_WIDTH_NEXT) #define NEXT_SB_PAD (1) #define NEXT_SB_BD_WIDTH (1) #define NEXT_BEVEL_ULEFT_WIDTH (1) #define NEXT_BEVEL_LRIGHT_WIDTH (2) #define NEXT_SB_LPAD (NEXT_SB_PAD + NEXT_SB_BD_WIDTH) #define NEXT_SB_MARGIN (NEXT_SB_PAD<<1) #define NEXT_SB_BTN_WIDTH (NEXT_SB_WIDTH - NEXT_SB_MARGIN - NEXT_SB_BD_WIDTH) /* button height */ #define NEXT_SB_BTN_HEIGHT (NEXT_SB_BTN_WIDTH) /* single button height */ #define NEXT_SB_SBTN_HEIGHT (NEXT_SB_BTN_HEIGHT + NEXT_SB_PAD) /* double button height */ #define NEXT_SB_DBTN_HEIGHT (NEXT_SB_SBTN_HEIGHT<<1) /* total button height */ #define NEXT_SB_TBTN_HEIGHT (NEXT_SB_DBTN_HEIGHT + NEXT_SB_PAD) #define NEXT_BEVEL_X (NEXT_SB_LPAD) #define NEXT_BTN_FACE_X (NEXT_BEVEL_X + NEXT_BEVEL_ULEFT_WIDTH) #define NEXT_SB_MIN_HEIGHT (NEXT_SB_BTN_WIDTH - (NEXT_SB_PAD<<1)) /* * +-------------+ * | | <---< NEXT_SB_PAD * | ::::::::::: | * | ::::::::::: | * ''''''''''''''''' * ,,,,,,,,,,,,,,,,, * | ::::::::::: | * | ::::::::::: | * | +---------------< NEXT_BEVEL_ULEFT_WIDTH * | | :::::::: | * | V :::: vv-------< NEXT_BEVEL_LRIGHT_WIDTH * | +---------+ | * | | ......%%| | * | | ......%%| | * | | ..()..%%| | * | | ......%%| | * | | %%%%%%%%| | * | +---------+ | <......................... * | | <---< NEXT_SB_PAD : * | +---------+ | <-+.......... :---< NEXT_SB_TBTN_HEIGHT * | | ......%%| | | : : * | | ../\..%%| | |---< NEXT_SB_BTN_HEIGHT : * | | %%%%%%%%| | | : : * | +---------+ | <-+ : : * | | : : * | +---------+ | <-+ :---< NEXT_SB_DBTN_HEIGHT * | | ......%%| | | : : * | | ..\/..%%| | | : : * | | %%%%%%%%| | |---< NEXT_SB_SBTN_HEIGHT * | +---------+ | | : : * | | | : : * +-------------+ <-+.........:............: * ^^|_________| : * || | : * || +---< NEXT_SB_BTN_WIDTH * || : * |+------< NEXT_SB_PAD * |: : * +----< NEXT_SB_BD_WIDTH * : : * :............: * | * +---< NEXT_SB_WIDTH */ #endif /* NEXT_SCROLLBAR */ #ifdef SGI_SCROLLBAR /* ** SGI IRIX scrollbar definitions */ #define SGI_ARROW_SOURCE_WIDTH (14) #define SGI_ARROW_SOURCE_HEIGHT (14) #define SGI_BEVEL_HI_WIDTH (1) #define SGI_BEVEL_LO_WIDTH (1) #define SGI_BEVEL_SIZE (SGI_BEVEL_HI_WIDTH+SGI_BEVEL_LO_WIDTH) #define SGI_ARROW_WIDTH (SB_WIDTH_SGI-(SGI_BEVEL_SIZE<<1)) #define SGI_ARROW_HEIGHT (SGI_ARROW_SOURCE_HEIGHT) #define SGI_SB_BUTTON_HEIGHT ((SGI_BEVEL_SIZE<<1)+SGI_ARROW_WIDTH) #define SGI_SB_BUTTONS_HEIGHT (SGI_SB_BUTTON_HEIGHT<<1) #endif /* * Options for r->h->refresh_type. */ #define NO_REFRESH (0) /* Window not visible at all! */ #define FAST_REFRESH (1<<0) /* Fully exposed window */ #define SLOW_REFRESH (1<<1) /* Partially exposed window */ #define SMOOTH_REFRESH (1<<2) /* Do sync'ing to make it smooth */ #define REFRESH_BOUNDS (1<<3) /* Refresh window borders */ #define CLIPPED_REFRESH (1<<4) /* Honor clipping in GC while refreshing */ /* * Options for r->h->want_resize */ #define FORCE_RESIZE (1U << 0) #define FORCE_REFRESH (1U << 1) /* * Continue undocumented mrxvt code */ #define IGNORE 0 #define SAVE 's' #define RESTORE 'r' /* special (internal) prefix for font commands */ #define FONT_CMD '#' #define FONT_DN "#-" #define FONT_UP "#+" /* flags for rxvt_scr_gotorc() */ #define C_RELATIVE 1 /* col movement is relative */ #define R_RELATIVE 2 /* row movement is relative */ #define RELATIVE (R_RELATIVE|C_RELATIVE) /* modes for rxvt_scr_insdel_chars(), rxvt_scr_insdel_lines() */ #define INSERT -1 /* don't change these values */ #define DELETE +1 #define ERASE +2 /* modes for rxvt_scr_page() - scroll page. used by scrollbar window */ enum page_dirn { UP, DN, NO_DIR }; /* arguments for rxvt_scr_change_screen() */ #define PRIMARY (0) #define SECONDARY (1) enum { SBYTE = 0, WBYTE }; #define RS_None 0 /* Normal */ #if defined(TTY_256COLOR) /* have at least 32 bits to use */ # define RS_fgMask 0x000001FFu /* 512 colors */ # define RS_bgMask 0x0003FE00u /* 512 colors */ # define RS_Bold 0x00040000u /* bold */ # define RS_Blink 0x00080000u /* blink */ # define RS_RVid 0x00100000u /* reverse video */ # define RS_Uline 0x00200000u /* underline */ # define RS_acsFont 0x00400000u /* ACS graphics char set */ # define RS_ukFont 0x00800000u /* UK character set */ #else /* may only have 16 bits to use so squash them in */ # define RS_fgMask 0x0000001Fu /* 32 colors */ # define RS_bgMask 0x000003E0u /* 32 colors */ # define RS_Bold 0x00000400u /* bold */ # define RS_Blink 0x00000800u /* blink */ # define RS_RVid 0x00001000u /* reverse video */ # define RS_Uline 0x00002000u /* underline */ # define RS_acsFont 0x00004000u /* ACS graphics char set */ # define RS_ukFont 0x00008000u /* UK character set */ #endif #ifdef MULTICHAR_SET # define RS_multi0 0x10000000u /* only multibyte characters */ # define RS_multi1 0x20000000u /* multibyte 1st byte */ /* multibyte 2nd byte */ # define RS_multi2 (RS_multi0|RS_multi1) /* multibyte mask */ # define RS_multiMask (RS_multi0|RS_multi1) # define IS_MULTI1(R) (((R) & RS_multiMask) == RS_multi1) # define IS_MULTI2(R) (((R) & RS_multiMask) == RS_multi2) #else # define RS_multiMask (0) # define IS_MULTI1(r) (0) # define IS_MULTI2(r) (0) #endif #define UNICODE_MASK 0x1fffffUL #if UNICODE3 # define COMPOSE_LO 0x40000000UL # define COMPOSE_HI 0x400fffffUL # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) #else # define COMPOSE_LO 0xd800UL # define COMPOSE_HI 0xf8ffUL /* dfff should be safer, but... */ # define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI) #endif #define RS_fontMask (RS_acsFont|RS_ukFont) #define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) #define RS_attrMask (RS_baseattrMask|RS_fontMask|RS_multiMask) #define Sel_none 0 /* Not waiting */ #define Sel_normal 0x01 /* normal selection */ #define Sel_incr 0x02 /* incremental selection */ #define Sel_direct 0x00 #define Sel_Primary 0x01 #define Sel_Secondary 0x02 #define Sel_Clipboard 0x03 #define Sel_whereMask 0x0f #define Sel_CompoundText 0x10 /* last request was Compound */ enum { C0_NUL = 0x00, C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL, C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI , C0_DLE, C0_DC1, C0_DC2, D0_DC3, C0_DC4, C0_NAK, C0_SYN, C0_ETB, C0_CAN, C0_EM , C0_SUB, C0_ESC, C0_IS4, C0_IS3, C0_IS2, C0_IS1 }; #define CHAR_ST 0x9c /* 0234 */ /* ** Xwsh escape sequences: ESC P Ps .y Pt ESC */ #define Xwsh_title (1) #define Xwsh_iconName (3) #define Xwsh_textColor (4) #define Xwsh_pageColor (5) #define Xwsh_selTextColor (6) #define Xwsh_selPageColor (7) #define Xwsh_cursorTextColor (8) #define Xwsh_cursorPageColor (9) #define Xwsh_halfIntColor (10) #define Xwsh_boldIntColor (11) #define Xwsh_bindStrKeyVal (101) /* not implemented */ #define Xwsh_bindStrKeyFunc (103) /* not implemented */ /* ** XTerm Operating System Commands: ESC ] Ps;Pt (ST|BEL) ** colour extensions by Christian W. Zuckschwerdt */ #define XTerm_name (0) #define XTerm_iconName (1) #define XTerm_title (2) #define XTerm_Color (4) /* change colors */ #define XTerm_Color_cursor (12) /* change actual 'Cursor' color */ #define XTerm_Color_pointer (13) /* change actual 'Pointer' color */ #define XTerm_Color_RV (17) /* change actual 'Highlight' color */ #define XTerm_Color_BD (18) /* change actual 'Bold' color */ #define XTerm_Color_UL (19) /* change actual 'Underline' color */ #define XTerm_logfile (46) /* not implemented */ #define XTerm_font (50) /* ** rxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) */ #define XTerm_Menu (10) /* set menu item */ #define XTerm_Pixmap (20) /* new bg pixmap */ #define XTerm_restoreFG (39) /* change default fg color */ #define XTerm_restoreBG (49) /* change default bg color */ #define XTerm_dumpscreen (55) /* dump scrollback and all screen */ /* * mrxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) * Example: echo "\e]61;newtitle\a" */ #define MRxvt_term (60) /* Change window title */ #define MRxvt_tab (61) /* change tab title */ #define MRxvt_tabterm (62) /* change tab and terminal title */ #define MRxvt_wformat (63) /* Change window title format */ #define MRxvt_tformat (64) /* Change tab title format */ /* #define MRxvt_newtab (63) ** DISABLED create a new tab with title */ /* #define MRxvt_prevtab (64) ** DISABLED switch to previous tab */ /* #define MRxvt_nexttab (65) ** DISABLED switch to next tab */ #define MRxvt_tint (66) /* change tinting color */ #define MRxvt_shade (67) /* change shade level */ #define MRxvt_encode (68) /* change encoding */ /* #define MRxvt_hide (69) ** DISABLED hide/show tabbar */ #define MRxvt_opacity (70) /* set opacity level */ /* #define MRxvt_tabbtn (71) ** DISABLED hide/show tabbar buttons */ #define MRxvt_tabfg (72) /* change active tab fg */ #define MRxvt_tabbg (73) /* change tabbar/active tab bg */ #define MRxvt_itabfg (74) /* change inactive tab fg */ #define MRxvt_itabbg (75) /* change inactive tab bg */ /* #define MRxvt_trans (76) ** DISABLED toggle transparency */ /* #define MRxvt_moveleft (77) ** DISABLED move active tab to left */ /* #define MRxvt_moveright (78) ** DISABLED move active tab to right */ /* #define MRxvt_verybold (79) ** DISABLED toggle bold font for color text */ /* #define MRxvt_hotkeys (80) ** DISABLED toggle hotkeys */ /* #define MRxvt_saveconfig (81) ** DISABLED save configuration */ #define MRxvt_bgfade (82) /* set bgfade degree (Obsolete) */ #define MRxvt_termenv (83) /* set TERMENV type */ /* #define MRxvt_closewin (84) ** DISABLED Close all tabs and exit */ /* #define MRxvt_switchtab (85) ** DISABLED Switch to tab N */ /* Words starting with `Color_' are colours. Others are counts */ /* ** The following comment is mostly obsolete since pixcolor_set was ** expanded: ** We're currently upto 30 colours. Only 2 more available. The ** PixColor and rendition colour usage should probably be decoupled ** on the unnecessary items, e.g. Color_pointer, but won't bother ** until we need to. Also, be aware of usage in pixcolor_set */ enum colour_list { Color_fg = 0, Color_bg, minCOLOR, /* 2 */ Color_Black = minCOLOR, Color_Red3, Color_Green3, Color_Yellow3, Color_Blue3, Color_Magenta3, Color_Cyan3, maxCOLOR, /* minCOLOR + 7 */ #ifndef NO_BRIGHTCOLOR Color_AntiqueWhite = maxCOLOR, minBrightCOLOR, /* maxCOLOR + 1 */ Color_Grey25 = minBrightCOLOR, Color_Red, Color_Green, Color_Yellow, Color_Blue, Color_Magenta, Color_Cyan, maxBrightCOLOR, /* minBrightCOLOR + 7 */ Color_White = maxBrightCOLOR, #else Color_White = maxCOLOR, #endif #ifdef TTY_256COLOR min256COLOR = Color_White + 1, max256COLOR = minCOLOR + 255, #endif #ifndef NO_CURSORCOLOR Color_cursor, Color_cursor2, #endif Color_pointer, Color_border, Color_ufbg, #ifndef NO_BOLD_UNDERLINE_REVERSE Color_BD, Color_UL, Color_RV, #endif #ifdef OPTION_HC Color_HC, #endif #ifdef KEEP_SCROLLCOLOR Color_scroll, Color_trough, #endif #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) # ifdef TINTING_SUPPORT Color_tint, # endif #endif /* BACKGROUND_IMAGE || TRANSPARENT */ NRS_COLORS, /* */ #ifdef KEEP_SCROLLCOLOR Color_topShadow = NRS_COLORS, Color_bottomShadow, TOTAL_COLORS /* upto 31 */ #else TOTAL_COLORS = NRS_COLORS /* */ #endif }; #ifdef TTY_256COLOR # define Color_Bits 9 # define NPIXCLR_SETS 9 /* (256 + 14) bits / 32 bits */ #else # define Color_Bits 5 # define NPIXCLR_SETS 1 /* (16 + 14) bits / 32 bits */ #endif #define NPIXCLR_BITS 32 #define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<vts[page]->PrivateModes |= (bit); \ else \ r->vts[page]->PrivateModes &= ~(bit) #ifdef ALLOW_132_MODE # define PrivMode_Default \ (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) #else # define PrivMode_Default \ (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) /* (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) */ #endif #define XSCREEN DefaultScreen(r->Xdisplay) #define XROOT DefaultRootWindow(r->Xdisplay) #ifdef PREFER_24BIT # define XDEPTH (r->Xdepth) # define XCMAP (r->Xcmap) # define XVISUAL (r->h->Xvisual) #else # ifdef DEBUG_DEPTH # define XDEPTH DEBUG_DEPTH # else # define XDEPTH DefaultDepth(r->Xdisplay, XSCREEN) # define XCMAP DefaultColormap(r->Xdisplay, XSCREEN) # define XVISUAL DefaultVisual(r->Xdisplay, XSCREEN) # endif #endif #define IMBUFSIZ 128 /* input modifier buffer sizes */ #ifndef BUFSIZ # define BUFSIZ 4096 #endif #define KBUFSZ 512 /* size of keyboard mapping buffer */ /* ***************************************************************************** * MACRO DEFINES ***************************************************************************** */ /* convert pixel dimensions to row/column values. Everything as int32_t */ #define Pixel2Width(x) ((int32_t)(x) / (int32_t)r->TermWin.fwidth) #define Pixel2Height(y) ((int32_t)(y) / (int32_t)r->TermWin.fheight) #define Width2Pixel(n) ((int32_t)(n) * (int32_t)r->TermWin.fwidth) #define Height2Pixel(n) ((int32_t)(n) * (int32_t)r->TermWin.fheight) #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)r->TermWin.int_bwidth) #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)r->TermWin.int_bwidth) #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)r->TermWin.int_bwidth) #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)r->TermWin.int_bwidth) /* #define TermWin_TotalWidth() ((int32_t)r->TermWin.width + 2 * (int32_t)r->TermWin.int_bwidth) #define TermWin_TotalHeight() ((int32_t)r->TermWin.height + 2 * (int32_t)r->TermWin.int_bwidth) */ /* how to build & extract colors and attributes */ #define GET_BASEFG(x) (((x) & RS_fgMask)) #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) #if 0 /* Was ifndef NO_BRIGHTCOLOR */ # define GET_FGCOLOR(x) \ ((((x) & RS_Bold) == 0 \ || GET_BASEFG(x) < minCOLOR \ || GET_BASEFG(x) >= minBrightCOLOR) \ ? GET_BASEFG(x) \ : (GET_BASEFG(x) + (minBrightCOLOR - minCOLOR))) # define GET_BGCOLOR(x) \ ((((x) & RS_Blink) == 0 \ || GET_BASEBG(x) < minCOLOR \ || GET_BASEBG(x) >= minBrightCOLOR) \ ? GET_BASEBG(x) \ : (GET_BASEBG(x) + (minBrightCOLOR - minCOLOR))) #else # define GET_FGCOLOR(x) GET_BASEFG(x) # define GET_BGCOLOR(x) GET_BASEBG(x) #endif #define GET_ATTR(x) (((x) & RS_attrMask)) #define GET_BGATTR(x) \ (((x) & RS_RVid) ? (((x) & (RS_attrMask & ~RS_RVid)) \ | (((x) & RS_fgMask)<pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) #define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) #define scrollbar_isMotion() (r->scrollBar.state == 'm') #define scrollbar_isUp() (r->scrollBar.state == 'U') #define scrollbar_isDn() (r->scrollBar.state == 'D') #define scrollbar_isUpDn() isupper ((int) r->scrollBar.state) #define scrollbar_setIdle() r->scrollBar.state = (char) 1 #define scrollbar_setMotion() r->scrollBar.state = 'm' #define scrollbar_setUp() r->scrollBar.state = 'U' #define scrollbar_setDn() r->scrollBar.state = 'D' #define scrollbarnext_dnval() (r->scrollBar.end + (r->scrollBar.width + 1)) #define scrollbarnext_upButton(y) ((y) > r->scrollBar.end \ && (y) <= scrollbarnext_dnval()) #define scrollbarnext_dnButton(y) ((y) > scrollbarnext_dnval()) #define scrollbarrxvt_upButton(y) ((y) < r->scrollBar.beg) #define scrollbarrxvt_dnButton(y) ((y) > r->scrollBar.end) #define scrollbarsgi_dnval() (r->scrollBar.end + 1) #define scrollbarsgi_upButton(y) ((y) < r->scrollBar.beg) #define scrollbarsgi_dnButton(y) ((y) > r->scrollBar.end) #ifdef NEXT_SCROLLBAR # define SCROLLNEXT_MINHEIGHT (NEXT_SB_MIN_HEIGHT) #else # define SCROLLNEXT_MINHEIGHT (0) #endif /* NEXT_SCROLLBAR */ #ifdef SGI_SCROLLBAR # define SCROLLSGI_MINHEIGHT (10) #else # define SCROLLSGI_MINHEIGHT (0) #endif /* SGI_SCROLLBAR */ #define SCROLL_MINHEIGHT (10) #define scrollbar_minheight() ( \ (r->scrollBar.style == R_SB_NEXT) ? SCROLLNEXT_MINHEIGHT : \ (r->scrollBar.style == R_SB_SGI) ? SCROLLSGI_MINHEIGHT : \ SCROLL_MINHEIGHT) #define scrollbar_above_slider(y) ((y) < r->scrollBar.top) #define scrollbar_below_slider(y) ((y) > r->scrollBar.bot) #define scrollbar_position(y) ((y) - r->scrollBar.beg) #define scrollbar_size() (r->scrollBar.end - r->scrollBar.beg \ - scrollbar_minheight()) #ifdef BACKGROUND_IMAGE # define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g)) #else # define XPMClearArea(a, b, c, d, e, f, g) #endif #ifndef STRICT_FONT_CHECKING # define rxvt_get_fontwidest(font) ((font)->max_bounds.width) #endif #define rxvt_Gr_ButtonPress(x,y) rxvt_Gr_ButtonReport (r, 'P',(x),(y)) #define rxvt_Gr_ButtonRelease(x,y) rxvt_Gr_ButtonReport (r, 'R',(x),(y)) /* * When sending a client message to an EWMH compatible window manager * e.g. calls to ewmh_message(). */ #define _NET_WM_STATE_REMOVE 0 #define _NET_WM_STATE_ADD 1 #define _NET_WM_STATE_TOGGLE 2 /* Values for holdOption */ #define HOLD_ALWAYSBIT (1u << 0) #define HOLD_NORMALBIT (1u << 1) #define HOLD_STATUSBIT (1u << 2) /* ***************************************************************************** * VARIABLES ***************************************************************************** */ struct rxvt_hidden { unsigned char BOOLVAR( want_clip_refresh, 1), /* Only refresh region specified by refreshRegion */ BOOLVAR( want_resize, 2), /* perform resize even if window size has not changed */ #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) BOOLVAR( am_transparent, 1), /* is transparent */ BOOLVAR( am_pixmap_trans, 1), /* transparency without known root pixmap */ # endif #ifdef CURSOR_BLINK BOOLVAR( hidden_cursor, 1), #endif BOOLVAR( hate_those_clicks, 1), /* a.k.a. keep mark position */ BOOLVAR( num_scr_allow, 1), BOOLVAR( bypass_keystate, 1); #ifdef TRANSPARENT unsigned char BOOLVAR( want_full_refresh, 1); /* awaiting full screen refresh, including borders. */ #endif Region refreshRegion; /* Region for CLIPPED_REFRESH */ int skip_pages, /* Number of pages to skip when jump scrolling */ refresh_limit; /* Request screen refresh only if ATAB produces <= these many chars */ unsigned char BOOLVAR( refresh_type, 5), #ifdef META8_OPTION meta_char, /* Alt-key prefix */ #endif scrollbar_align, selection_wait, selection_type; #ifdef GREEK_SUPPORT short greek_mode; /* Greek keyboard mode */ KeySym ks_greekmodeswith; #endif uint16_t prev_ncol, prev_nrow; /* screen: previous number of columns and rows */ uint32_t pixcolor_set[NPIXCLR_SETS]; #ifdef SELECTION_SCROLLING int scroll_selection_delay, scroll_selection_lines; enum page_dirn scroll_selection_dir; int selection_save_x, selection_save_y, selection_save_state, pending_scroll_selection; #endif int csrO, /* Hops - csr offset in thumb/slider to give proper Scroll behaviour */ #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING scroll_arrow_delay, #endif #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) mouse_slip_wheel_delay, mouse_slip_wheel_speed, #endif max_skipped_pages, fnum, /* logical font number */ last_bot, /* scrollbar last bottom position */ last_top, /* scrollbar last top position */ last_state, /* scrollbar last state */ scroller_len, currmaxcol, window_vt_x, window_vt_y; # ifdef POINTER_BLANK int pointerBlankDelay; # endif unsigned char BOOLVAR( allowedxerror, 1); /* Be silent when reporting XErrors */ int xerror_return; /* ErrorCode of caught XError */ unsigned int ModMetaMask, ModNumLockMask; #ifndef NO_BRIGHTCOLOR unsigned long colorfgbg; #endif gid_t ttygid; #ifdef PREFER_24BIT Visual* Xvisual; #endif Atom xa[NUM_XA]; Time selection_time, selection_request_time; Cursor bar_pointer; #ifdef POINTER_BLANK Cursor blank_pointer; #endif #ifndef NO_BACKSPACE_KEY const char* key_backspace; #endif #ifndef NO_DELETE_KEY const char* key_delete; #endif #ifdef USE_XIM XIC Input_Context; XIMStyle input_style; int event_type; #endif struct mouse_event MEvent; row_col_t oldcursor; #ifdef MULTICHAR_SET signed int oldcursormulti; #endif void (*multichar_decode)(unsigned char *str, int len); #ifdef HAVE_MENUBAR menu_t* ActiveMenu; /* currently active menu */ menu_t* BuildMenu; /* the menu currently being built */ menu_t* popupMenu[3]; /* Menus to popup on ctrl clicks */ unsigned char BOOLVAR( showingMenu, 1); /* The type of menu currently being shown */ bar_t MenuBar; int Arrows_x; #endif #ifdef CURSOR_BLINK long blinkInterval; struct timeval lastcursorchange; #endif #ifdef POINTER_BLANK struct timeval lastmotion; #endif #ifdef TRANSPARENT unsigned long bgRefreshInterval; struct timeval lastCNotify; /* Time of the last CNotify event */ #endif struct timeval timeout[NUM_TIMEOUTS]; /* * These three don't need to be kept but do so to placate some memory * checkers */ char* env_windowid; /* environmental variable WINDOWID */ char* env_display; /* environmental variable DISPLAY */ char* env_term; /* environmental variable TERM */ char* env_tabtitle; /* environmental variable MRXVT_TABTITLE*/ char* env_colorfgbg; char* buffer; char* locale; #if 0 unsigned char* v_buffer; unsigned char* v_bufstr; unsigned char* v_bufptr; unsigned char* v_bufend; #endif char* newfont[MAX_NFONTS]; const char* rs[NUM_RESOURCES]; #if 0 /* command input buffering */ unsigned char* cmdbuf_ptr, *cmdbuf_endp; unsigned char cmdbuf_base[BUFSIZ]; unsigned char kbuf[KBUFSZ]; #endif #ifdef TRANSPARENT Pixmap rootPixmap; /* Pixmap ID of the root pixmap */ unsigned rpWidth, /* Dimensions of the root pixmap */ rpHeight; XRectangle prevPos; /* Previous onscreen position */ Bool bgGrabbed; /* whether the bg was succesfully grabbed at prevPos */ #endif }; #ifndef __attribute__ # ifdef __GNUC__ # if (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || (__GNUC__ < 2) # define __attribute__(x) # endif # endif # define __attribute__(x) #endif /* ***************************************************************************** * PROTOTYPES ***************************************************************************** */ #define __PROTO(p) p #include "protos.h" #ifdef OUR_STRINGS # define MEMSET(x, y, z) ma_memset((x), (y), (size_t)(z)) # define MEMCPY(x, y, z) ma_memcpy((void *)(x), (const void *)(y), (z)) # define MEMMOVE(x, y, z) ma_memmove((void *)(x), (const void *)(y), (z)) # define STRCASECMP(x, y) ma_strcasecmp((x), (y)) # define STRNCASECMP(x, y, z) ma_strncasecmp((x), (y), (z)) # define STRCPY(x, y) ma_strcpy((char *)(x), (const char *)(y)) # define STRNCPY(x, y, z) ma_strncpy((char *)(x), (const char *)(y), (z)) # define STRCMP(x, y) ma_strcmp((const char *)(x), (const char *)(y)) # define STRNCMP(x, y, z) ma_strncmp((const char *)(x), (const char *)(y), (z)) # define STRCAT(x, y) ma_strcat((char *)(x), (const char *)(y)) # define STRNCAT(x, y, z) ma_strncat((char *)(x), (const char *)(y), (z)) # define STRDUP(x) ma_strdup((const char *)(x)) # define STRNDUP(x, z) ma_strndup((const char TAINTED *)(x), (size_t) (z)) # define STRLEN(x) ma_strlen((const char *)(x)) # define STRCHR(x, y) ma_strchr((const char *)(x), (int)(y)) # define STRRCHR(x, y) ma_strrchr((const char *)(x), (int)(y)) #else /* OUR_STRINGS */ # define MEMSET(x, y, z) memset((x), (y), (size_t)(z)) # define MEMCPY(x, y, z) memcpy((void *)(x), (const void *)(y), (z)) # define MEMMOVE(x, y, z) memmove((void *)(x), (const void *)(y), (z)) # define STRCASECMP(x, y) strcasecmp((x), (y)) # define STRNCASECMP(x, y, z) strncasecmp((x), (y), (z)) # define STRCPY(x, y) strcpy((char *)(x), (const char *)(y)) # define STRNCPY(x, y, z) strncpy((char *)(x), (const char *)(y), (z)) # define STRCMP(x, y) strcmp((const char *)(x), (const char *)(y)) # define STRNCMP(x, y, z) strncmp((const char *)(x), (const char *)(y), (z)) # define STRCAT(x, y) strcat((char *)(x), (const char *)(y)) # define STRLEN(x) strlen((const char *)(x)) # define STRNCAT(x, y, z) strncat((char *)(x), (const char *)(y), (z)) /* if use our own malloc function, we must NOT use system provided * strdup or strndup because we want to free the memory allocated * by strdup/strndup using our free function */ # if defined(HAVE_STRDUP) && !defined(OUR_MALLOC) # define STRDUP(x) strdup((const char *)(x)) # else # define STRDUP(x) ma_strdup((const char *)(x)) # endif # if defined(HAVE_STRNDUP) && !defined(OUR_MALLOC) # define STRNDUP(x, z) strndup((const char TAINTED *)(x), (size_t) (z)) # else # define STRNDUP(x, z) ma_strndup((const char TAINTED *)(x), (size_t) (z)) # endif # ifdef HAVE_STRCHR # define STRCHR(x, y) strchr((const char *)(x), (int)(y)) # else # define STRCHR(x, y) ma_strchr((const char *)(x), (int)(y)) # endif # ifdef HAVE_STRRCHR # define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) # else # define STRRCHR(x, y) ma_strrchr((const char *)(x), (int)(y)) # endif #endif /* OUR_STRINGS */ # define STRSTR(x, y) strstr((const char *)(x), (const char*)(y)) /* * strcasestr is not provided by Cygwin's libraries, so we have to check for it * here. Thanks to Teun Burgers for pointing this out. */ # ifdef HAVE_STRCASESTR # define STRCASESTR( x, y) strcasestr( (x), (y) ) # else # define STRCASESTR( x, y) ma_strcasestr( (x), (y)) # endif #define TWIN_WIDTH(R) ((R)->szHint.width) #define TWIN_HEIGHT(R) ((R)->szHint.height) #define VT_WIDTH(R) ((R)->szHint.width - \ (R)->szHint.base_width + 2*(R)->TermWin.int_bwidth) #define VT_HEIGHT(R) ((R)->szHint.height - \ (R)->szHint.base_height + 2*(R)->TermWin.int_bwidth) /* #define TWIN_WIDTH(R) \ ((R)->szHint.width - 2*(R)->TermWin.int_bwidth) #define TWIN_HEIGHT(R) \ ((R)->szHint.height - 2*(R)->TermWin.int_bwidth) #define VT_WIDTH(R) \ ((R)->szHint.width - (R)->szHint.base_width) #define VT_HEIGHT(R) \ ((R)->szHint.height - (R)->szHint.base_height) */ #ifndef XTERM_COLOR_CHANGE # define rxvt_set_window_color(r, page, idx, color) () #endif /* This comes last */ /* #ifdef DEBUG_malloc # include "dmalloc.h" #endif */ #endif /* __RXVT_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/close_term_d.xpm0000644000175000001440000000100010756127602013566 00000000000000/* XPM */ static char * close_term_d_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #777778", "..................", "..................", "..................", "..................", ".....+....++......", ".....++..++++.....", "......++.+++......", "......+++++.......", ".......+++........", ".......++++.......", "......++++++......", "......++.++++.....", ".....++...++++....", ".....+.....++.....", "..................", "..................", "..................", ".................."}; mrxvt-0.5.4/src/rxvtlib.h0000644000175000001440000010410711032075500012243 00000000000000/*--------------------------------*-H-*---------------------------------* * File: rxvtlib.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Terry Griffin * Copyright (c) 2005 Teun Burgers * Copyright (c) 2004-2005 Jingmin Zhou * Copyright (c) 2005 Gautam Iyer * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __RXVTLIB_H__ #define __RXVTLIB_H__ /* * Boolean variables */ #ifdef __GNUC__ # define BOOLVAR(x, sz) x:sz #else # define BOOLVAR(x, sz) x #endif /* type of unicode_t */ typedef uint32_t unicode_t; /***************************************************************************** * SECTION 2 * * DO NOT TOUCH ANYTHING BELOW HERE * *****************************************************************************/ struct rxvt_vars; /* defined later on */ struct rxvt_hidden; /* not defined here */ typedef struct { int32_t row; int32_t col; } row_col_t; typedef unsigned char text_t; #if defined(TTY_256COLOR) || defined(MULTICHAR_SET) # define rend_t uint32_t #else # define rend_t uint16_t #endif /* Size of the FIFO buffer */ #define FIFO_BUF_SIZE (512) /* * TermWin elements limits * ncol : 1 <= ncol <= MAX(int16_t) * nrow : 1 <= nrow <= MAX(int16_t) * saveLines : 0 <= saveLines <= MAX(int16_t) * nscrolled : 0 <= nscrolled <= saveLines * view_start: 0 <= view_start <= nscrolled */ typedef struct { uint16_t fwidth, /* font width [pixels] */ fheight; /* font height [pixels] */ #ifdef XFT_SUPPORT uint16_t pwidth, /* propotionally spaced font width / height */ pheight; #endif uint16_t propfont; /* font proportional flags */ uint16_t ncol; /* window columns [characters] */ uint16_t nrow; /* window rows [characters] */ uint16_t mapped; /* TermWin is mapped? */ uint16_t int_bwidth; /* internal border width */ uint16_t ext_bwidth; /* external border width */ uint16_t maxTabWidth, /* max width of tab title to display */ minVisibleTabs; /* Minimum number of tabs to try and keep visible */ #ifndef NO_LINESPACE uint16_t lineSpace; /* space between rows */ #endif char BOOLVAR(focus,1); /* window is focused? */ char enter; /* pointer is in window? */ Window parent; /* parent window */ GC gc; /* GC for drawing text */ XFontStruct* font; /* main font structure */ #ifndef NO_BOLDFONT XFontStruct* bfont; /* bold font */ #endif #ifdef MULTICHAR_SET XFontStruct* mfont; /* Multichar font structure */ #endif #ifdef USE_XIM XFontSet fontset; #endif #ifdef XFT_SUPPORT XftPattern* xftpattern; XftFont *xftfont, *xftpfont, *xftPfont; # ifdef MULTICHAR_SET XftPattern* xftmpattern; XftFont* xftmfont; int xftmsize; # ifdef HAVE_ICONV_H iconv_t xfticonv; # endif # endif # ifndef NO_BOLDFONT XftFont* xftbfont; # endif char xftfnmono; /* font is mono? */ char xftmono; /* font and mfont are mono? */ int xftsize, xftpsize; #endif /* XFT_SUPPORT */ # define PARENT_NUMBER (6) int opacity; /* transluscent window opaque degree */ int opacity_degree; /* opaque change degree */ #ifdef TRANSPARENT Window parenttree[PARENT_NUMBER]; #endif #ifdef TINTING_SUPPORT int shade; /* tinting shade percentage */ #endif int fade; /* off-focus fading percentage */ #ifdef TEXT_SHADOW enum { SHADOW_NONE = 0, SHADOW_LEFT, SHADOW_RIGHT, SHADOW_TOP, SHADOW_BOTTOM, SHADOW_TOPLEFT, SHADOW_BOTRIGHT, SHADOW_TOPRIGHT, SHADOW_BOTLEFT, } shadow_mode; unsigned long shadow; /* text shadow color */ # ifdef XFT_SUPPORT XftColor xftshadow; # endif #endif #ifdef HAVE_X11_SM_SMLIB_H SmcConn sm_conn; IceConn ice_conn; int ice_fd; char* sm_client_id; #endif #ifndef NO_BELL unsigned long vBellDuration; #endif } TermWin_t; /* * screen accounting: * screen_t elements * text: Contains all text information including the scrollback buffer. * Each line is length TermWin.ncol * tlen: The length of the line or -1 for wrapped lines. * rend: Contains rendition information: font, bold, colour, etc. * * NOTE: Each line for both text and rend are only allocated on demand, and * text[x] is allocated <=> rend[x] is allocated for all x. * * row: Cursor row position : 0 <= row < TermWin.nrow * col: Cursor column position : 0 <= col < TermWin.ncol * tscroll: Scrolling region top row inclusive : 0 <= row < TermWin.nrow * bscroll: Scrolling region bottom row inclusive : 0 <= row < TermWin.nrow * * selection_t elements * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where * nothing is selected * beg: row/column of beginning of selection : never past mark * mark: row/column of initial click : never past end * end: row/column of one character past end of selection * * Note: -TermWin.nscrolled <= beg.row <= mark.row <= end.row < TermWin.nrow * * Note: col == -1 ==> we're left of screen * * Layout of text/rend information in the screen_t text/rend structures: * Rows [0] ... [TermWin.saveLines - 1] * scrollback region : we're only here if TermWin.view_start != 0 * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] * normal `unscrolled' screen region */ typedef struct { text_t** text; /* _all_ the text */ int16_t* tlen; /* length of each text line */ rend_t** rend; /* rendition, uses RS_ flags */ row_col_t cur; /* cursor position on the screen */ uint16_t tscroll; /* top of settable scroll region */ uint16_t bscroll; /* bottom of settable scroll region */ uint16_t charset; /* character set number [0..3] */ unsigned int flags; /* see below */ row_col_t s_cur; /* saved cursor position */ uint16_t s_charset; /* saved character set number [0..3] */ char s_charset_char; rend_t s_rstyle; /* saved rendition style */ } screen_t; typedef struct { unsigned char* text; /* selected text */ uint32_t len; /* length of selected text */ enum { SELECTION_CLEAR = 0,/* nothing selected */ SELECTION_INIT, /* marked a point */ SELECTION_BEGIN, /* started a selection */ SELECTION_CONT, /* continued selection */ SELECTION_DONE /* selection put in CUT_BUFFER0 */ } op; /* current operation */ short vt; /* VT that has the selection */ short screen; /* screen being used */ short clicks; /* number of clicks */ row_col_t beg; /* beginning of selection <= mark */ row_col_t mark; /* point of initial click <= end */ row_col_t end; /* one character past end point */ } selection_t; typedef enum { OLD_SELECT, OLD_WORD_SELECT, NEW_SELECT } sstyle_t; /* ------------------------------------------------------------------------- */ /* screen_t flags */ #define Screen_Relative (1<<0) /* relative origin mode flag */ #define Screen_VisibleCursor (1<<1) /* cursor visible? */ #define Screen_Autowrap (1<<2) /* auto-wrap flag */ #define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */ #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ #define Screen_DefaultFlags (Screen_VisibleCursor|Screen_Autowrap) #define IS_OPTION1 (0x00000000) #define IS_OPTION2 (0x00000001) #define IS_OPTION3 (0x00000002) #define IS_OPTION4 (0x00000003) #define OPTION_MASK (0x00000003) #define MAX_OPTION_ARRAY (4) /* rxvt_vars.Options */ /* * Bits corresponding to 1<<2 through 1<<30 can be used for option flags. 1<<31 * is reserved for "reverse" options (which I think is obsolete), and the least * two significant bits are used to get the array index of r->Options. */ #define Opt_console ((1LU<<2) | IS_OPTION1) #define Opt_loginShell ((1LU<<3) | IS_OPTION1) #define Opt_iconic ((1LU<<4) | IS_OPTION1) #define Opt_visualBell ((1LU<<5) | IS_OPTION1) #define Opt_currentTabVBell ((1LU<<6) | IS_OPTION1) #define Opt_mapAlert ((1LU<<7) | IS_OPTION1) #define Opt_reverseVideo ((1LU<<8) | IS_OPTION1) #define Opt_utmpInhibit ((1LU<<9) | IS_OPTION1) #define Opt_scrollBar ((1LU<<10) | IS_OPTION1) #define Opt_scrollBar_right ((1LU<<11) | IS_OPTION1) #define Opt_scrollBar_floating ((1LU<<12) | IS_OPTION1) #define Opt_meta8 ((1LU<<13) | IS_OPTION1) #define Opt_scrollTtyOutputInhibit ((1LU<<14) | IS_OPTION1) #define Opt_scrollTtyKeypress ((1LU<<15) | IS_OPTION1) #define Opt_transparent ((1LU<<16) | IS_OPTION1) #define Opt_forceTransparent ((1LU<<17) | IS_OPTION1) #define Opt_mc_hack ((1LU<<18) | IS_OPTION1) #define Opt_tripleclickwords ((1LU<<19) | IS_OPTION1) #define Opt_mouseWheelScrollPage ((1LU<<20) | IS_OPTION1) #define Opt_pointerBlank ((1LU<<21) | IS_OPTION1) #define Opt_cursorBlink ((1LU<<22) | IS_OPTION1) #ifdef HAVE_SCROLLBARS # define Opt_transparent_scrollbar ((1LU<<23) | IS_OPTION1) #endif #ifdef HAVE_MENUBAR # define Opt_transparent_menubar ((1LU<<24) | IS_OPTION1) # define Opt_showMenu ((1LU<<25) | IS_OPTION1) #endif #define Opt_transparent_tabbar ((1LU<<26) | IS_OPTION1) #define Opt_tabPixmap ((1LU<<27) | IS_OPTION1) #ifdef XFT_SUPPORT # define Opt_xft ((1LU<<28) | IS_OPTION1) #endif #ifdef USE_FIFO # define Opt_useFifo ((1LU<<29) | IS_OPTION1) #endif/*USE_FIFO*/ #define DEFAULT_OPTIONS \ (Opt_scrollBar) /* rxvt_vars.Options2 */ #define Opt2_protectSecondary ((1LU<<2) | IS_OPTION2) #define Opt2_cmdAllTabs ((1LU<<3) | IS_OPTION2) #ifdef XFT_SUPPORT # ifdef MULTICHAR_SET # define Opt2_xftNomFont ((1LU<<4) | IS_OPTION2) # define Opt2_xftSlowOutput ((1LU<<5) | IS_OPTION2) # endif # define Opt2_xftAntialias ((1LU<<6) | IS_OPTION2) # define Opt2_xftHinting ((1LU<<7) | IS_OPTION2) # define Opt2_xftAutoHint ((1LU<<8) | IS_OPTION2) # define Opt2_xftGlobalAdvance ((1LU<<9) | IS_OPTION2) #endif #define Opt2_syncTabTitle ((1LU<<10) | IS_OPTION2) #define Opt2_syncTabIcon ((1LU<<11) | IS_OPTION2) #define Opt2_hideTabbar ((1LU<<12) | IS_OPTION2) #define Opt2_bottomTabbar ((1LU<<13) | IS_OPTION2) #define Opt2_borderLess ((1LU<<14) | IS_OPTION2) #define Opt2_overrideRedirect ((1LU<<15) | IS_OPTION2) #define Opt2_broadcast ((1LU<<16) | IS_OPTION2) #define Opt2_hideButtons ((1LU<<17) | IS_OPTION2) #define Opt2_veryBold ((1LU<<18) | IS_OPTION2) #ifndef NO_BRIGHTCOLOR # define Opt2_boldColors ((1LU<<19) | IS_OPTION2) # define Opt_veryBright ((1LU<<20) | IS_OPTION2) #endif #define Opt2_noSysConfig ((1LU<<21) | IS_OPTION2) #define Opt2_disableMacros ((1LU<<22) | IS_OPTION2) #ifdef HAVE_X11_SM_SMLIB_H # define Opt2_enableSessionMgt ((1LU<<23) | IS_OPTION2) #endif #define Opt2_linuxHomeEndKey ((1LU<<24) | IS_OPTION2) #define Opt2_hlTabOnBell ((1LU<<25) | IS_OPTION2) #define Opt2_smoothResize ((1LU<<26) | IS_OPTION2) #define Opt2_smartResize ((1LU<<27) | IS_OPTION2) #define Opt2_autohideTabbar ((1LU<<28) | IS_OPTION2) #define Opt2_maximized ((1LU<<29) | IS_OPTION2) #define Opt2_fullscreen ((1LU<<30) | IS_OPTION2) #ifdef XFT_SUPPORT # define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize | Opt2_xftAntialias) #else # define DEFAULT_OPTIONS2 \ (Opt2_veryBold | Opt2_smartResize) #endif #define DEFAULT_OPTIONS3 \ (IS_OPTION3) #define DEFAULT_OPTIONS4 \ (IS_OPTION4) /* place holder used for parsing command-line options */ #define Opt_Reverse (1LU<<31) /* Macros to manipulate options (given an option array) */ #define ISSET_ARRAYOPT( array, option ) \ ( (array)[ (option) & OPTION_MASK ] & ( (option) & ~OPTION_MASK ) ) #define NOTSET_ARRAYOPT( array, option ) \ !ISSET_ARRAYOPT( array, option ) #define SET_ARRAYOPT( array, option ) \ ( (array)[ (option) & OPTION_MASK ] |= ( (option) & ~OPTION_MASK ) ) #define UNSET_ARRAYOPT( array, option ) \ ( (array)[ (option) & OPTION_MASK ] &= ~( (option) & ~OPTION_MASK ) ) #define TOGGLE_ARRAYOPT( array, option ) \ ( (array)[ (option) & OPTION_MASK ] ^= ( (option) & ~OPTION_MASK ) ) /* Macros to manipulate standard options */ #define ISSET_OPTION(R, OPT) \ ISSET_ARRAYOPT( (R)->Options, (OPT) ) #define NOTSET_OPTION(R, OPT) \ !ISSET_OPTION( (R), (OPT) ) #define SET_OPTION(R, OPT) \ SET_ARRAYOPT( (R)->Options, (OPT) ) #define UNSET_OPTION(R, OPT) \ UNSET_ARRAYOPT( (R)->Options, (OPT) ) #define TOGGLE_OPTION(R, OPT) \ TOGGLE_ARRAYOPT( (R)->Options, (OPT) ) #define PROPFONT_NORMAL (1<<0) #define PROPFONT_BOLD (1<<1) #define PROPFONT_MULTI (1<<2) /* * Weather or not we should use xftPfont / xftpfont while drawing text. This has * ABSOLUTELY NOTHING to do with PROPFONT_* or the propfont junk. This is used * for drawing tab titles / menubar / etc. */ #define NO_PFONT (0) #define USE_PFONT (1) #define USE_BOLD_PFONT (2) /* ------------------------------------------------------------------------- */ #ifdef HAVE_MENUBAR typedef struct { short state; Window win; GC gc; # ifdef BACKGROUND_IMAGE Pixmap pixmap; # endif unsigned long fg; unsigned long bg; unsigned long topshadow; unsigned long botshadow; # ifdef XFT_SUPPORT XftDraw *xftDraw; XftColor xftFore; # endif } menuBar_t; #endif #ifdef HAVE_SCROLLBARS typedef struct { char state; /* scrollbar state */ char init; /* scrollbar has been initialised */ short beg; /* slider sub-window begin height */ short end; /* slider sub-window end height */ short top; /* slider top position */ short bot; /* slider bottom position */ short style; /* style: rxvt, xterm, next */ short width; /* scrollbar width */ Window win; int (*update)(struct rxvt_vars *, int, int, int, int); GC gc; # ifdef BACKGROUND_IMAGE Pixmap pixmap; # endif # ifdef RXVT_SCROLLBAR unsigned long rxvt_fg; unsigned long rxvt_bg; unsigned long rxvt_topshadow; unsigned long rxvt_botshadow; # endif # ifdef XTERM_SCROLLBAR unsigned long xterm_fg; unsigned long xterm_bg; unsigned long xterm_shadow; # endif # ifdef PLAIN_SCROLLBAR unsigned long plain_fg; unsigned long plain_bg; # endif # ifdef NEXT_SCROLLBAR unsigned long next_fg; /* black */ unsigned long next_bg; /* gray */ unsigned long next_white; unsigned long next_dark; GC next_stippleGC; Pixmap next_dimple, next_upArrow, next_upArrowHi, next_downArrow, next_downArrowHi; # endif # ifdef SGI_SCROLLBAR unsigned long sgi_fg; /* medium */ unsigned long sgi_bg; /* light */ unsigned long sgi_black; unsigned long sgi_white; unsigned long sgi_lmedium; unsigned long sgi_dark; unsigned long sgi_vdark; GC sgi_stippleGC; Pixmap sgi_dimple, sgi_upArrow, sgi_upArrowHi, sgi_upArrowLow, sgi_downArrow, sgi_downArrowHi, sgi_downArrowLow; # endif } scrollBar_t; #endif /* HAVE_SCROLLBARS */ typedef struct { char state; /* tabbar state */ short ltab; /* last tab */ short atab; /* active tab */ short ptab; /* previous active tab */ short fvtab; /* first visible tab */ short lvtab; /* last visible tab */ Window win; #ifdef BACKGROUND_IMAGE Bool hasPixmap; /* has a background Pixmap */ #endif GC gc; /* tab background/foreground, grey25/black */ unsigned long fg; /* foreground, black */ unsigned long bg; /* background, grey25 */ unsigned long ifg; /* inactive tab foreground, black */ unsigned long ibg; /* inactive tab background, grey */ char rsfg; /* fg resource has changed */ char rsbg; /* bg resource has changed */ char rsifg; /* ifg resource has changed */ char rsibg; /* ibg resource has changed */ unsigned long frame; /* tab frame, white */ unsigned long delimit; /* delimit, dark grey */ #ifdef XFT_SUPPORT XftDraw* xftwin; /* XFT window */ XftColor xftfg; /* foreground */ XftColor xftifg; /* background */ #endif } tabBar_t; #ifdef BACKGROUND_IMAGE typedef struct { short w, h, x, y; Pixmap pixmap; } bgPixmap_t; #endif /* To suppress compile warning without xpm library */ #ifdef BACKGROUND_IMAGE # ifndef HAVE_LIBXPM # define XpmCloseness (0) # define XpmColormap (0) # define XpmVisual (0) # define XpmDepth (0) # define XpmSize (0) # define XpmReturnPixels (0) typedef struct { unsigned long valuemask; Visual* visual; Colormap colormap; unsigned int depth; unsigned int width; unsigned int height; unsigned int closeness; } XpmAttributes; # endif /* HAVE_LIBXPM */ #endif /* BACKGROUND_IMAGE */ typedef enum { TERMENV_XTERM = 0, TERMENV_RXVT, TERMENV_VT102, TERMENV_VT100, TERMENV_ANSI, TERMENV_DUMB, } termenv_t; struct term_t; typedef struct { /* * Index to vts. If it's -1, then this term_t structure is not used. * Otherwise, it is used by pointer vts[vts_idx]. This is to improve destroy * performance so that we only need to do (i = page..ltab) vts[i] = vts[i+1] * instead of vterm[i] = vterm[i+1]. */ short vts_idx; unsigned char profileNum; /* Profile used to init settings */ int globalTabNum; /* Number of tabs created before this tab during this processes lifetime */ /* moved from TermWin_t */ uint16_t saveLines; /* number of lines to save */ uint16_t num_scr; /* number of lines scrolled */ uint16_t nscrolled; /* number of line actually scrolled */ uint16_t view_start; /* scrollback view starts here */ uint16_t mapped; /* window state mapped? */ /* screen structure initialized? */ unsigned char BOOLVAR(init_screen, 1); Window vt; /* terminal window */ #ifdef XFT_SUPPORT XftDraw* xftvt; #endif #ifdef BACKGROUND_IMAGE Pixmap pixmap; /* background image, NOT used by */ bgPixmap_t bg; /* transparent window!!! */ XpmAttributes xpm_attr; /* original attr of image */ #endif /* Apparently, people like fg/bg colors for individual terminal */ unsigned long p_fg, p_bg, p_fgfade, p_bgfade; #ifdef XFT_SUPPORT XftColor p_xftfg, p_xftbg, p_xftfgfade, p_xftbgfade; #endif /* moved from rxvt_t */ text_t** drawn_text; /* text drawn on screen (characters) */ rend_t** drawn_rend; /* text drawn on screen (rendition) */ text_t** buf_text; rend_t** buf_rend; screen_t screen; #if NSCREENS screen_t swap; #endif /* move from hidden */ rend_t rstyle; uint16_t prev_ncol; /* previous columns */ uint16_t prev_nrow; /* previous rows */ /* moved from tab_t */ short tab_width; /* tab width */ char UNTAINTED * tab_title; /* tab title */ char *title_format; /* Format to be used to display the tab title */ char *winTitleFormat; /* Format of the window title (used when syncing the tab title */ /* moved from rxvt_t */ int cmd_fd; /* pty file descriptor; connected to command */ int tty_fd; /* tty file descriptor; connected to child */ /* moved from hidden */ unsigned char BOOLVAR( current_screen, 1); /* PRIMARY / SECONDARY */ #ifdef POINTER_BLANK unsigned char BOOLVAR( hidden_pointer, 1); /* pointer is hidden? */ #endif pid_t cmd_pid; char* ttydev; #ifndef RESET_TTY_TO_COMMON_DEFAULTS struct stat ttyfd_stat; /* original status of our tty */ #endif #ifndef NO_SETOWNER_TTYDEV unsigned char next_tty_action; #endif /* moved from hidden */ uint32_t PrivateModes; uint32_t SavedModes; #ifdef UTMP_SUPPORT #ifndef UTEMPTER_SUPPORT # ifdef HAVE_STRUCT_UTMP struct utmp ut; # endif # if defined(HAVE_STRUCT_UTMPX) && !defined(HAVE_STRUCT_UTMP) struct utmpx utx; # endif # if (defined(HAVE_STRUCT_UTMP) && defined(HAVE_UTMP_PID)) || defined(HAVE_STRUCT_UTMPX) char ut_id[5]; # endif int utmp_pos; #endif /* UTEMPTER_SUPPORT */ unsigned char next_utmp_action; #endif #if 0 char** command_argv; int command_argc; #endif /* move from rxvt_hidden */ ttymode_t tio; unsigned int ttymode; char rvideo; #ifdef MULTICHAR_SET char chstat, /* set ==> we only got half a glyph */ lost_multi, /* set ==> currently using 2 bytes per glyph */ multi_byte; #endif char charsets[4]; /* need to hold the terminal? * hold == 0: not hold * hold == 1: hold * hold > 1: can destroy the terminal now */ unsigned char BOOLVAR(hold,2), BOOLVAR(holdOption,3), /* Copy of the profile option for this tab.*/ BOOLVAR(gotEIO,1), /* Read on this terminal's fd got EIO */ BOOLVAR(dead,1), /* the terminal is dead or alive? */ BOOLVAR(highlight,1); /* the terminal is highlighted? */ int status; /* Status of child process after it exits */ /* the terminal TERM type */ termenv_t termenv; int scrolled_lines; /* If this tab is producing lots of data, this is the number of lines that have scrolled without a refresh request */ short monitor_tab; /* monitor tab status value, * see TAB_MON_* constants for possible values */ int monitor_nbytes_read; /* number of bytes read since monitor-start */ struct timeval monitor_start; /* epoch time of monitor starttime of the tab */ /* * Moved from hidden: want_refresh needs to be local to each tab. * want_full_refresh, refresh_type (except for SMOOTH_REFRESH), and * want_clip_refresh should be window (not tab) variables. */ unsigned char BOOLVAR( want_refresh, 1); /* Awaiting screen refresh */ int nbytes_last_read; /* Number of bytes read on the last read() call to child's fd */ /* * Data we want to write into cmd_fd is buffered in here, before being * written by rxvt_tt_write(). [Child's input buffer] */ unsigned char *v_buffer, /* pointer to physical buffer */ *v_bufstr, /* beginning of area to write */ *v_bufptr, /* end of area to write */ *v_bufend; /* end of physical buffer */ /* * Data read from cmd_fd is buffered in here [Child's output buffer] */ unsigned char *cmdbuf_escstart, /* Start of an escape sequence */ *cmdbuf_escfail, /* Position where processing of an escape sequence last failed */ *cmdbuf_ptr, /* current char */ *cmdbuf_endp; /* End of read child's output */ unsigned char cmdbuf_base[BUFSIZ]; } term_t; #define TAB_MON_OFF 0 /* tab monitoring off */ #define TAB_MON_ACTIVITY 1 /* monitor for activity */ #define TAB_MON_INACTIVITY 2 /* monitor for inactivity */ #define TAB_MON_AUTO 3 /* automatic discovery of monitor type */ #define TAB_MON_NOTIFICATION 4 /* inactivity/activity detected, notification needed */ /* Possible values for macros.modFlags */ #define MACRO_CTRL (1U << 0) #define MACRO_META (1U << 1) #define MACRO_SHIFT (1U << 2) #define MACRO_PRIMARY (1U << 3) /* Number of bits used by modifiers in modFlags */ #define MACRO_N_MOD_BITS (4) #define MACRO_MODMASK \ ( MACRO_CTRL | MACRO_META | MACRO_SHIFT | MACRO_PRIMARY ) #define MACRO_MAX_CHAINLEN (0xf) /* Get / set the macro number from modFlags */ #define MACRO_GET_NUMBER(x) \ (( (x) & ~MACRO_MODMASK ) >> MACRO_N_MOD_BITS) /* * Action to take when a macro is called / menu item is selected. */ typedef struct { unsigned short type; /* must not be changed; first element */ unsigned short len; /* strlen (str) */ unsigned char *str; /* action to take */ } action_t; /* Values for macro_t.type. Must sync this with macroNames from macros.c */ enum { MacroFnDummy=0, MacroFnEsc, MacroFnStr, MacroFnNewTab, MacroFnExec, MacroFnClose, MacroFnGoto, MacroFnMove, MacroFnScroll, MacroFnCopy, MacroFnPaste, MacroFnPasteFile, MacroFnMonitorTab, MacroFnToggleSubwin, MacroFnFont, MacroFnToggleVeryBold, MacroFnToggleBoldColors, MacroFnToggleVeryBright, MacroFnToggleTransp, MacroFnToggleBcst, MacroFnToggleHold, MacroFnToggleFullscreen, MacroFnRaise, MacroFnSetTitle, MacroFnUseFifo, MacroFnPrintScreen, MacroFnSaveConfig, MacroFnToggleMacros, NMACRO_FUNCS } macroFnNames; typedef unsigned char macro_priority_t; typedef struct { KeySym keysym; unsigned char modFlags; /* First 4 bits are the action order number. Last four bits are the modifiers */ macro_priority_t priority; action_t action; } macros_t; /* * profile_t structure. Contains information about each profile (formerly the * vt%d.xx resources. */ typedef struct _profile_t { unsigned long fg, bg; #ifdef XFT_SUPPORT XftColor xftfg, xftbg; #endif unsigned long fg_fade, bg_fade; # ifdef XFT_SUPPORT XftColor xftfg_fade, xftbg_fade; # endif int saveLines; unsigned char BOOLVAR( holdOption, 3 ); /* * Each profile also has a tab title, and command associated to it. However * since that's already stored in our resource options, we don't need * pointers for it here. */ } profile_t; typedef struct rxvt_vars { /* * These ``hidden'' items are not for public consumption and must not be * accessed externally * * 2006-02-19 gi1242: mrxvt was forked from rxvt. In rxvt, they compiled * common rxvt functions into a library "rxvtlib". Thus when loading * multiple versions of rxvt, this common code was linked to, saving some * memory. * * With tabs, we of course won't find this as useful. With grand dreams of * multiple windows, we'll never need it :). */ struct rxvt_hidden *h; /* * Exposed items * Changes to structure here require library version number change */ TermWin_t TermWin; #ifdef HAVE_SCROLLBARS scrollBar_t scrollBar; #endif #ifdef HAVE_MENUBAR menuBar_t menuBar; #endif tabBar_t tabBar; Display* Xdisplay; uint32_t Options[MAX_OPTION_ARRAY]; XSizeHints szHint; /* macros */ macros_t* macros; /* array of user defind macros */ unsigned short nmacros, /* Number of macros defined */ maxMacros; /* max # of macros that can be stored in memory pointed to by "macros" */ Colormap Xcmap; unsigned long *pixColorsFocus, *pixColorsUnfocus; /* Arrays of size TOTAL_COLORS. Pixel colors to be used when focused / unfocussed. */ unsigned long *pixColors; /* Array of size TOTAL_COLORS */ int ntabs; /* Number of tabs created so far during process lifetime */ int fgbg_tabnum; /* (Global) tab number corresponding to which Color_fg/bg are set */ #ifdef XFT_SUPPORT XftColor* xftColors; /* Array of size TOTAL_COLORS */ XftColor *xftColorsFocus, /* Same as above, but for Xft */ *xftColorsUnfocus; # endif profile_t profile[MAX_PROFILES]; Cursor term_pointer; /* cursor for vt window */ int Xdepth; int sb_shadow; /* scrollbar shadow width */ int Xfd; /* file descriptor of the X connection */ /* * term_t structures and pointers. * * 2006-08-18 gi1242 TODO: This should be an array that grows dynamically in * size. Plus we should only reserve enough memory for a our currently * displayed term structures. */ term_t vterm[MAX_PAGES]; term_t* vts[MAX_PAGES]; short tabClicked; /* Tab clicked by user. Used for moving tabs by drag and drop. */ unsigned char BOOLVAR( cleanDeadChilds, 1 ), /* True if we have marked some children as dead, but not called rxvt_clean_cmd_page() to clean them out */ BOOLVAR( gotEIO, 1 ); /* True if some read() got EIO */ short ndead_childs; /* number of children that have died */ short nAsyncChilds; /* Number of alive children launched via rxvt_async_exec */ short asyncChilds[MAX_CHILDS]; /* PIDS of children exec'ed via * rxvt_async_exec */ int num_fds; /* number of fd to monitor */ #ifdef USE_FIFO int fifo_fd; /* fd to read macros from */ char fifo_buf[FIFO_BUF_SIZE]; /* Buffer size of data read from fifo_fd */ char *fbuf_ptr; /* Pointer where data from fifo_fd should be read */ char *fifo_name; /* Name of the fifo */ #endif selection_t selection; sstyle_t selection_style; int numlock_state; char* tabstop; /* per location: 1 == tab-stop */ enum enc_label encoding_method; char** global_argv; int global_argc; } rxvt_t; typedef enum { HIDE_MENUBAR = 0, SHOW_MENUBAR, HIDE_TABBAR, SHOW_TABBAR, HIDE_SCROLLBAR, SHOW_SCROLLBAR, RESIZE_FONT, X_CONFIGURE, } resize_reason_t; /* MACROS for colors of individual terminals */ #if 0 #define VTFG(R, P) \ ((R)->pixColors[TOTAL_COLORS + (P)]) #define VTBG(R, P) \ ((R)->pixColors[TOTAL_COLORS + MAX_PAGES + (P)]) #ifdef XFT_SUPPORT # define VTXFTFG(R, P) \ ((R)->xftColors[TOTAL_COLORS + (P)]) # define VTXFTBG(R, P) \ ((R)->xftColors[TOTAL_COLORS + MAX_PAGES + (P)]) #endif /* XFT_SUPPORT */ #define ISSET_VTFG(R, P) \ (NULL != ((R)->h->rs[Rs_color + TOTAL_COLORS + (P)])) #define ISSET_VTBG(R, P) \ (NULL != ((R)->h->rs[Rs_color + TOTAL_COLORS + MAX_PAGES + (P)])) #endif #define VTFG(R, P) \ ((R)->profile[(P)].fg) #define VTBG(R, P) \ ((R)->profile[(P)].bg) #ifdef XFT_SUPPORT # define VTXFTFG(R, P) \ ((R)->profile[(P)].xftfg) # define VTXFTBG(R, P) \ ((R)->profile[(P)].xftbg) #endif /* XFT_SUPPORT */ # define VTFG_FADE(R, P) \ ((R)->profile[(P)].fg_fade) # define VTBG_FADE(R, P) \ ((R)->profile[(P)].bg_fade) # ifdef XFT_SUPPORT # define VTXFTFG_FADE(R, P) \ ((R)->profile[(P)].xftfg_fade) # define VTXFTBG_FADE(R, P) \ ((R)->profile[(P)].xftbg_fade) # endif /* XFT_SUPPORT */ #define ISSET_VTFG(R, P) \ (NULL != ((R)->h->rs[Rs_foreground + (P)] ) ) #define ISSET_VTBG(R, P) \ (NULL != ((R)->h->rs[Rs_background + (P)] ) ) /* MACROS for tab/page number */ #define ATAB(R) ((R)->tabBar.atab) #define LTAB(R) ((R)->tabBar.ltab) #define FVTAB(R) ((R)->tabBar.fvtab) #define LVTAB(R) ((R)->tabBar.lvtab) #define PTAB(R) ((R)->tabBar.ptab) #define APAGE(R) ((R)->tabBar.atab) #define LPAGE(R) ((R)->tabBar.ltab) #define FVPAGE(R) ((R)->tabBar.fvtab) #define LVPAGE(R) ((R)->tabBar.lvtab) #define PPAGE(R) ((R)->tabBar.ptab) /* MACROS for vts structure */ #define AVTS(R) ((R)->vts[(R)->tabBar.atab]) #define LVTS(R) ((R)->vts[(R)->tabBar.ltab]) #define PVTS(R, P) ((R)->vts[(P)]) #define SEL(R) ((R)->selection) #define ASCR(R) ((R)->vts[(R)->tabBar.atab]->screen) #define PSCR(R, P) ((R)->vts[(P)]->screen) /* macros for private/saved mode of term_t */ #define ISSET_PMODE(R, P, V) \ ((R)->vts[(P)]->PrivateModes & (V)) #define SET_PMODE(R, P, V) \ ((R)->vts[(P)]->PrivateModes |= (V)) #define UNSET_PMODE(R, P, V) \ ((R)->vts[(P)]->PrivateModes &= ~(V)) #define ISSET_SMODE(R, P, V) \ ((R)->vts[(P)]->SavedModes & (V)) #define SET_SMODE(R, P, V) \ ((R)->vts[(P)]->SavedModes |= (V)) #define UNSET_SMODE(R, P, V) \ ((R)->vts[(P)]->SavedModes &= ~(V)) /* Macro to determine weather we should the i-th tab or not */ #define SHOULD_HOLD( r, i ) \ ( \ ( HOLD_ALWAYSBIT & PVTS((r),(i))->holdOption ) \ || \ ( \ ( HOLD_NORMALBIT & PVTS((r),(i))->holdOption ) \ && !WIFEXITED( PVTS((r),(i))->status ) \ ) \ || \ ( \ ( HOLD_STATUSBIT & PVTS((r),(i))->holdOption ) \ && WEXITSTATUS( PVTS((r),(i))->status ) != 0 \ ) \ ) /***************************************************************************** * PROTOTYPES * *****************************************************************************/ void rxvt_main_loop(rxvt_t *); rxvt_t* rxvt_init (int, const char *const *); #endif /* __RXVTLIB_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/rxvtmem.c0000644000175000001440000004335510756127602012272 00000000000000/*--------------------------------*-C-*---------------------------------* * File: rxvtmem.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #include "rxvtmem.h" static const char* abort_msg = APL_NAME ": memory allocation failure. Aborting"; /* -------------------------------------------------------------------- * * MEMORY ALLOCATION WRAPPERS * * -------------------------------------------------------------------- */ #ifdef OUR_MALLOC #ifdef DEBUG static int memory_initialized = 0; #endif /* Use use our malloc function only if we bypass the memory check */ static int use_our_malloc = 1; /* Several notes: * . Block size must be aligned to 8 (64bit)!!! Or we will enforce it. * . Block size must be in increasing order!!! Or there will be crash. * no kidding ;) * . The last entry must have block size 0. Or we are going to access * all the memory available, and of course crash in the end ;-) */ static struct trunk_list_t g_trunk_list[] = { /* block_size, trunk_count, block_num/trunk_size, first_trunk */ { 16, 0, {125}, (struct trunk_head_t*) NULL}, { 32, 0, {150}, (struct trunk_head_t*) NULL}, { 48, 0, { 25}, (struct trunk_head_t*) NULL}, { 80, 0, { 0}, (struct trunk_head_t*) NULL}, {128, 0, { 0}, (struct trunk_head_t*) NULL}, {320, 0, { 0}, (struct trunk_head_t*) NULL}, {512, 0, { 4}, (struct trunk_head_t*) NULL}, { 0, 0, { 0}, (struct trunk_head_t*) NULL}, }; static unsigned int g_trunk_list_num; /* INTPROTO */ struct trunk_head_t* get_trunk(size_t trunk_size) { struct trunk_head_t* tk_head; void* ptr; if (IS_NULL(ptr = malloc (trunk_size + THEAD_OFFSET))) { rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); } rxvt_dbgmsg ((DBG_VERBOSE, DBG_MEMORY, "--Trunk allocated %d bytes\n", (int) trunk_size)); tk_head = (struct trunk_head_t*) ((char*) ptr + trunk_size); /* set the real beginning of trunk. this should only be used by * init_trunk and free_trunk */ tk_head->begin = (struct block_head_t*) ptr; return tk_head; } /* INTPROTO */ void init_trunk(struct trunk_head_t* tk_head, uint16_t block_size) { struct block_head_t* block; uint16_t i; size_t bmax; assert (NOT_NULL(tk_head)); assert (0 != block_size); #ifdef DEBUG tk_head->magic_f = tk_head->magic_e = TRUNK_MAGIC; tk_head->tbyte = 0; #endif bmax = ((char*) tk_head - (char*) tk_head->begin) / ((size_t) block_size + BHEAD_OFFSET); assert (bmax <= 0x0000ffff); /* in case of overflow */ tk_head->bmax = (uint16_t) bmax; block = tk_head->begin; tk_head->fblock = block; tk_head->fcount = tk_head->bmax; tk_head->bsize = block_size; /* initialize free block link list inside the trunk */ for (i = 0; i < tk_head->bmax; i ++) { #ifdef DEBUG block->magic_f = BLOCK_MAGIC; block->magic_e = BLOCK_MAGIC; # ifdef DEBUG_MEMORY MEMSET(block + 1, MEMORY_MAGIC, block_size); # endif #endif block->u.next = (struct block_head_t*) ((char*) block + block_size + BHEAD_OFFSET); block = block->u.next; } } /* INTPROTO */ void free_trunk(struct trunk_head_t* tk_head) { assert (NOT_NULL(tk_head)); #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->magic_f); assert (TRUNK_MAGIC == tk_head->magic_e); #endif rxvt_dbgmsg ((DBG_VERBOSE, DBG_MEMORY, "--Trunk freed %d bytes\n", (int) ((char*) tk_head - (char*) tk_head->begin))); free ((void*) tk_head->begin); } /* * This function increase the trunk size for a trunk list if we decide * that there are many memory allocation for this trunk list. Whether * it really improve the performance is a question to answer. ;-) It * just shows something that we can abuse with our own memory system. */ /* INTPROTO */ void optimize_trunk_size(struct trunk_list_t* tklist) { register size_t tsize; assert (NOT_NULL(tklist)); assert (NOT_NULL(tklist->first_trunk)); /* already optimal trunk size, nothing to do */ if (tklist->u.tsize >= OPTIMAL_TRUNK_SIZE) return; /* optimize trunk size by increasing it!) * . obtain a trunk size based on DEFAULT_TRUNK_SIZE * . decide whether we should increase trunk size * . do not use the size obtained based on DEFAULT_TRUNK_SIZE * in order to avoid fragmentation. */ tsize = DEFAULT_TRUNK_SIZE << (tklist->trunk_count / TRUNK_INCREASE_STAGE); if (tsize >= (tklist->u.tsize << 1)) tklist->u.tsize <<= 1; } /* * This function decrease the trunk size for a trunk list if we decide * that there are less memory allocation for this trunk list. */ /* INTPROTO */ void shrink_trunk_size(struct trunk_list_t* tklist) { register size_t tsize; assert (NOT_NULL(tklist)); assert (NOT_NULL(tklist->first_trunk)); /* already optimal trunk size, nothing to do */ if (tklist->u.tsize <= DEFAULT_TRUNK_SIZE) return; /* shrink trunk size it!) * . obtain a trunk size based on DEFAULT_TRUNK_SIZE * . decide whether we should decrease trunk size */ tsize = DEFAULT_TRUNK_SIZE << (tklist->trunk_count / TRUNK_INCREASE_STAGE); if (tsize <= (tklist->u.tsize >> 1)) tklist->u.tsize >>= 1; } /* EXTPROTO */ void rxvt_mem_init(void) { register unsigned int i; struct trunk_list_t* tklist; #ifdef DEBUG memory_initialized = 1; #endif /* use system malloc */ if (!use_our_malloc) return; /* allocate and initialize trunk memory */ for (i = 0, tklist = g_trunk_list; 0 != tklist->block_size; tklist ++, i++) { size_t tsize; if (tklist->block_size & 0x07) { /* block is not aligned to 8, we'll align it */ tklist->block_size &= ~(0x07); tklist->block_size += 8; } /* really bad size, want to overflow us? ;-) */ if (tklist->block_size > MINIMAL_TRUNK_SIZE) tklist->block_size = MINIMAL_TRUNK_SIZE; if (0 == tklist->u.bnum) tsize = DEFAULT_TRUNK_SIZE; else { /* really bad number, want to overflow us? ;-) */ if (tklist->u.bnum > 0x0000ffff) tklist->u.bnum = 0x0000ffff; /* get *optimal* real trunk size */ tsize = (tklist->block_size + BHEAD_OFFSET) * tklist->u.bnum; if (tsize > MAXIMAL_TRUNK_SIZE) tsize = MAXIMAL_TRUNK_SIZE; if (tsize < MINIMAL_TRUNK_SIZE) tsize = MINIMAL_TRUNK_SIZE; } /* OK, this supposes to be the optimal size */ tklist->u.tsize = tsize; tklist->first_trunk = get_trunk (tsize), tklist->first_trunk->list = tklist, tklist->trunk_count ++; /* increase trunk counter */ init_trunk (tklist->first_trunk, tklist->block_size); SET_NULL(tklist->first_trunk->next); SET_NULL(tklist->first_trunk->prev); } /* for */ g_trunk_list_num = i; } /* EXTPROTO */ void rxvt_mem_exit (void) { /* use system malloc */ if (!use_our_malloc) return; #ifdef DEBUG assert (memory_initialized); #endif { struct trunk_list_t* tklist; for (tklist = g_trunk_list; 0 != tklist->block_size; tklist ++) { struct trunk_head_t* tk_head; while (NOT_NULL(tk_head = tklist->first_trunk)) { #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->magic_f); assert (TRUNK_MAGIC == tk_head->magic_e); #endif tklist->first_trunk = tk_head->next; /* new first trunk */ free_trunk (tk_head), tklist->trunk_count --; /* decrease trunk counter */ } /* while */ } /* for */ } } /* EXTPROTO */ void* rxvt_malloc(size_t size) { struct block_head_t* block; #ifdef DEBUG assert (memory_initialized); rxvt_dbgmsg ((DBG_VERBOSE, DBG_MEMORY, "rxvt_malloc (%d)\n", (int) size))); #endif if (!use_our_malloc || /* use system malloc, or request size is big */ (size > g_trunk_list[g_trunk_list_num - 1].block_size)) { if (0 == size) size = 1; if (IS_NULL(block = malloc (size + BHEAD_OFFSET))) { rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); } #ifdef DEBUG block->magic_f = BLOCK_MAGIC; block->magic_e = BLOCK_MAGIC; #endif /* set special trunk address */ block->u.trunk = (struct trunk_head_t*) SYS_MALLOC_PTR; } else { struct trunk_list_t* tklist; register int idx; assert (size <= (size_t) g_trunk_list[g_trunk_list_num - 1].block_size); /* look for appropriate block_info entry */ for (idx = 0; (idx < g_trunk_list_num) && (size > g_trunk_list[idx].block_size); idx ++) ; tklist = &g_trunk_list[idx]; assert (tklist->first_trunk); #ifdef DEBUG assert (TRUNK_MAGIC == tklist->first_trunk->magic_f); assert (TRUNK_MAGIC == tklist->first_trunk->magic_e); #endif /* find the free block */ block = tklist->first_trunk->fblock; #ifdef DEBUG assert (BLOCK_MAGIC == block->magic_f); assert (BLOCK_MAGIC == block->magic_e); block->bbyte = size; tklist->first_trunk->tbyte += size; #endif /* adjust information in trunk_head */ tklist->first_trunk->fblock = block->u.next; tklist->first_trunk->fcount --; /* Set the address of trunk head so that we can find it in free. * Notice that u.trunk is the placehold for u.next when block is * free!!! */ block->u.trunk = tklist->first_trunk; /* if no free block left in the trunk */ if (0 == tklist->first_trunk->fcount) { #ifdef DEBUG /* print out statistics for the trunk */ rxvt_dbgmsg ((DBG_VERBOSE, DBG_MEMORY, "--Trunk of block size %d: %d bytes used (%d%%)\n", tklist->block_size, (int) tklist->first_trunk->tbyte, (int) (tklist->first_trunk->tbyte * 100 / (tklist->block_size * tklist->first_trunk->bmax)))); #endif if (IS_NULL(tklist->first_trunk->next)) { /* no free trunk in this trunk list, allocate a new trunk */ struct trunk_head_t* new_trunk; new_trunk = get_trunk (tklist->u.tsize), new_trunk->list = tklist, tklist->trunk_count ++, /* increase trunk counter */ optimize_trunk_size (tklist); init_trunk (new_trunk, tklist->block_size); SET_NULL(new_trunk->next); SET_NULL(new_trunk->prev); /* clean up the old trunk */ SET_NULL(tklist->first_trunk->next); SET_NULL(tklist->first_trunk->prev); /* insert new trunk into trunk list */ tklist->first_trunk = new_trunk; } else { /* there is some free trunk in this trunk list, remove the * first trunk from the trunk list */ struct trunk_head_t* remove = tklist->first_trunk; tklist->first_trunk = remove->next; #ifdef DEBUG assert (TRUNK_MAGIC == tklist->first_trunk->magic_f); assert (TRUNK_MAGIC == tklist->first_trunk->magic_e); #endif SET_NULL(tklist->first_trunk->prev); /* clean up the old trunk */ SET_NULL(remove->next); SET_NULL(remove->prev); } } } /* now return the free block, BUT skip the block_head_t first */ block ++; return block; } /* EXTPROTO */ void* rxvt_calloc(size_t number, size_t size) { void* ptr; size_t total = number * size; #ifdef DEBUG assert (memory_initialized); #endif /* possible overflow? */ assert (total >= 0 && size > 0); assert ((total / size) == number); ptr = rxvt_malloc (total); /* calloc requires us to zero out the memory, slow call */ MEMSET(ptr, 0, total); return (ptr); } /* EXTPROTO */ void* rxvt_realloc(void* ptr, size_t size) { struct block_head_t* block; struct trunk_head_t* tk_head; #ifdef DEBUG assert (memory_initialized); #endif if (IS_NULL(ptr)) return (rxvt_malloc (size)); /* find the real block head structure */ block = (struct block_head_t*) ptr; block --; #ifdef DEBUG assert (BLOCK_MAGIC == block->magic_f); assert (BLOCK_MAGIC == block->magic_e); #endif /* find trunk_head_t structure for ptr */ tk_head = block->u.trunk; if ((struct trunk_head_t*) SYS_MALLOC_PTR == tk_head) { /* ptr was allocated useing system malloc here */ block = realloc (block, size + BHEAD_OFFSET); if (IS_NULL(block)) { rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); } #ifdef DEBUG block->magic_f = BLOCK_MAGIC; block->magic_e = BLOCK_MAGIC; #endif /* set special trunk address */ block->u.trunk = (struct trunk_head_t*) SYS_MALLOC_PTR; /* skip block structure */ block ++; } else { /* now do some serious business about reallocating this ptr */ #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->magic_f); assert (TRUNK_MAGIC == tk_head->magic_e); #endif /* nothing to do if this block is actually big enough */ if (size <= (size_t) tk_head->bsize) return ptr; block = rxvt_malloc (size); MEMCPY (block, ptr, tk_head->bsize); /* a bit waste, though */ rxvt_free (ptr); } return (block); } /* EXTPROTO */ void rxvt_free(void* ptr) { struct block_head_t* block; struct trunk_head_t* tk_head; #ifdef DEBUG assert (memory_initialized); #endif #if 0 assert (NOT_NULL(ptr)); /* generate core dump */ #else /* * 2006-11-19 gi1242: glibc accepts free(NULL), and has been used in a few * places throughout the mrxvt code base. It's better to fail gracefully * here, as opposed to code bloat by first testing if a pointer is not null * before calling rxvt_free(). */ if( IS_NULL(ptr) ) return; #endif block = (struct block_head_t*) ptr; /* find the block_head_t structure */ block --; #ifdef DEBUG assert (BLOCK_MAGIC == block->magic_f); assert (BLOCK_MAGIC == block->magic_e); #endif /* find trunk_head_t structure for ptr */ tk_head = block->u.trunk; /* use system malloc */ if ((struct trunk_head_t*) SYS_MALLOC_PTR == tk_head) { free (block); } else { #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->magic_f); assert (TRUNK_MAGIC == tk_head->magic_e); tk_head->tbyte -= block->bbyte; # ifdef DEBUG_MEMORY MEMSET (ptr, MEMORY_MAGIC, tk_head->list->block_size); # endif #endif /* Insert the block of ptr to the head of free block link list. * Notice that u.next is the placeholder for u.trunk when block * is in use!!! */ block->u.next = tk_head->fblock; tk_head->fblock = block; /* increase free block counter */ tk_head->fcount ++; if (1 == tk_head->fcount) { /* link the trunk back to the trunk list if all blocks were * allocated previously */ struct trunk_list_t* tklist; tklist = tk_head->list; assert (IS_NULL(tk_head->prev)); assert (IS_NULL(tk_head->next)); assert (NOT_NULL(tklist->first_trunk)); #ifdef DEBUG assert (TRUNK_MAGIC == tklist->first_trunk->magic_f); assert (TRUNK_MAGIC == tklist->first_trunk->magic_e); #endif tk_head->next = tklist->first_trunk; tklist->first_trunk->prev = tk_head; /* insert this trunk into the beginnig of trunk list */ tklist->first_trunk = tk_head; } else if (tk_head->fcount == tk_head->bmax) { /* we can free this trunk now since all blocks in it are free. * but we do not free it if it is the only trunk in its trunk * list. */ struct trunk_list_t* tklist; tklist = tk_head->list; if (tklist->first_trunk == tk_head) { /* this trunk is the first in trunk list */ if (NOT_NULL(tk_head->next)) { #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->next->magic_f); assert (TRUNK_MAGIC == tk_head->next->magic_e); #endif tklist->first_trunk = tk_head->next; tklist->first_trunk->prev = NULL; free_trunk (tk_head), tklist->trunk_count --, /* decrease trunk counter */ shrink_trunk_size (tklist); } } else { /* this trunk is not the first in trunk list */ #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->prev->magic_f); assert (TRUNK_MAGIC == tk_head->prev->magic_e); #endif tk_head->prev->next = tk_head->next; if (NOT_NULL(tk_head->next)) { #ifdef DEBUG assert (TRUNK_MAGIC == tk_head->next->magic_f); assert (TRUNK_MAGIC == tk_head->next->magic_e); #endif tk_head->next->prev = tk_head->prev; } free_trunk (tk_head), tklist->trunk_count --, /* decrease trunk counter */ shrink_trunk_size (tklist); } } } } #else /* !OUR_MALLOC */ /* EXTPROTO */ void* rxvt_malloc(size_t size) { void* p; /* see AC_FUNC_MALLOC macro in autoconf documentation */ if (0 == size) size = 1; p = malloc(size); if (p) return p; rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); /* NOTREACHED */ } /* EXTPROTO */ void* rxvt_calloc(size_t number, size_t size) { void* p; p = calloc(number, size); if (p) return p; rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); /* NOTREACHED */ } /* EXTPROTO */ void* rxvt_realloc(void *ptr, size_t size) { void* p; if (ptr) p = realloc(ptr, size); else p = malloc(size); if (p) return p; rxvt_msg (DBG_FATAL, DBG_MEMORY, abort_msg); exit(EXIT_FAILURE); /* NOT REACHED */ } /* EXTPROTO */ void rxvt_free(void* ptr) { #if 0 assert (NOT_NULL(ptr)); /* generate core dump */ #endif free (ptr); } #endif /* OUR_MALLOC */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/rxvtmem.h0000644000175000001440000001037111034734513012262 00000000000000/*--------------------------------*-H-*---------------------------------* * File: rxvtmem.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 2006 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __RXVTMEM_H__ #define __RXVTMEM_H__ #ifdef OUR_MALLOC struct block_head_t; struct trunk_head_t; struct trunk_list_t; #ifdef DEBUG #define TRUNK_MAGIC (0x41414141) #define BLOCK_MAGIC (0x43434343) #define MEMORY_MAGIC (0x47474747) #endif /* special pointer to indicate that the block is allocated using system * wide malloc instead of our trunk/block system. It means that we will * waste some memory on tracking these memory blocks before initializing * our track/block system. */ #define SYS_MALLOC_PTR (-1) /* * This structure has two states: (1) when it records a free block, u.next * stores the address of next block's head; (2) when it records a block * in use, u.trunk stores the address of the trunk it belonds to. */ struct block_head_t { #ifdef DEBUG uint32_t magic_f; /* magic number */ size_t bbyte; /* allocated bytes */ #endif union { struct block_head_t* next; /* next block */ struct trunk_head_t* trunk; /* address of trunk_head */ } u; #ifdef DEBUG uint32_t magic_e; /* magic number */ #endif }; /* * Note: the name trunk_head_t is somewhat misleading. Actually it resides * at the END of each allocated trunk. */ struct trunk_head_t { #ifdef DEBUG uint32_t magic_f; /* magic number */ size_t tbyte; /* total allocated bytes in this trunk */ #endif struct block_head_t* begin;/* begin address of the trunk. this is * ONLY used by get_trunk, init_trunk * and free trunk, and NOTHING ELSE!!! */ struct trunk_head_t* prev; /* prev trunk with the same block size */ struct trunk_head_t* next; /* next trunk with the same block size */ struct trunk_list_t* list; /* entry in the trunk list of this trunk*/ struct block_head_t* fblock; /* first free block in this trunk */ uint16_t bmax; /* max # of free blocks in this trunk */ uint16_t fcount; /* # of free blocks in this trunk */ uint16_t bsize; /* block size to allocate (exclude head) */ #ifdef DEBUG uint32_t magic_e; /* magic number */ #endif }; /* * Header for trunk list of each block size */ struct trunk_list_t { uint16_t block_size; /* block size for this trunk list */ uint16_t trunk_count;/* how many trunks allocated */ union { size_t bnum; /* number of blocks to allocate, used * before rxvt_mem_init as hint */ size_t tsize; /* actual trunk size (exclude trunk head) * after rxvt_mem_init */ } u; struct trunk_head_t* first_trunk; }; /* size of trunk_head_t and block_head_t */ #define THEAD_OFFSET (sizeof (struct trunk_head_t)) #define BHEAD_OFFSET (sizeof (struct block_head_t)) /* 4KB is the default trunk size */ #define DEFAULT_TRUNK_SIZE (1UL << 12) /* 1KB is the minimal trunk size */ #define MINIMAL_TRUNK_SIZE (1UL << 10) /* 64KB is the optimal trunk size */ #define OPTIMAL_TRUNK_SIZE (1UL << 16) /* 1MB is the maximal trunk size, are you crazy?! */ #define MAXIMAL_TRUNK_SIZE (1UL << 20) /* stage threshold to increase trunk size based on trunk count in a * trunk list. */ #define TRUNK_INCREASE_STAGE (3) #endif /* OUR_MALLOC */ #endif /* __RXVTMEM_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/right_d.xpm0000644000175000001440000000077310756127602012567 00000000000000/* XPM */ static char * right_d_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #8585F8", "..................", "..................", "..................", "......+...........", "......++..........", "......+++.........", "......++++........", "......+++++.......", "......++++++......", "......+++++++.....", "......++++++......", "......+++++.......", "......++++........", "......+++.........", "......++..........", "......+...........", "..................", ".................."}; mrxvt-0.5.4/src/scrollbar-xterm.c0000644000175000001440000001172210756127602013701 00000000000000/*--------------------------------*-C-*---------------------------------* * File: scrollbar-xterm.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1999-2001 Geoff Wing * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" /*----------------------------------------------------------------------*/ #ifdef HAVE_SCROLLBARS #ifdef XTERM_SCROLLBAR #define CHOOSE_GC_FG(R, PIXCOL) \ XSetForeground ((R)->Xdisplay, (R)->scrollBar.gc, (PIXCOL)) #define x_stp_width (8) #define x_stp_height (2) const unsigned char x_stp_bits[] = { 0x55, 0xaa }; /* EXTPROTO */ void rxvt_scrollbar_init_xterm (rxvt_t* r) { XGCValues gcvalue; unsigned long gcmask; UNSET_GC(r->scrollBar.gc); /* Initialize the colors */ r->scrollBar.xterm_fg = r->pixColorsFocus[Color_fg]; r->scrollBar.xterm_bg = r->pixColorsFocus[Color_bg]; r->scrollBar.xterm_shadow = r->pixColorsFocus[Color_border]; gcvalue.stipple = XCreateBitmapFromData (r->Xdisplay, r->scrollBar.win, (char *)x_stp_bits, x_stp_width, x_stp_height); assert (IS_PIXMAP(gcvalue.stipple)); gcvalue.fill_style = FillOpaqueStippled; gcvalue.foreground = r->scrollBar.xterm_fg; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcvalue.background = r->scrollBar.xterm_bg; gcmask = GCForeground | GCFillStyle | GCStipple; #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif gcmask |= GCBackground; r->scrollBar.gc = XCreateGC (r->Xdisplay, r->scrollBar.win, gcmask, &gcvalue); assert (IS_GC(r->scrollBar.gc)); #ifdef TRANSPARENT /* set background color when there's no transparent */ if (!(ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar) )) #endif #ifdef BACKGROUND_IMAGE /* set background color when there's no bg image */ if (NOT_PIXMAP(r->scrollBar.pixmap)) #endif XSetWindowBackground (r->Xdisplay, r->scrollBar.win, r->scrollBar.xterm_bg); } void rxvt_scrollbar_exit_xterm (rxvt_t* r) { /* No resources to free */ } /* EXTPROTO */ int rxvt_scrollbar_show_xterm(rxvt_t *r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len) { int xsb = 0; int sbwidth = r->scrollBar.width - 1; int clear = 0; /* scrollbar slider */ #ifdef TRANSPARENT if (ISSET_OPTION(r, Opt_transparent) && ISSET_OPTION(r, Opt_transparent_scrollbar)) clear = 1; else #endif #ifdef BACKGROUND_IMAGE if (IS_PIXMAP(r->scrollBar.pixmap)) clear = 1; else #endif clear = 0; xsb = ISSET_OPTION(r, Opt_scrollBar_right) ? 1 : 0; if (last_top < r->scrollBar.top) XClearArea(r->Xdisplay, r->scrollBar.win, r->sb_shadow + xsb, last_top, sbwidth, (r->scrollBar.top - last_top), False); if (r->scrollBar.bot < last_bot) XClearArea(r->Xdisplay, r->scrollBar.win, r->sb_shadow + xsb, r->scrollBar.bot, sbwidth, (last_bot - r->scrollBar.bot + clear), False); /* scrollbar slider */ CHOOSE_GC_FG(r, r->scrollBar.xterm_fg); XFillRectangle(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, r->sb_shadow + xsb + 1, r->scrollBar.top, sbwidth - 2, scroller_len); CHOOSE_GC_FG(r, r->scrollBar.xterm_shadow); XDrawLine(r->Xdisplay, r->scrollBar.win, r->scrollBar.gc, xsb ? r->sb_shadow : r->sb_shadow + sbwidth, r->scrollBar.beg, xsb ? r->sb_shadow : r->sb_shadow + sbwidth, r->scrollBar.end); return 1; } #endif /* XTERM_SCROLLBAR */ #endif /* HAVE_SCROLLBARS */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/protos.h0000644000175000001440000007034211006153677012117 00000000000000/*--------------------------------*-H-*---------------------------------* * File: protos.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1997-2001 Geoff Wing * Copyright (c) 2004 Sergey Popov * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __PROTOS_H__ #define __PROTOS_H__ /* Begin prototypes of command.c */ void rxvt_cmd_write __PROTO((rxvt_t* r, int page, const unsigned char* str, unsigned int count)); FILE* rxvt_popen_printer __PROTO((rxvt_t *r, const char *pipeName)); int rxvt_pclose_printer __PROTO((FILE *stream)); void rxvt_xterm_seq __PROTO((rxvt_t* r, int page, int op, const char* str, unsigned char resp __attribute__((unused)))); void rxvt_tt_printf __PROTO((rxvt_t* r, int page, const char* fmt,...)); void rxvt_tt_write __PROTO((rxvt_t* r, int page, const unsigned char* d, int len)); void rxvt_pointer_unblank __PROTO((rxvt_t* r, int page)); void rxvt_resize_on_subwin __PROTO((rxvt_t* r, resize_reason_t reason)); void rxvt_resize_on_font __PROTO((rxvt_t* r, char* fontname)); /* End prototypes of command.c */ /* Begin prototypes of encoding.c */ #ifdef MULTICHAR_SET void rxvt_decode_euc2jis __PROTO((unsigned char* str, int len)); void rxvt_decode_sjis2jis __PROTO((unsigned char* str, int len)); void rxvt_decode_gb180302jis __PROTO((unsigned char* str, int len)); void rxvt_set_multichar_encoding __PROTO((rxvt_t* r, const char* str)); #endif void rxvt_decode_dummy __PROTO((unsigned char* str, int len)); void rxvt_set_default_locale __PROTO((rxvt_t *r)); char* rxvt_get_encoding_from_locale __PROTO((rxvt_t *r)); void rxvt_set_default_font_x11 __PROTO((rxvt_t *r)); char* rxvt_fallback_mfont_x11 __PROTO((rxvt_t *r)); #ifdef XFT_SUPPORT void rxvt_set_default_font_xft __PROTO((rxvt_t *r)); char* rxvt_fallback_mfont_xft __PROTO((rxvt_t *r)); #endif char* rxvt_encoding_name __PROTO((rxvt_t *r)); /* End prototypes of defaultfont.c */ /* Begin prototypes of grkelot.c */ #ifdef GREEK_SUPPORT void greek_init __PROTO((void)); void greek_end __PROTO((void)); void greek_reset __PROTO((void)); void greek_setmode __PROTO((int greek_mode)); int greek_getmode __PROTO((void)); int greek_xlat __PROTO((char* s, int num_chars)); #endif /* End prototypes of grkelot.c */ /* Begin prototypes of macros.c */ int rxvt_parse_macros __PROTO((rxvt_t*, const char *, const char *, macro_priority_t priority)); void rxvt_cleanup_macros __PROTO((rxvt_t*)); Bool rxvt_set_action __PROTO((action_t*, char*)); int rxvt_process_macros __PROTO((rxvt_t*, KeySym, XKeyEvent*)); int rxvt_dispatch_action __PROTO((rxvt_t*, action_t*, XEvent *ev)); void rxvt_toggle_verybold __PROTO((rxvt_t*)); void rxvt_toggle_subwin __PROTO((rxvt_t*, const unsigned char *)); /* End prototypes of macros.c */ /* Begin prototypes of init.c */ int rxvt_init_vars __PROTO((rxvt_t* r)); void rxvt_init_secondary __PROTO((rxvt_t* r)); void rxvt_set_jumpscroll __PROTO((rxvt_t* r)); const char ** rxvt_init_resources __PROTO((rxvt_t* r, int argc, const char* const *argv)); #ifdef XFT_SUPPORT void rxvt_fade_color __PROTO((rxvt_t* r, const XColor *xcol, unsigned long *pix_return, XftColor *xft_return)); #else void rxvt_fade_color __PROTO((rxvt_t* r, const XColor *xcol, unsigned long *pix_return, void *xft_return)); #endif int rxvt_set_fgbg_colors __PROTO((rxvt_t* r, int page)); int rxvt_set_vt_colors __PROTO((rxvt_t* r, int page)); void rxvt_copy_color __PROTO((rxvt_t*, int, int)); void rxvt_set_color __PROTO((rxvt_t*, int, const XColor*)); void rxvt_init_env __PROTO((rxvt_t *r)); void rxvt_init_xlocale __PROTO((rxvt_t *r)); void rxvt_init_fifo __PROTO((rxvt_t *r)); void rxvt_init_command __PROTO((rxvt_t* r)); CARD32 rxvt_get_desktop __PROTO((rxvt_t* r)); void rxvt_create_show_windows __PROTO((rxvt_t* r, int argc, const char* const *argv)); void rxvt_destroy_termwin __PROTO((rxvt_t* r, int page)); void rxvt_create_termwin __PROTO((rxvt_t* r, int page, int profile, const char TAINTED * title)); const char* getProfileOption __PROTO(( rxvt_t *r, int profile, int resource )); Status ewmh_message __PROTO(( Display *, Window, Window, Atom, long, long, long, long, long)); int rxvt_async_exec __PROTO((rxvt_t*, const char *)); int rxvt_run_command __PROTO((rxvt_t* r, int page, const char** argv)); void clean_sigmasks_and_fds __PROTO((rxvt_t* r, int page)); termenv_t rxvt_get_termenv __PROTO((const char* str)); char** rxvt_string_to_argv __PROTO((const char*, int*)); /* End prototypes of init.c */ /* Begin prototypes of logging.c */ #ifdef UTMP_SUPPORT void rxvt_makeutent __PROTO((rxvt_t* r, int page, const char* pty, const char* hostname)); void rxvt_cleanutent __PROTO((rxvt_t* r, int page)); #endif /* End prototypes of logging.c */ /* Begin prototypes of rxvtmem.c */ #ifdef OUR_MALLOC void rxvt_mem_init __PROTO((void)); void rxvt_mem_exit __PROTO((void)); #endif /* OUR_MALLOC */ void* rxvt_malloc __PROTO((size_t size)); void* rxvt_calloc __PROTO((size_t number, size_t size)); void* rxvt_realloc __PROTO((void *ptr, size_t size)); void rxvt_free __PROTO((void *ptr)); /* End prototypes of rxvtmem.c */ /* Begin prototypes of main.c */ void rxvt_privileges __PROTO((int mode)); RETSIGTYPE rxvt_Child_signal __PROTO((int sig __attribute__((unused)))); RETSIGTYPE rxvt_Exit_signal __PROTO((int sig)); void rxvt_exit_request __PROTO((rxvt_t*)); void rxvt_clean_exit __PROTO((rxvt_t* r)); void rxvt_close_all_tabs __PROTO((rxvt_t* r)); void rxvt_privileged_utmp __PROTO((rxvt_t* r, int page, char action)); void rxvt_privileged_ttydev __PROTO((rxvt_t* r, int page, char action)); void rxvt_tt_winsize __PROTO((int fd, unsigned short col, unsigned short row, pid_t pid)); void rxvt_init_font_x11 __PROTO((rxvt_t *r)); int rxvt_change_font_x11 __PROTO((rxvt_t* r, const char* fontname)); #ifdef XFT_SUPPORT int rxvt_init_font_xft __PROTO((rxvt_t *r)); int rxvt_change_font_xft __PROTO((rxvt_t* r, const char* fontname)); #endif void rxvt_set_win_title __PROTO((rxvt_t* r, Window win, const char* str)); void rxvt_set_term_title __PROTO((rxvt_t* r, const unsigned char* str)); void rxvt_set_icon_name __PROTO((rxvt_t* r, const unsigned char* str)); void rxvt_set_window_color __PROTO((rxvt_t* r, int page, int idx, const char* color)); void rxvt_recolour_cursor __PROTO((rxvt_t *r)); #ifdef XFT_SUPPORT int rxvt_alloc_xft_color __PROTO((rxvt_t *r, const XColor *xcol, XftColor* xftcolor)); #endif int rxvt_parse_alloc_color __PROTO((rxvt_t* r, XColor *screen_in_out, const char* colour)); int rxvt_alloc_color __PROTO((rxvt_t* r, XColor *screen_in_out, const char* colour)); void rxvt_set_widthheight __PROTO((rxvt_t* r, unsigned int width, unsigned int height)); void rxvt_IM_send_spot __PROTO((rxvt_t *r)); void rxvt_IM_set_fontset __PROTO((rxvt_t* r, int idx)); void rxvt_IM_init_callback __PROTO((Display *unused __attribute__((unused)), XPointer client_data __attribute__((unused)), XPointer call_data __attribute__((unused)))); void rxvt_IM_resize __PROTO((rxvt_t *r)); rxvt_t * rxvt_get_r __PROTO((void)); /* End prototypes of main.c */ /* Begin prototypes of menubar.c */ #ifdef HAVE_MENUBAR void rxvt_menubar_resize __PROTO((rxvt_t*)); void rxvt_menubar_create __PROTO((rxvt_t*)); void rxvt_menubar_clean_exit __PROTO((rxvt_t*)); int rxvt_menubar_hide __PROTO((rxvt_t*)); int rxvt_menubar_show __PROTO((rxvt_t*)); void rxvt_menubar_expose __PROTO((rxvt_t*)); void rxvt_menubar_dispatcher __PROTO((rxvt_t*, unsigned char*)); void rxvt_menubar_control __PROTO((rxvt_t*, XButtonEvent*)); void rxvt_menubar_load_file __PROTO((rxvt_t*, const unsigned char*)); int rxvt_is_menubar_win __PROTO((rxvt_t*, Window)); unsigned short rxvt_menubar_height __PROTO((rxvt_t*)); unsigned short rxvt_menubar_rheight __PROTO((rxvt_t*)); int rxvt_menubar_visible __PROTO((rxvt_t*)); void rxvt_menu_show __PROTO((rxvt_t*)); int rxvt_menu_select __PROTO((rxvt_t*, XButtonEvent*)); #endif /* End prototypes of menubar.c */ /* Begin prototypes of misc.c */ char * rxvt_r_basename __PROTO((const char* str)); int rxvt_str_match __PROTO((const char* s1, const char* s2)); const char* rxvt_str_skip_space __PROTO((const char* str)); char* rxvt_str_trim __PROTO((char* str)); int rxvt_str_escaped __PROTO((char* str)); int rxvt_percent_interpolate __PROTO((rxvt_t*, int, const char *, int, char *, int)); char** rxvt_splitcommastring __PROTO((const char* cs)); char* rxvt_File_find __PROTO((const char* file, const char* ext, const char* path)); void rxvt_draw_shadow __PROTO((Display *Xdisplay, Window win, GC gc, unsigned long topShadow, unsigned long botShadow, int x, int y, int w, int h)); void rxvt_draw_triangle __PROTO((Display *Xdisplay, Window win, GC gc, unsigned long topShadow, unsigned long botShadow, int x, int y, int w, int type)); /* End prototypes of misc.c */ /* Begin prototypes of netdisp.c */ #ifdef NET_DISPLAY char * rxvt_network_display __PROTO((const char* display)); #endif /* End prototypes of netdisp.c */ /* Begin prototypes of ptytty.c */ int rxvt_get_pty __PROTO((int *fd_tty, char** ttydev)); int rxvt_get_tty __PROTO((const char* ttydev)); int rxvt_control_tty __PROTO((int fd_tty, const char* ttydev)); /* End prototypes of ptytty.c */ /* Begin prototypes of screen.c */ void rxvt_draw_string_x11 (rxvt_t* r, Window win, GC gc, Region refreshRegion, int x, int y, char* str, int len, int (*draw_string)()); #ifdef XFT_SUPPORT void rxvt_draw_string_xft (rxvt_t* r, Drawable d, GC gc, Region refreshRegion, rend_t rend, int pfont, XftDraw* win, XftColor* fore, int x, int y, char* str, int len, void (*xftdraw_string)()); #endif void rxvt_init_screen __PROTO((rxvt_t* r)); void rxvt_scr_reset __PROTO((rxvt_t* r, int page)); void rxvt_scr_release __PROTO((rxvt_t* r, int page)); void rxvt_scr_poweron __PROTO((rxvt_t* r, int page)); void rxvt_scr_cursor __PROTO((rxvt_t* r, int page, int mode)); int rxvt_scr_change_screen __PROTO((rxvt_t* r, int page, int scrn)); void rxvt_scr_color __PROTO((rxvt_t* r, int page, unsigned int color, int fgbg)); void rxvt_scr_rendition __PROTO((rxvt_t* r, int page, int set, int style)); int rxvt_scroll_text __PROTO((rxvt_t* r, int page, int row1, int row2, int count, int spec)); void rxvt_scr_add_lines __PROTO((rxvt_t* r, int page, const unsigned char* str, int nlines, int len)); void rxvt_scr_backspace __PROTO((rxvt_t* r, int page)); void rxvt_scr_tab __PROTO((rxvt_t* r, int page, int count)); void rxvt_scr_backindex __PROTO((rxvt_t* r, int page)); void rxvt_scr_forwardindex __PROTO((rxvt_t* r, int page)); void rxvt_scr_gotorc __PROTO((rxvt_t* r, int page, int row, int col, int relative)); void rxvt_scr_index __PROTO((rxvt_t* r, int page, enum page_dirn direction)); void rxvt_scr_erase_line __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_erase_screen __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_E __PROTO((rxvt_t* r, int page)); void rxvt_scr_insdel_lines __PROTO((rxvt_t* r, int page, int count, int insdel)); void rxvt_scr_insdel_chars __PROTO((rxvt_t* r, int page, int count, int insdel)); void rxvt_scr_scroll_region __PROTO((rxvt_t* r, int page, int top, int bot)); void rxvt_scr_cursor_visible __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_autowrap __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_relative_origin __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_insert_mode __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_set_tab __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_rvideo_mode __PROTO((rxvt_t* r, int page, int mode)); void rxvt_scr_report_position __PROTO((rxvt_t* r, int page)); void rxvt_scr_charset_choose __PROTO((rxvt_t* r, int page, int set)); void rxvt_scr_charset_set __PROTO((rxvt_t* r, int page, int set, unsigned int ch)); int rxvt_scr_get_fgcolor __PROTO((rxvt_t *r)); int rxvt_scr_get_bgcolor __PROTO((rxvt_t *r)); void rxvt_scr_expose __PROTO((rxvt_t* r, int page, int x, int y, int width, int height, Bool refresh)); void rxvt_scr_touch __PROTO((rxvt_t* r, int page, Bool refresh)); int rxvt_scr_move_to __PROTO((rxvt_t* r, int page, int y, int len)); int rxvt_scr_page __PROTO((rxvt_t* r, int page, enum page_dirn direction, int nlines)); void rxvt_scr_bell __PROTO((rxvt_t *r, int page)); void rxvt_scr_printscreen __PROTO((rxvt_t* r, int page, int fullhist, int pretty, int linecont, const char *pipeName)); void rxvt_scr_refresh __PROTO((rxvt_t* r, int page, unsigned char refresh_type)); void rxvt_scr_clear __PROTO((rxvt_t* r, int page)); void rxvt_scr_dump __PROTO((rxvt_t* r, int page, int fd)); void rxvt_selection_check __PROTO((rxvt_t* r, int page, int check_more)); int rxvt_selection_paste __PROTO((rxvt_t* r, Window win, Atom prop, Bool delete_prop)); void rxvt_selection_property __PROTO((rxvt_t* r, Window win, Atom prop)); void rxvt_selection_request __PROTO((rxvt_t* r, int page, Time tm, int x, int y)); void rxvt_selection_request_by_sel __PROTO((rxvt_t* r, int page, Time tm, int x, int y, int sel)); void rxvt_process_selectionclear __PROTO((rxvt_t* r, int page)); void rxvt_selection_make __PROTO((rxvt_t* r, int page, Time tm)); void rxvt_selection_click __PROTO((rxvt_t* r, int page, int clicks, int x, int y)); void rxvt_selection_extend __PROTO((rxvt_t* r, int page, int x, int y, int flag)); void rxvt_selection_rotate __PROTO((rxvt_t* r, int page, int x, int y)); void rxvt_paste_file __PROTO((rxvt_t* r, int page, Time tm, int x, int y, char* filename)); void rxvt_process_selectionrequest __PROTO((rxvt_t* r, int page, const XSelectionRequestEvent *rq)); void rxvt_pixel_position __PROTO((rxvt_t* r, int *x, int *y)); /* End prototypes of screen.c */ /* Begin prototypes of scrollbar-next.c */ #ifdef NEXT_SCROLLBAR void rxvt_scrollbar_init_next __PROTO((rxvt_t *r)); void rxvt_scrollbar_exit_next __PROTO((rxvt_t *r)); int rxvt_scrollbar_show_next __PROTO((rxvt_t* r, int update, int last_top, int last_bot, int scroller_len)); #endif /* End prototypes of scrollbar-next.c */ /* Begin prototypes of scrollbar-rxvt.c */ #ifdef RXVT_SCROLLBAR void rxvt_scrollbar_init_rxvt __PROTO((rxvt_t *r)); void rxvt_scrollbar_exit_rxvt __PROTO((rxvt_t *r)); int rxvt_scrollbar_show_rxvt __PROTO((rxvt_t* r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len)); #endif /* End prototypes of scrollbar-rxvt.c */ /* Begin prototypes of scrollbar-xterm.c */ #ifdef XTERM_SCROLLBAR void rxvt_scrollbar_init_xterm __PROTO((rxvt_t *r)); void rxvt_scrollbar_exit_xterm __PROTO((rxvt_t *r)); int rxvt_scrollbar_show_xterm __PROTO((rxvt_t* r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len)); #endif /* End prototypes of scrollbar-xterm.c */ /* Begin prototypes of scrollbar-plain.c */ #ifdef PLAIN_SCROLLBAR void rxvt_scrollbar_init_plain __PROTO((rxvt_t *r)); void rxvt_scrollbar_exit_plain __PROTO((rxvt_t *r)); int rxvt_scrollbar_show_plain __PROTO((rxvt_t* r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len)); #endif /* End prototypes of scrollbar-plain.c */ /* Begin prototypes of scrollbar-sgi.c */ #ifdef SGI_SCROLLBAR void rxvt_scrollbar_init_sgi __PROTO((rxvt_t *r)); void rxvt_scrollbar_exit_sgi __PROTO((rxvt_t *r)); int rxvt_scrollbar_show_sgi __PROTO((rxvt_t* r, int update __attribute__((unused)), int last_top, int last_bot, int scroller_len)); #endif /* End prototypes of scrollbar-sgi.c */ /* Begin prototypes of scrollbar.c */ #ifdef HAVE_SCROLLBARS int rxvt_scrollbar_visible __PROTO((rxvt_t* r)); void rxvt_scrollbar_init __PROTO((rxvt_t* r)); void rxvt_scrollbar_create __PROTO((rxvt_t* r)); void rxvt_scrollbar_clean_exit __PROTO((rxvt_t* r)); void rxvt_scrollbar_resize __PROTO((rxvt_t* r)); int rxvt_scrollbar_hide __PROTO((rxvt_t* r)); int rxvt_scrollbar_show __PROTO((rxvt_t* r)); int rxvt_scrollbar_update __PROTO((rxvt_t* r, int update)); unsigned short rxvt_scrollbar_width __PROTO((rxvt_t* r)); unsigned short rxvt_scrollbar_rwidth __PROTO((rxvt_t* r)); int rxvt_is_scrollbar_win __PROTO((rxvt_t* r, Window w)); unsigned long rxvt_scrollbar_bg __PROTO((rxvt_t* r)); #endif /* End prototypes of scrollbar.c */ /* Begin prototypes of strings.c */ #ifdef HAVE_WCHAR_H char* rxvt_wcstombs __PROTO((const wchar_t* str, int len)); wchar_t* rxvt_mbstowcs __PROTO((const char* str)); char* rxvt_wcstoutf8 __PROTO((const wchar_t* str)); wchar_t* rxvt_utf8towcs __PROTO((const char* str)); #endif /* HAVE_WCHAR_H */ int ma_strcasecmp __PROTO((const char* s1, const char* s2)); int ma_strncasecmp __PROTO((const char* s1, const char* s2, size_t n)); char* ma_strcpy __PROTO((char* d, const char* s)); char* ma_strncpy __PROTO((char* d, const char* s, size_t len)); int ma_strcmp __PROTO((const char* s1, const char* s2)); int ma_strncmp __PROTO((const char* s1, const char* s2, size_t len)); char* ma_strcat __PROTO((char* s1, const char* s2)); char* ma_strncat __PROTO((char* s1, const char* s2, size_t len)); size_t ma_strlen __PROTO((const char* s)); char* ma_strdup __PROTO((const char* s)); char UNTAINTED * ma_strndup __PROTO((const char TAINTED * s, size_t sz)); char* ma_index __PROTO((const char* s, int c)); char* ma_strchr __PROTO((const char* s, int c)); char* ma_rindex __PROTO((const char* s, int c)); char* ma_strrchr __PROTO((const char* s, int c)); void* ma_memcpy __PROTO((void *s1, const void *s2, size_t len)); void* ma_memmove __PROTO((void *d, const void *s, size_t len)); void ma_bzero __PROTO((void *b, size_t len)); void* ma_memset __PROTO((void *p, int c1, size_t len)); char* ma_strcasestr __PROTO((const char* phaystack, const char *pneedle)); /* End prototypes of strings.c */ /* Begin prototypes of transparent.c */ int rxvt_set_opacity __PROTO((rxvt_t*)); void rxvt_process_reparentnotify __PROTO((rxvt_t*, XEvent*)); #ifdef TRANSPARENT void rxvt_toggle_transparency __PROTO((rxvt_t*)); void refreshRootBGVars __PROTO((rxvt_t*)); int rxvt_check_our_parents __PROTO((rxvt_t*)); #endif #if defined(TRANSPARENT) || defined(BACKGROUND_IMAGE) void rxvt_refresh_bg_image __PROTO((rxvt_t*, int, Bool)); #endif #ifdef TINTING_SUPPORT # if defined(HAVE_LIBXRENDER) void xrenderShadeParentPixmap __PROTO((rxvt_t*, Pixmap, int, int, unsigned, unsigned, Bool)); # else void rxvt_shade_pixmap __PROTO((rxvt_t*, Drawable, int, int, unsigned, unsigned)); # endif #endif /* End prototypes of transparent.c */ /* Begin prototypes of xdefaults.c */ void rxvt_usage __PROTO((int type)); int rxvt_save_options __PROTO((rxvt_t* r, const char* filename)); void rxvt_get_options __PROTO((rxvt_t* r, int argc, const char* const *argv)); void rxvt_extract_resources __PROTO((rxvt_t* r, Display *display __attribute__((unused)), const char* name)); /* End prototypes of xdefaults.c */ #if defined(BACKGROUND_IMAGE) || defined(TRANSPARENT) /* Begin prototypes of pixmap.c */ int rxvt_scale_pixmap __PROTO((rxvt_t* r, int page, const char* geom)); void rxvt_resize_pixmap __PROTO((rxvt_t* r, int page)); Pixmap rxvt_load_bg_pixmap __PROTO((rxvt_t* r, int page, const char* file)); Pixmap rxvt_load_pixmap __PROTO((rxvt_t* r, const char* file, long* pw, long* ph)); /* End prototypes of pixmap.c */ /* Begin prototypes of jpg.c */ #ifdef USE_JPEG long JpegReadFileToPixmap __PROTO((Display* display, Window window, GC gc, char* filename, Pixmap* pixmap, long* w, long* h)); #endif /* End prototypes of jpg.c */ /* Begin prototypes of png.c */ #ifdef USE_PNG long PngReadFileToPixmap __PROTO((Display* display, Window window, GC gc, char* filename, Pixmap* pixmap, long* w, long* h)); #endif /* End prototypes of png.c */ #endif /* BACKGROUND_IMAGE || TRANSPARENT */ /* Begin prototypes of tabbar.c */ void rxvt_append_page __PROTO((rxvt_t*, int profile, const char TAINTED *title, const char *command)); void rxvt_kill_page __PROTO((rxvt_t*, short)); void rxvt_remove_page __PROTO((rxvt_t*, short)); void rxvt_activate_page __PROTO((rxvt_t*, short)); void rxvt_tabbar_set_visible_tabs __PROTO((rxvt_t*, Bool)); void refresh_tabbar_tab __PROTO((rxvt_t*, int)); void rxvt_tabbar_set_title __PROTO((rxvt_t*, short, const unsigned char TAINTED *)); void rxvt_tabbar_resize __PROTO((rxvt_t*)); void rxvt_tabbar_dispatcher __PROTO((rxvt_t*, XButtonEvent*)); void rxvt_tabbar_button_release __PROTO((rxvt_t*, XButtonEvent*)); int rxvt_tabbar_visible __PROTO((rxvt_t*)); void rxvt_tabbar_expose __PROTO((rxvt_t*, XEvent*)); int rxvt_tabbar_hide __PROTO((rxvt_t*)); int rxvt_tabbar_show __PROTO((rxvt_t*)); void rxvt_tabbar_create __PROTO((rxvt_t*)); void rxvt_tabbar_clean_exit __PROTO((rxvt_t*)); unsigned short rxvt_tabbar_height __PROTO((rxvt_t*)); unsigned short rxvt_tabbar_rheight __PROTO((rxvt_t*)); unsigned int rxvt_tab_width __PROTO((rxvt_t*, const char*)); int rxvt_is_tabbar_win __PROTO((rxvt_t*, Window)); void rxvt_tabbar_draw_buttons __PROTO((rxvt_t*)); void rxvt_adjust_fd_number __PROTO((rxvt_t* r)); void rxvt_tabbar_change_color __PROTO((rxvt_t*, int, const char*)); void rxvt_tabbar_highlight_tab __PROTO((rxvt_t*, short, Bool)); void rxvt_tabbar_move_tab __PROTO((rxvt_t*, short)); void sync_tab_title __PROTO((rxvt_t*, int)); /* End prototypes of tabbar.c */ /* Begin prototypes of session.c */ #ifdef HAVE_X11_SM_SMLIB_H void rxvt_process_ice_msgs __PROTO((rxvt_t* r)); void rxvt_session_init __PROTO((rxvt_t* r)); void rxvt_session_exit __PROTO((rxvt_t* r)); #endif /* HAVE_X11_SM_SMLIB_H */ /* End prototypes of session.c */ /* Begin prototypes of debug.c */ int rxvt_msg __PROTO((uint32_t, uint32_t, const char*, ...)); void rxvt_parse_dbg_arguments __PROTO((int argc, const char* const*)); /* End prototypes of debug.c */ #endif /* __PROTOS_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/xftacs.c0000644000175000001440000003656110756127602012061 00000000000000/*-----------------------------------*-C-*-------------------------------------* * File : xftacs.c * Created : Tue 27 Dec 2005 09:59:55 PM CST * Modified : Wed 12 Apr 2006 01:33:43 AM CDT * Author : Gautam Iyer *-----------------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * * Copyright 2005-2006 Gautam Iyer * * 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., 675 Mass * Ave, Cambridge, MA 02139, USA. *-----------------------------------------------------------------------------* * * DESCRIPTION * * Functions to draw VT100 / ACS graphics charecters. Xft functions do not * draw text graphic charecters (like XDrawText), so we have to do it * ourself. Partly plagurized with thanks from Thomas Dicky's xterm-204: * * http://invisible-island.net/xterm/xterm.html * * This file has nothing specific to rxvt. Instead of using XftDrawString, * use xftDrawACSString. Draws the non-graphics chars using a regular Xft * function, and graphics chars using XftGlyphs (if available) or line * segments. * * Before your first call to xftDrawACSString, call xftInitACS(). After * your last call to xftDrawACSString, call xftCloseACS(). * * See the comments before each function definition for details. * * BUGS * * 1. Complex chars are drawn using a glyph from the Xft font. Not all * fonts have these glyphs. Some have them in a different location than * we expect. * * The fonts "Andale Mono", "Bitstream Vera Sans Mono" and "Courier New" * HAVE the required glyphs at the positions below. The fonts "Courier", * "Luxi Mono" and "Nimbus Mono L" DO NOT have the required glyphs. * *----------------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #include /* * Maximum number of glyphs to be drawn per call to XftDrawGlyphs. */ #define MAX_GLYPHS (32) /* * Global variables that need to be inited on startup. */ GC acsGc=0; /* GC used for all drawing requests */ Pixmap sPmap=0; /* Stippled pixmap used for tiling */ /* * The grid is arbitrary, enough resolution that nothing's lost in * initialization. */ #define BOX_HIGH 60 #define BOX_WIDE 60 #define MID_HIGH (BOX_HIGH/2) #define MID_WIDE (BOX_WIDE/2) #define CHR_WIDE ((9*BOX_WIDE)/10) #define CHR_HIGH ((9*BOX_HIGH)/10) /* * ...since we'll scale the values anyway. */ #define SCALE_X(n) n = (n * (font_width-1)) / (BOX_WIDE-1) #define SCALE_Y(n) n = (n * (font_height-1)) / (BOX_HIGH-1) #define SEG(x0,y0,x1,y1) x0,y0, x1,y1 /* * XError handler for xftInitACS. This only sets sPmap to 0, and complains. */ int acsXErrorHandler( __attribute__((unused)) Display *dpy, __attribute__((unused)) XErrorEvent *event) { sPmap = 0; rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "Could not create pixmap\n")); return 0; } /* * Initialize sPmap. Call this before calling xftDrawACSString(). If d or depth * are 0, then default values are used. * * You will probabaly get a BadMatch error if you try using xftDrawACSString on * a drawable of a different depth. */ void xftInitACS( Display *dpy, Drawable d, unsigned depth) { int (*oldXerrorHandler)( Display *, XErrorEvent *); rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "Initing sPmap\n")); if(d == 0) d = DefaultRootWindow( dpy); if(depth == 0) depth=DefaultDepth( dpy, DefaultScreen( dpy)); #ifdef DEBUG if( sPmap != 0) rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "sPmap not null in xftInitACS")); #endif acsGc = XCreateGC( dpy, d, 0, NULL); oldXerrorHandler = XSetErrorHandler( (XErrorHandler) acsXErrorHandler); sPmap = XCreatePixmap( dpy, d, 2, 2, depth); XSetErrorHandler( oldXerrorHandler); XSetTile( dpy, acsGc, sPmap); } /* * Free sPmap. Call this after your last call to xftDrawACSString, or you WILL * have a memory leak. */ void xftCloseACS( Display *dpy) { if( sPmap ) { rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "freeing sPmap\n")); XFreePixmap( dpy, sPmap); sPmap = 0; } #ifdef DEBUG else rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "sPmap already null in xftCloseACS")); #endif XFreeGC( dpy, acsGc); } /* * INTERNAL USE ONLY. Draw a ACS graphics character on screen at x,y. Like XFT * functions, we do not clear the background before drawing. * * (x,y) is the bottom left corner of the character to draw. * * WARNING: If any char in *str has ascii value >= 32, then this function will * get stuck in an infinite loop. */ void xftDrawACSChars( Display *dpy, Drawable d, GC gc, XftDraw *draw, const XftColor *color, XftFont *pub, int x, int y, const unsigned char *str, int len) { /* * Line segments to draw line like chars. */ static const short glyph_ht[] = { SEG( 0, 0, 0, 5*MID_HIGH/6), /* H */ SEG(6*BOX_WIDE/10, 0, 6*BOX_WIDE/10,5*MID_HIGH/6), SEG( 0, 5*MID_HIGH/12,6*BOX_WIDE/10,5*MID_HIGH/12), SEG(2*BOX_WIDE/10, MID_HIGH, CHR_WIDE, MID_HIGH), /* T */ SEG(6*BOX_WIDE/10, MID_HIGH, 6*BOX_WIDE/10, CHR_HIGH), -1 }, glyph_ff[] = { SEG( 0, 0, 6*BOX_WIDE/10, 0), /* F */ SEG( 0, 5*MID_HIGH/12,6*CHR_WIDE/12,5*MID_HIGH/12), SEG( 0, 0, 0*BOX_WIDE/3, 5*MID_HIGH/6), SEG(1*BOX_WIDE/3, MID_HIGH, CHR_WIDE, MID_HIGH), /* F */ SEG(1*BOX_WIDE/3, 8*MID_HIGH/6,10*CHR_WIDE/12,8*MID_HIGH/6), SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), -1 }, glyph_lf[] = { SEG( 0, 0, 0, 5*MID_HIGH/6), /* L */ SEG( 0, 5*MID_HIGH/6, 6*BOX_WIDE/10,5*MID_HIGH/6), SEG(1*BOX_WIDE/3, MID_HIGH, CHR_WIDE, MID_HIGH), /* F */ SEG(1*BOX_WIDE/3, 8*MID_HIGH/6,10*CHR_WIDE/12,8*MID_HIGH/6), SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), -1 }, glyph_nl[] = { SEG( 0, 5*MID_HIGH/6, 0, 0), /* N */ SEG( 0, 0, 5*BOX_WIDE/6, 5*MID_HIGH/6), SEG(5*BOX_WIDE/6, 5*MID_HIGH/6, 5*BOX_WIDE/6, 0), SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), /* L */ SEG(1*BOX_WIDE/3, CHR_HIGH, CHR_WIDE, CHR_HIGH), -1 }, glyph_vt[] = { SEG( 0, 0, 5*BOX_WIDE/12,5*MID_HIGH/6), /* V */ SEG(5*BOX_WIDE/12,5*MID_HIGH/6, 5*BOX_WIDE/6, 0), SEG(2*BOX_WIDE/10, MID_HIGH, CHR_WIDE, MID_HIGH), /* T */ SEG(6*BOX_WIDE/10, MID_HIGH, 6*BOX_WIDE/10, CHR_HIGH), -1 }, lower_right_corner[] = { SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), SEG( MID_WIDE, MID_HIGH, MID_WIDE, 0), -1 }, upper_right_corner[] = { SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), -1 }, upper_left_corner[] = { SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), -1 }, lower_left_corner[] = { SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), SEG( MID_WIDE, MID_WIDE, BOX_WIDE, MID_HIGH), -1 }, cross[] = { SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), -1 }, left_tee[] = { SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), -1 }, right_tee[] = { SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), SEG( MID_WIDE, MID_HIGH, 0, MID_HIGH), -1 }, bottom_tee[] = { SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), -1 }, top_tee[] = { SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), -1 }, vertical_line[] = { SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), -1 }; /* * Pointer to line-segment structure. */ static const short *lines[] = { NULL, /* 00 (unused) */ NULL, /* 01 diamond */ NULL, /* 02 box */ glyph_ht, /* 03 HT */ glyph_ff, /* 04 FF */ NULL, /* 05 CR (not drawn) */ glyph_lf, /* 06 LF */ NULL, /* 07 degrees (small circle) */ NULL, /* 08 plus or minus*/ glyph_nl, /* 09 */ glyph_vt, /* 0A */ lower_right_corner, /* 0B */ upper_right_corner, /* 0C */ upper_left_corner, /* 0D */ lower_left_corner, /* 0E */ cross, /* 0F */ NULL, /* 10 overline */ NULL, /* 11 topline */ NULL, /* 12 midline */ NULL, /* 13 botline */ NULL, /* 14 underline */ left_tee, /* 15 */ right_tee, /* 16 */ bottom_tee, /* 17 */ top_tee, /* 18 */ vertical_line, /* 19 */ NULL, /* 1A leq */ NULL, /* 1B geq */ NULL, /* 1C pi */ NULL, /* 1D neq */ NULL, /* 1E pound */ NULL, /* 1F bullet */ }; /* * Character number in XftFont (if any). */ static const FT_UInt xftCharNo[] = { 0, /* 00 (unused) */ 0, /* 01 diamond */ 0, /* 02 box */ 0, /* 03 HT */ 0, /* 04 FF */ 0x8b, /* 05 CR (drawn as (c) ) */ 0, /* 06 LF */ 0x83, /* 07 degrees (small circle) */ 0x93, /* 08 plus or minus*/ 0, /* 09 */ 0, /* 0A */ 0, /* 0B */ 0, /* 0C */ 0, /* 0D */ 0, /* 0E */ 0, /* 0F */ 0, /* 10 overline */ 0, /* 11 topline */ 0, /* 12 midline */ 0, /* 13 botline */ 0, /* 14 underline */ 0, /* 15 */ 0, /* 16 */ 0, /* 17 */ 0, /* 18 */ 0, /* 19 */ 0x94, /* 1A leq */ 0x95, /* 1B geq */ 0x9b, /* 1C pi */ 0x8f, /* 1D neq */ 0x85, /* 1E pound */ 0x87 /* 1F bullet */ }; unsigned font_width = pub->max_advance_width; unsigned font_height = pub->ascent + pub->descent; const short *p; FT_UInt glyphs[MAX_GLYPHS]; int ytop = y - pub->ascent; /* (x, ytop) is the top left corner */ /* * Update fill styles in acsGc */ XSetLineAttributes(dpy, acsGc, (font_height > 16) ? font_height / 16 : 1, LineSolid, CapProjecting, JoinMiter); XCopyGC( dpy, gc, GCForeground | GCBackground, acsGc); /* * Draw the characters. A few (ones with curves / shading) need to be * treated specially. The rest can be drawn with the segments in lines[n]. */ while( 1 ) { /* * If even one value in str[] is >= 32, this loop will never terminate. * This is checked before calling, so no need to recheck here. * * We use such "contorted" code to optimize for speed. Since this is * done several times while refreshing the screen, we don't want to slow * things down. */ int n; /* * Find max contiguous block of chars which are present in the Xft font, * and use XftDrawGlyphs to draw them. */ for( n=0; n < len && n < MAX_GLYPHS && (glyphs[n] = xftCharNo[ *str ]); n++, str++); if( n ) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "(%d glyphs) ", n)); XftDrawGlyphs( draw, color, pub, x, y, glyphs, n); x += n * font_width; if( !(len -= n) ) break; /* !(len -= n) iff (len -= n) <= 0 */ } /* * Draw contiguous stippled box (0x02) */ for( n=0; n < len && *str == 2; n++, str++); if( n ) { XGCValues values; rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "(%d boxes) ", n)); XGetGCValues( dpy, acsGc, GCForeground | GCBackground, &values); XDrawPoint( dpy, sPmap, acsGc, 0, 0); XDrawPoint( dpy, sPmap, acsGc, 1, 1); XSetForeground( dpy, acsGc, values.background); XDrawPoint( dpy, sPmap, acsGc, 0, 1); XDrawPoint( dpy, sPmap, acsGc, 1, 0); values.fill_style = FillTiled; XChangeGC( dpy, acsGc, GCForeground | GCFillStyle, &values); XFillRectangle( dpy, d, acsGc, x, ytop, n * font_width, font_height); if( !(len -= n) ) break; /* !(len -= n) iff (len -= n) <= 0 */ x += n * font_width; } /* * Draw contiguous horizontal lines. */ if( *str >= 0x10 && *str <= 0x14) { unsigned char c = *str; int xstart = x; int ystart = ytop + ((c - 0x10) * (font_height-1)) / 4; for( n=0; ++n < len && *(++str) == c; ); rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "(%d hln)", n)); x += n * font_width; XSetFillStyle( dpy, acsGc, FillSolid); XDrawLine( dpy, d, acsGc, xstart, ystart, x-1, ystart); if( !(len -= n)) break; } /* * Contiguous drawing not possible for these cases. */ if (*str == 1) /* Filled diamond */ { XPoint points[4]; int npoints = 4, n; rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "(1 dmd) ")); points[0].x = CHR_WIDE/2 + (BOX_WIDE - CHR_WIDE) / 2; points[0].y = 0; points[1].x = (BOX_WIDE - CHR_WIDE) / 2; points[1].y = CHR_HIGH/2 + (BOX_HIGH - CHR_HIGH) / 2; points[2].x = points[0].x; points[2].y = CHR_HIGH + (BOX_HIGH - CHR_HIGH) / 2; points[3].x = CHR_WIDE + (BOX_WIDE - CHR_WIDE) / 2; points[3].y = points[1].y; for (n = 0; n < npoints; n++) { SCALE_X(points[n].x); SCALE_Y(points[n].y); points[n].x += x; points[n].y += ytop; } XSetFillStyle( dpy, acsGc, FillSolid); XFillPolygon( dpy, d, acsGc, points, npoints, Convex, CoordModeOrigin); if( ! (--len)) break; str++; x += font_width; } else if( NOT_NULL(p = lines[*str])) { /* * Draw character using segments in lines[*str] */ int coord[4]; int n = 0; rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "(1 ldc) ")); XSetFillStyle( dpy, acsGc, FillSolid); while (*p >= 0) { coord[n++] = *p++; if (n == 4) { SCALE_X(coord[0]); SCALE_Y(coord[1]); SCALE_X(coord[2]); SCALE_Y(coord[3]); XDrawLine( dpy, d, acsGc, x + coord[0], ytop + coord[1], x + coord[2], ytop + coord[3]); n = 0; } } if( !(--len)) break; str++; x += font_width; } } #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "\n")); #endif } /* * Draws an XFT string on screen. All characters below 32 are assumed to be ACS * graphics characters and are drawn by hand. Ther rest are passed to * xftdraw_string to be drawn by Xft. xftdraw_string should be XftDrawString8 / * Utf8. Changing this to accept XftDrawString16 etc is not hard, but will bloat * mrxvt (and isn't done here). */ void xftDrawACSString ( Display *dpy, Drawable d, GC gc, void (*xftdraw_string)(), XftDraw *draw, const XftColor *color, XftFont *pub, int x, int y, const unsigned char *str, int len) { const unsigned char *t = str; int chars; rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, "Drawing %d(%d) %sACS characters.", len, STRLEN( str), ( xftdraw_string == XftDrawString8) ? "Utf8 " : "")); while(len > 0) { /* * Pass all non graphic chars to xftdraw_string. */ for( chars=0; *t >= 32 && chars < len; chars++, t++); if( chars) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, " [%d chars]", chars)); xftdraw_string( draw, color, pub, x, y, str, chars); x += chars * pub->max_advance_width; str = t; len -= chars; } /* * Draw all ACS graphics chars by hand. */ for( chars=0; *t < 32 && chars < len; chars++, t++); if( chars) { rxvt_dbgmsg ((DBG_VERBOSE, DBG_XFTACS, " (%d glyphs)", chars)); xftDrawACSChars( dpy, d, gc, draw, color, pub, x, y, str, chars); x += chars * pub->max_advance_width; str = t; len -= chars; } } #ifdef DEBUG rxvt_dbgmsg ((DBG_DEBUG, DBG_XFTACS, "\n")); #endif } /*-------------------------- end-of-file (C source) --------------------------*/ mrxvt-0.5.4/src/xftacs.h0000644000175000001440000000340110756127602012051 00000000000000/*-----------------------------------*-H-*-------------------------------------* * File : xftacs.h * Created : Tue 27 Dec 2005 09:59:55 PM CST * Modified : Wed 12 Apr 2006 01:42:08 AM CDT * Author : Gautam Iyer * Description : Header file for Xft ACS graphics chars. See comments in * xftacs.c for details. *-----------------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * * Copyright 2005-2006 Gautam Iyer * * 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., 675 Mass * Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------------*/ #ifndef XFTACS_H #define XFTACS_H void xftInitACS ( Display *dpy, Drawable d, unsigned depth); void xftCloseACS ( Display *dpy); void xftDrawACSString ( Display *dpy, Drawable d, GC gc, void (*xftdraw_string)(), XftDraw *draw, const XftColor *color, XftFont *pub, int x, int y, const unsigned char *str, int len ); #endif /*-------------------------- end-of-file (H source) --------------------------*/ mrxvt-0.5.4/src/grkelot.c0000644000175000001440000002622010756127602012227 00000000000000/*--------------------------------*-C-*---------------------------------* * File: grkelot.c *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1994,1995 Angelo Haritsis * Copyright (c) 1997,1998 Oezger Kesim * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #include "../config.h" #include "rxvt.h" #ifdef GREEK_SUPPORT /* --- Macros, Types --------- */ #define MAX_STATES 4 /* max # states for the FSM */ #define MAX_SWITCHER 2U /* per state */ #define MAX_VAL 256 /* for temp allocation */ #ifndef HAVE_SYS_TYPES_H typedef unsigned char u_char; typedef unsigned int u_int; typedef unsigned long u_long; #endif typedef struct s_xlat { u_int first, last; u_int *pval; /* array of translated values */ } K_XLAT; typedef struct s_switch { u_char type; /* Ascii, Virtual, Scan */ u_int code; u_char nextstate; u_char on; /* current state of key: 0 = off */ } K_SWITCH; typedef struct s_state { u_int num_xlat; /* number of translations */ K_XLAT *xlat; /* State translations ((dynamic - realloc'ed) */ u_int num_switcher; /* number of switcher keys */ K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */ u_char life; /* 0 = until switched by key */ u_char prev_state; /* filled when jumped to a new state */ } K_STATE; /* type for each one of the different greek standards (xlat types) */ typedef struct s_xlat_type { char *plain; char *accent; char *accent_xtra; char *umlaut; char *acc_uml; } XLAT_TYPE; /* --- Local Data ------------ */ static K_STATE State[MAX_STATES]; /* Current State */ static u_char nStateNow = 0; static K_STATE *pStateNow = &State[0]; static int GreekMode = GREEK_ELOT928; /* * The following are hard-coded for now. The idea is that such strings would * be read from a config file making it possible to change language/encodings * more flexibly. */ /* elot 928 xlations */ static char elot_xlat_plain[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,233,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,245,230"; /* c and s give copyright and section sign */ static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226," /*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230"; static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */ static char elot_xlat_uml[] = "65-122:193,194,216,196,197,214,195,199,218,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,219,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,250,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,251,230"; static char elot_xlat_umacc[] = "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,192,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,224,230"; /* ibm 437 xlations */ static char i437_xlat_plain[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,160,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,172,157"; static char i437_xlat_acc[] = "65-122:234,129,150,131,235,148,130,236,237,141,137,138,139,140,238,143,81,144,145,146,135,240,87,149,239,133,91,92,93,94,95,96,225,153,175,155,226,173,154,227,229,165,161,162,163,164,230,167,113,168,169,171,159,233,170,174,231,157"; static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */ static char i437_xlat_uml[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,228,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,232,157"; static char i437_xlat_umacc[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,42,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,42,157"; /* * currently ELOT928 and IBM437 are supported; easy to include others * (not recommended: stick to just these 2 if not only the ELOT one) */ static XLAT_TYPE xlat_type[] = { {elot_xlat_plain, elot_xlat_acc, elot_xlat_acc_xtra, elot_xlat_uml, elot_xlat_umacc}, {i437_xlat_plain, i437_xlat_acc, i437_xlat_acc_xtra, i437_xlat_uml, i437_xlat_umacc}, }; /* the current trasnaltion type */ static XLAT_TYPE *xlat_now = &xlat_type[GREEK_ELOT928]; #define NUM_XLAT_TYPES (sizeof(xlat_type) / sizeof(xlat_type[0])) static void kstate_add_xlat(char *str); static void kstate_add_switcher(char *str); static void kstate_set_life(char *str); /* --- Functions ------------- */ /* INTPROTO */ void kstate_setcurr(int stateno) { u_char prev_state; if ((u_int) stateno > (u_int) MAX_STATES) return; if (pStateNow->life == 1) prev_state = pStateNow->prev_state; else prev_state = nStateNow; pStateNow = &State[nStateNow = stateno]; pStateNow->prev_state = prev_state; } /* INTPROTO */ void kstate_init(void) { pStateNow->num_xlat = pStateNow->num_switcher = pStateNow->life = pStateNow->prev_state = 0; pStateNow->xlat = NULL; } /* INTPROTO */ void kstate_end(void) { int i; for (i = 0; i < pStateNow->num_xlat; i++) rxvt_free(pStateNow->xlat[i].pval); if (pStateNow->num_xlat > 0) rxvt_free(pStateNow->xlat); } /* * Hard coded ELOT-928 translations. Could read these from an rc-type file * to support other remappers. */ /* INTPROTO */ void kstate_init_all(int greek_mode) { /* the translation tables for the 4 FSM states for ELOT-928 mappings */ int i; for (i = 0; i < MAX_STATES; i++) { kstate_setcurr(i); kstate_init(); } if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */ greek_mode = GREEK_ELOT928; xlat_now = &xlat_type[greek_mode]; kstate_setcurr(0); kstate_add_xlat(xlat_now->plain); kstate_add_switcher("A;:1"); kstate_add_switcher("A::2"); kstate_set_life("L0"); kstate_setcurr(1); kstate_add_xlat(xlat_now->accent); kstate_add_xlat(xlat_now->accent_xtra); kstate_add_switcher("A::3"); kstate_set_life("L1"); kstate_setcurr(2); kstate_add_xlat(xlat_now->umlaut); kstate_add_switcher("A;:3"); kstate_set_life("L1"); kstate_setcurr(3); kstate_add_xlat(xlat_now->acc_uml); kstate_set_life("L1"); } /* INTPROTO */ void kstate_end_all(void) { int i; for (i = 0; i < MAX_STATES; i++) { kstate_setcurr(i); kstate_end(); } kstate_setcurr(0); } /* * reset FSM */ /* INTPROTO */ void kstate_reset(void) { kstate_setcurr(0); } /* INTPROTO */ void kstate_add_xlat(char *str) { K_XLAT *xlat; u_int *pval_tmp; char *sval; int i; if (IS_NULL(str)) return; /* add a new xlat table in state */ if (pStateNow->num_xlat == 0) { pStateNow->xlat = rxvt_malloc(sizeof(K_XLAT)); } else /* prefer contiguous data, realloc */ pStateNow->xlat = rxvt_realloc (pStateNow->xlat, (pStateNow->num_xlat + 1) * sizeof(K_XLAT)); xlat = &pStateNow->xlat[pStateNow->num_xlat]; /* parse str and derive first, last, values */ xlat->first = (u_int) atoi(strtok(str, "-")); xlat->last = (u_int) atoi(strtok(NULL, ":")); i = 0; pval_tmp = calloc(MAX_VAL, sizeof(K_XLAT)); while (NOT_NULL(sval = strtok(NULL, ","))) pval_tmp[i++] = (u_int) (atoi(sval)); xlat->pval = calloc(i, sizeof(K_XLAT)); if (NOT_NULL(xlat->pval)) MEMCPY(xlat->pval, pval_tmp, i * sizeof(u_int)); rxvt_free(pval_tmp); pStateNow->num_xlat++; } /* * Ascii only for this implementation */ /* INTPROTO */ void kstate_add_switcher(char *str) { K_SWITCH *switcher; if (IS_NULL(str)) return; if (pStateNow->num_switcher >= MAX_SWITCHER) return; switcher = &pStateNow->switcher[pStateNow->num_switcher]; switch (switcher->type = str[0]) { case 'A': /* ascii eg: A;:2 */ switcher->code = str[1]; switcher->nextstate = atoi(&str[3]); break; } switcher->on = 0; pStateNow->num_switcher++; } /* L1 or L0 */ /* INTPROTO */ void kstate_set_life(char *str) { pStateNow->life = atoi(&str[1]); } /* INTPROTO */ unsigned int kstate_cxlat(unsigned int c) { int i; /* check for ascii switcher */ for (i = 0; i < pStateNow->num_switcher; i++) if (pStateNow->switcher[i].type == 'A' && /* only ascii here */ c == pStateNow->switcher[i].code) { kstate_setcurr(pStateNow->switcher[i].nextstate); pStateNow->switcher[i].on = 1; return ((unsigned int)-1); } /* do translation */ for (i = 0; i < pStateNow->num_xlat; i++) if (c >= pStateNow->xlat[i].first && c <= pStateNow->xlat[i].last) { c = pStateNow->xlat[i].pval[c - pStateNow->xlat[i].first]; break; } /* switch back to previous state if life of current is 1 */ if (pStateNow->life == 1) kstate_setcurr(pStateNow->prev_state); return (c); } /* EXTPROTO */ void greek_init(void) { kstate_init_all(GreekMode); } /* EXTPROTO */ void greek_end(void) { kstate_end_all(); } /* EXTPROTO */ void greek_reset(void) { kstate_reset(); } /* EXTPROTO */ void greek_setmode(int greek_mode) { GreekMode = greek_mode; } /* EXTPROTO */ int greek_getmode(void) { return (GreekMode); } /* * xlate a given string in-place - return new string length */ /* EXTPROTO */ int greek_xlat(char *s, int num_chars) { int i, count; unsigned int c; for (i = 0, count = 0; i < num_chars; i++) { c = kstate_cxlat((unsigned int)s[i]); if (c != -1) s[count++] = (char)c; } s[count] = '\0'; return (count); } #ifdef TEST int main(void) { /*char text[] = "abcdef;aGDZXC"; */ char text[] = "abcdef;a:ibgdezhuiklmnjoprstyfxcv"; kstate_init_all(GREEK_ELOT928); printf("text: %s\n", text); greek_xlat(text, STRLEN(text)); printf("xlat'ed text: %s\n", text); kstate_end_all(); return 0; } #endif #endif /* GREEK_SUPPORT */ /*----------------------- end-of-file (C source) -----------------------*/ mrxvt-0.5.4/src/grkelot.h0000644000175000001440000000316310756127602012235 00000000000000/*--------------------------------*-H-*---------------------------------* * File: grkelot.h *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. * Copyright (c) 1994 Angelo Haritsis * Copyright (c) 1997,1998 Oezguer Kesim * Copyright (c) 2004 Jingmin Zhou * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. *----------------------------------------------------------------------*/ #ifndef __GRKELOT_H__ #define __GRKELOT_H__ #define GREEK_ELOT928 0 #define GREEK_IBM437 1 void greek_init (void); void greek_end (void); void greek_reset (void); void greek_setmode (int greek_mode); int greek_getmode (void); int greek_xlat (char *s, int num_chars); #endif /* __GRKELOT_H__ */ /*----------------------- end-of-file (H source) -----------------------*/ mrxvt-0.5.4/src/close_term.xbm0000644000175000001440000000067110756127602013262 00000000000000#define close_term_width 18 #define close_term_height 18 static unsigned char close_term_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0c, 0x00, 0x60, 0x1e, 0x00, 0xc0, 0x0e, 0x00, 0xc0, 0x07, 0x00, 0x80, 0x03, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x0f, 0x00, 0xc0, 0x1e, 0x00, 0x60, 0x3c, 0x00, 0x20, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; mrxvt-0.5.4/src/close_term.xpm0000644000175000001440000000077610756127602013306 00000000000000/* XPM */ static char * close_term_xpm[] = { "18 18 3 1", " c None", ". c #D3D3DD s background", "+ c #FF0006", "..................", "..................", "..................", "..................", ".....+....++......", ".....++..++++.....", "......++.+++......", "......+++++.......", ".......+++........", ".......++++.......", "......++++++......", "......++.++++.....", ".....++...++++....", ".....+.....++.....", "..................", "..................", "..................", ".................."}; mrxvt-0.5.4/NEWS0000644000175000001440000001514410756127603010330 00000000000000----------------- 06-22-2005 Mrxvt version 0.5.1 is released! This release adds a new feature of profile support, and makes lots of improvement to the new macro feature. It also fixes lots of bugs. For details, check ChangeLog. :-) ----------------- 04-09-2005 Mrxvt version 0.5.0 is released! After active development by our new leading developer Gautam Iyer for more than three month, we hereby present you this newest and best ever release of mrxvt. This release has significantly improved performance and further reduced resource usage even though mrxvt's footprint was already very small. New features include but is not limited to: better and intelligent tabbar apperance, full screen mode, new powerful macros (replacing hotkeys), XRender alphablending, popup menus, etc. Numerious bugs have been fixed as well. Please test it out and send us bug reports, comments, suggestions, and of course patchs. ----------------- 11-14-2005 Mrxvt version 0.4.2 is released! This is a bug fix release with lots of fixes. Sorry I did not have much time to devote to the development of mrxvt in the past months. So the new features, like UTF-8, are still not available. If you are willing to help on the development, please do not hesitate to let me know! ----------------- 05-01-2005 Mrxvt version 0.4.1 is released! This is a bug fix release with lots of fixes. ----------------- 02-25-2005 Mrxvt version 0.4.0 is released! This is the long awaited stable release since there have been no more bug reports recently. ;-) This release fixes several minor bugs. ----------------- 02-06-2005 Mrxvt version 0.3.13 is released! This is a major bug fix release. Sorry to disappoint you that we could not reach 0.4.0 right now. I know you are eagerly waiting for the magic number 0.4.0. :p The delay is because a major bug was found and thus we need more test on the fix. In particular, please open multiple tabs simultaneously and let each tab do some kind of busy job that refreshes the screen constantly, e.g., `wget --progress=dot big.file`. Then switch to another tab and work in it to see if there is any misbehavior, like crashes (yes, not kidding ;-)), slow response (expected if your machine is slow *_^), etc. If you meet crash, please send me your mrxvt binary and coredump so that I can debug it. Be sure to build mrxvt with debug support. I really hope 0.4.0 is rock solid so that I can concentrate on 0.5.x development branch after releasing it. ----------------- 01-14-2005 Mrxvt version 0.3.12 is released! This is a major bug fix release - see the long fix list in ChangeLog. If everything goes well, it will be the last testing release before we reach 0.4.0. ----------------- 12-11-2004 Mrxvt version 0.3.11 is released! This release is a major bug fix release. Lots of problems are fixed, like compile error, terminal hanging, off-focus fading bug, session crashes, etc. Please test it throughly and report any bugs. If everything goes well, we will release 0.3.12 as the last testing release (like 0.4.0 beta) and reach 0.4.0 after that. ----------------- 12-05-2004 Mrxvt version 0.3.10 is released! This release aims to be a bug fix release, but some new features are added as well. The most significant new feature is that the keyboard shortcuts are now configurable! So if you do not like a default keyboard shortcut or would like to define your own shortcuts, you can do it now in the configuration file. Sorry we do not reach 0.4.0 at this release. Though I am using mrxvt everyday and it seems pretty stable, I would like to delay a stable release (0.4.0) till more people have throughly tested it. ----------------- 11-19-2004 Mrxvt version 0.3.9 is released! This release is a bug fix release, though some new features are still added as requested. ----------------- 11-09-2004 Mrxvt version 0.3.8 is released! This release introduces the support of true translucent window, holding exited terminal, input broadcasting, different text shadow mode. It also fixes lots of bugs (see the long ChangeLog). From now on, we will focus on stablizing the code instead of adding significant new features. Hopefully we can reach a stable branch at 0.4.0 very soon! ----------------- 11-08-2004 Mrxvt version 0.3.8 is delayed since I found some serious bugs at the last moment! Please do not worry. By fixing the bugs, I realize now it is easy to implement some functionality, like broadcasting. :-) But the scrolling has become horribly slow. I am trying to figure out the reason. New release will come soon. ----------------- 10-31-2004 Mrxvt version 0.3.7 is released! This release fixes XFT support of CJK font and lots of bugs. ----------------- 10-22-2004 Mrxvt version 0.3.6 is released! This release fixes XFT support and many bugs. We are close to a stable release soon. ----------------- 10-15-2004 Mrxvt version 0.3.5 is released! This release introduces the experimental support of freetype font, utempter library and many user convenience features, plus lots of fixes. ----------------- 10-10-2004 Mrxvt version 0.3.4 is included in Gentoo Linux portage! I hope it is stable enough for daily use now. ----------------- 10-08-2004 Mrxvt version 0.3.4 is available! This release introduces the highly anticipated session support, support of user supplied background image for scrollbar/menubar, and gnome-terminal/konsole's hotkeys! And there are lots of fixes and document updates. ----------------- 09-30-2004 Mrxvt version 0.3.3 is available! This release enhances the multi- language support, fixes XIM support, and introduces several new features like text shadow! ----------------- 09-24-2004 Mrxvt version 0.3.2 is available! This release fixes several serious bugs, and introduces lots of new features! I hope it is stable enough for daily use. I know there are too many releases recently, I will reduce the frequency unless serious bugs are found. ;-) ----------------- 09-20-2004 Mrxvt version 0.3.1 is available! This release adds back features like off-focus fading and background color tinting. It also adds new features like transparent scrollbar/menubar/tabbar. ----------------- 09-19-2004 Sorry folks, my sourceforge e-mail address listed in the AUTHORS/ configure.ac file of version 0.3.0 is wrong (fixed in CVS)! Please refresh the project homepage and fetch the new e-mail address on the left panel if you want to contact me! Thanks! ----------------- 09-15-2004 Mrxvt version 0.3.0 is available! This release is based on rxvt 2.7.11 CVS, so the name is changed to mrxvt in order to avoid confusion with multi-aterm. Color background tinting is missing. XIM support still needs debugging. But, it's usable now! Please try it out and send me bug reports! mrxvt-0.5.4/TODO0000644000175000001440000001677311032076370010322 00000000000000 TODO list for mrxvt. If you do something on this list, be sure to send us a patch. See the section on "CODING GUIDELINES" at the end of this file. Priority classification: 9 -- Important, 0 -- Useless. -------------------------------------------------------------------------------- NEW FEATURES Menus: 8 Sticky menus, that can be accessed via the keyboard. 7 Add -pfn option (analogous to -xftpfn) for a proportional font to display tab titles / menus with an X11 font. 7 Multichar Xft support in menus. 7 Extend menu language / facility. 5 Write decent menus. Almost all options we have now should be available via some menu. Windows and tabs: 7 Split window support (e.g. like screen / vim). 7 Have mrxvt be able to manage multiple windows. (Advantage is low memory usage, and the ability to detach tabs / move them between windows). 7 Rewrite background support using imlib2 7 Show icons in tabs (after imlib2 support is added) 7 Regexp based icon selection for tabs (and EWMH mini icon) 5 Add separate colors for tabbar background, menubar fg/bg 5 Searching scroll buffer support: We should pipe the scroll-back to less directly, and open it in the *same* tab. (Ugly hack possible using macros) Core: 9 UTF-8 support. 8 Better performance with vttest. 7 I18N support 7 regexp based selection, and URL highlighting 7 Smart insertion of newlines in the selection 5 Xterm style mouse support, e.g., joe 3.2 4 Extensible timer support Code Cleanup: 5 The original rxvt installed a core functionality in a library (librxvt). mrxvt does not do this, however a lot of mrxvt's code is structured for it. For instance, half our definitions are in rxvtlib.h (which should be moved to rxvt.h). All our function names start with "rxvt_". These can be safely renamed: e.g. rxvt_cmd_getc can be called getcFromTabs() or getc_from_tabs. [The shmuck who does this cleanup will get to use his convention in naming. The rest of us will have to follow it.] 5 Some variables are named very badly. Our names should either be mixed case without underscores, or lower case with underscores. Not mixed case with underscores. This convention should be followed consistently for all global structure members, and function names. 5 Legacy rxvt code cleanup: There's tonnes and tonnes of rxvt code that has not been read by anyone for YEARS. It can probably be cleaned up a lot. 3 Reduce X resource usage: We currently use one window for each VT. This is very wasteful, especially since we only display one window each time. -------------------------------------------------------------------------------- BUGS 9 vt100 printer support is now broken. Fix it. 8 Looks like rxvt_scr_refresh is called twice every time. (The second refresh is cheap, as the screen is current). But eliminating this will save a few CPU cycles... NOTE: Only happens with -tr 8 When sending escape sequences to mrxvt via macros, make sure we are not disrupting processing of another escape sequence. 1 PNG and JPEG background support on Solaris looks broken -------------------------------------------------------------------------------- CODING GUIDELINES If you want to contribute code to mrxvt, PLEASE PLEASE follow these guidelines. Right now we only have two regular developers, who are extremely busy. We could use your help. If you want to help, do anything on the above list and send us a patch. Or do something useful (and not contradictory to mrxvt's design goals), and send us a patch. If you send us patches regularly, then we will probably give you subversion access. SUBMITTING A PATCH Use the following guidelines when submitting a patch for mrxvt: 1. Please please submit a patch against the LATEST version from the subversion repository (NOT THE LATEST RELEASE). Look on the download section for how to checkout mrxvt from subversion. 2. Include the date, and revision number of the version from the subversion repository your patch is against. 3. Follow the guidelines under "WRITING CODE FOR MRXVT" at the end of this section. COMMITTING TO SUBVERSION Use the following guidelines when committing your work to the subversion repository. 1. DO NOT COMMIT YOUR WORK UNLESS IT COMPILES CLEANLY (with --enable-everything) 2. DO NOT COMMIT YOUR WORK IF IT SEGFAULTS. 3. Be sure you leave helpful messages in the subversion logs. 4. If you plan on implementing something small (e.g. new option that takes all of 10 lines of code, and is useful) just go ahead and do it. No need to announce it on the devel list / etc. 5. If you plan on major code changes, or a "big" feature (e.g. imlib2 support), then it would be a good idea to discuss this on the devel list first. 6. Follow the guidelines under "WRITING CODE FOR MRXVT" at the end of this section WRITING CODE FOR MRXVT PLEASE PLEASE follow these guidelines when contributing code to mrxvt. 1. The "one true brace/tab style" sucks. Use the style we have in our code. With Vim 7 and syntax folding (fdm=syntax), it looks quite nice! If you use Vim, and want to edit the code PLEASE USE :set sts=4 ts=8 sw=4 autoindent cindent noet tw=80 If you don't use Vim, this roughly translates to: - Make tabs 8 characters wide (and don't expand them into spaces) - Indent four spaces for every level - Wrap your lines at 80 characters - Follow the brace, indent and comment style in the code. It's not the end of the world if you don't wrap lines at 80 characters (though we strongly urge you to). But if you break the indent, brace, or comment style you will get flamed by me (gi1242). 2. You're probably aware of our design goals: Small, light, and CPU friendly. Don't bend this one too much, otherwise you will get flamed 3. Don't add dependencies unless you ABSOLUTELY have to. Even then, discuss it first on the devel list. Regardless, any dependency you add MUST be optional, and mrxvt should be able compile and run without it. 4. If you are adding a new experimental feature (e.g. Jimmy's memory code), then make sure you #ifdef it out. Thus you can use the feature by compiling with env CFLAGS="-DFANTASTIC_FEATURE" configure --enable-everything Once your feature has become stable, either add a macro in src/feature.h, or a --enable configure option. 5. Comment your code! Either me or Jimmy might remove / rewrite it otherwise. (Jimmy's removed some under commented code of mine before, and he's sure to do it again should the need arise.) 6. If you've added a new feature, PLEASE DOCUMENT IT. 7. If you've done something on this TODO list, please update this list. 8. We're flexible! If for some reason you don't want to follow the above coding guidelines, then LET US KNOW. We're open to discussion on coding styles / etc. If we agree to your proposed change, then it is your responsibility to change the style of the current mrxvt codebase to the agreed new style. Just sending us a patch with only your code in your style will get you flamed. 9. Mrxvt is GPL. Don't write code for us unless you are willing to release it under GPL. That's it. Happy hacking -------------------------------------------------------------------------------- Authors : Jimmy Zhou, Gautam Iyer $LastChangedDate: 2008-06-29 23:28:25 -0700 (Sun, 29 Jun 2008) $ mrxvt-0.5.4/aclocal.m40000644000175000001440000010156511012076335011463 00000000000000# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(AC_AUTOCONF_VERSION, [2.61],, [m4_warning([this file was generated for autoconf 2.61. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer], USE_MAINTAINER_MODE=$enableval, USE_MAINTAINER_MODE=no) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST(MAINT)dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR mrxvt-0.5.4/share/0000777000175000001440000000000011045531320010775 500000000000000mrxvt-0.5.4/share/etc/0000777000175000001440000000000011045531320011550 500000000000000mrxvt-0.5.4/share/etc/rxvt.termcap0000644000175000001440000000177610756127603014074 00000000000000rxvt|rxvt terminal emulator (X Window System):\ :am:eo:km:ms:ut:xn:xo:\ :co#80:it#8:li#24:Co#8:pa#64:\ :AB=\E[4%dm:AF=\E[3%dm:AL=\E[%dL:\ :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ :RI=\E[%dC:UP=\E[%dA:\ :ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ :ho=\E[H:i1=\E[?47l\E=\E[?1l:ic=\E[@:\ :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\ :k0=\E[21~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:\ :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=\E>:\ :kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\ :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:op=\E[m:rc=\E8:sc=\E7:\ :se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ :te=\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:us=\E[4m:\ :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h:\ :@7=\E[8~:kh=\E[7~: # When compiled with LINUX_KEYS the last line becomes # :@7=\E[4~:kh=\E[1~: mrxvt-0.5.4/share/etc/mrxvt.terminfo0000644000175000001440000000515010756127603014427 00000000000000# 2006-02-24 Gautam Iyer # # This file has been modified from the rxvt.terminfo file for mrxvt. # # NOTE: This file defines capabilities for a terminal named "rxvt" (not mrxvt). # The differences from the original rxvt's terminal capabilities are listed # below: # # 1. Modified function and cursor keys produce xterm like sequences, and not # rxvt like sequences. # 2. The terminal has 256 colors by default (The original rxvt terminal # emulator has a compile time option to support 256 colors). # # Install this file using "tic mrxvt.terminfo". # rxvt|mrxvt terminal emulator (X Window System), am, bce, eo, km, mir, msgr, xenl, xon, colors#256, cols#80, it#8, lines#24, ncv@, pairs#32717, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, kend=\E[8~, kent=\EOM, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t^N %e^O%;, sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, # vim: set ft=terminfo : mrxvt-0.5.4/share/etc/rxvt.terminfo0000644000175000001440000000516310756127603014256 00000000000000# From: Thomas Dickey 04 Oct 1997 # Updated: zgr Kesim 02 Nov 1997 # Notes: # rxvt 2.21b uses # smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, # but some applications don't work with that. # It also has an AIX extension # box2=lqkxjmwuvtn, # and # ech=\E[%p1%dX, # but the latter does not work correctly. # # rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. # Since rxvt is not really compatible with xterm, it should be configured as # "rxvt-basic" (monochrom) and "rxvt" rxvt-basic|rxvt terminal base (X Window System), am, bce, eo, km, msgr, xenl, xon, cols#80, it#8, lines#24, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, kend=\E[8~, kent=\EOM, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[?47l\E8, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, s0ds=\E(B, s1ds=\E(0, sc=\E7, sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, rxvt|rxvt terminal emulator (X Window System), colors#8, pairs#64, op=\E[39;49m, setab=\E[%p1%{40}%+%dm, setaf=\E[%p1%{30}%+%dm, use=rxvt-basic, # vim: set ft=terminfo : mrxvt-0.5.4/share/etc/XTerm.ad0000644000175000001440000000351610756127603013053 00000000000000! Put this into ~/.Xdefaults, or to app-defaults/XTerm or wherever ! xrm will loaded it. ! ! This will match the key sequences for a regular xterm to those used ! by rxvt and the enclosed termcap and terminfo files. ! ! As usual, the most annoying xterm keys are Home/End and the ubiquitous ! BackSpace/Delete confusion. XTerm*vt100.translations: #override \ BackSpace: string("\010") \n\ ShiftTab: string("\033[Z") \n\ Ctrlminus: string("\037") \n\ Home: string("\033[1~") \n\ End: string("\033[4~") \n\ Delete: string("\033[3~") \n\ ShiftDelete: string("\177") \n\ CtrlDelete: string("\010") \n\ AltReturn: string("\033\015") \n\ Altspace: string("\033\040") \n\ Alta: string("\033a") \n\ Altb: string("\033b") \n\ Altc: string("\033c") \n\ Altd: string("\033d") \n\ Alte: string("\033e") \n\ Altf: string("\033f") \n\ Altg: string("\033g") \n\ Alth: string("\033h") \n\ Alti: string("\033i") \n\ Altj: string("\033j") \n\ Altk: string("\033k") \n\ Altl: string("\033l") \n\ Altm: string("\033m") \n\ Altn: string("\033n") \n\ Alto: string("\033o") \n\ Altp: string("\033p") \n\ Altq: string("\033q") \n\ Altr: string("\033r") \n\ Alts: string("\033s") \n\ Altt: string("\033t") \n\ Altu: string("\033u") \n\ Altv: string("\033v") \n\ Altw: string("\033w") \n\ Altx: string("\033x") \n\ Alty: string("\033y") \n\ Altz: string("\033z") \n\ CtrlUp: string("\033Oa") \n\ CtrlDown: string("\033Ob") \n\ CtrlRight: string("\033Oc") \n\ CtrlLeft: string("\033Od") \n\ ShiftUp: string("\033[a") \n\ ShiftDown: string("\033[b") \n\ ShiftRight: string("\033[c") \n\ ShiftLeft: string("\033[d") \n !EOF mrxvt-0.5.4/share/default.menu0000644000175000001440000000506111006154164013231 00000000000000# ---------------------------------*-menu-*------------------------------------- # File: default.menu # ------------------------------------------------------------------------------ # # All portions of code are copyright by their respective author/s. # # Copyright (c) 2005-2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. # ------------------------------------------------------------------------------ # Popup menus :) [menu:popup] # By default have Control Click popup a tab menu. /PopupButton1/* # /PopupButton2/* # {Item1}{Ctrl-A} Str item1 # {Item2}{Ctrl-B} Str item2 # {Null str} Esc hello /PopupButton3/* {Toggle Menubar}{Ctrl-Shift-m} ToggleSubwin m {Toggle Tabbar}{Ctrl-Shift-i} ToggleSubwin t {Toggle Scrollbar}{Ctrl-Shift-d} ToggleSubwin s {-} {Toggle Fullscreen} ToggleFullscreen {Toggle Macros} ToggleMacros {-} {Paste} Paste {Paste secondary buffer} Paste SECONDRAY {Paste clipboard buffer} Paste CLIPBOARD {Paste file from selection} PasteFile %s [read:submenus;selection] {-} [read:submenus;tabsmenu] [read:submenus;transparent] [menu] [clear] [title: ] # Prior/Next & Home/End are messed up # ^A^E^Y^V / [read:submenus;tabsmenu] /View/* {Toggle Menubar}{Ctrl-Shift-m} ToggleSubwin m {Toggle Scrollbar}{Ctrl-Shift-d} ToggleSubwin s {Toggle Tabbar}{Ctrl-Shift-i} ToggleSubwin t {Toggle Tabbar buttons}{Ctrl-Shift-a} ToggleSubwin b #2007-01-28 gi1242: Hiding all subwindows doesn't work well #{-} #{Hide all subwindows} ToggleSubwin -mst #{Show all subwindows} ToggleSubwin +mst #{-} ./Colors/* {Reverse video} Esc \e[?5h {Normal video} Esc \e[?5l {-} {Toggle boldColors} ToggleBoldColors {Toggle veryBright} ToggleVeryBright {Toggle veryBoldFont}{Ctrl-Shift-b} ToggleVeryBold {-} [read:submenus;background] [read:submenus;foreground] ../ [read:submenus;transparent] [read:submenus;translucent] ../ [done] # vim: ft=conf nospell: mrxvt-0.5.4/share/submenus.menu0000644000175000001440000000754011032001370013437 00000000000000# ---------------------------------*-menu-*------------------------------------- # File: submenus.menu # ------------------------------------------------------------------------------ # # All portions of code are copyright by their respective author/s. # # Copyright (c) 2005-2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. # ------------------------------------------------------------------------------ # This file contains the basic menu blocks for mrxvt. The idea is that when # defining menus, all one needs to do is add a line containing # # [read:submenus.menu;] # # to have the appropriate submenus read in. # Submenu containing generic tab operations [menu:tabsmenu] ./Tabs/* ./New/* {Shell}{Ctrl-Shift-t} NewTab "Shell" ./Profile/* {Duplicate}{Ctrl-Shift-n} NewTab - {Profile 1} NewTab -1 {Profile 2} NewTab -2 {Profile 3} NewTab -3 {Profile 4} NewTab -4 ../ {Mutt} NewTab !mutt {Vim} NewTab !vim {Shell (root)} NewTab "su" su - {-} {Mrxvt Man page}{Ctrl-Shift-F1} NewTab "man mrxvt" man mrxvt ../ {Close tab}{Ctrl-Shift-w} Close 0 {-} {Show previous tab}{Ctrl-Tab} GotoTab 0 {Show left tab}{Ctrl-Shift-h} GotoTab -1 {Show right tab}{Ctrl-Shift-l} GotoTab +1 ./Switch to tab/* ../ ./Monitor tab/* {Activity} MonitorTab ACTIVITY {Inactivity} MonitorTab INACTIVITY {Automatic} MonitorTab AUTO ../ {-} {Move tab left}{Ctrl-Shift-<} MoveTab -1 {Move tab right}{Ctrl-Shift->} MoveTab +1 {-} {Save config} SaveConfig {Exit}{Ctrl-shift-q} Close ../ [done:tabsmenu] # Transparency related options [menu:transparent] ./Transparency/* {Toggle}{Ctrl-Shift-r} ToggleTransparency {-} {Increase shading}{Ctrl-Shift-j} Esc \e]67;+5\a {Decrease shading}{Ctrl-Shift-k} Esc \e]67;-5\a {-} ./Tint background/* {Black} Esc \e]66;#000000\a {Red} Esc \e]66;#200000\a {Green} Esc \e]66;#002000\a {Yellow} Esc \e]66;#202000\a {Blue} Esc \e]66;#000020\a {Magenta} Esc \e]66;#200020\a {Cyan} Esc \e]66;#002020\a {Grey} Esc \e]66;#202020\a ../ ../ [done:transparent] # Change background / foreground color [menu:background] ./Background/* {Black} Esc \e]49;#000000\a {Red} Esc \e]49;#200000\a {Green} Esc \e]49;#002000\a {Yellow} Esc \e]49;#202000\a {Blue} Esc \e]49;#000020\a {Magenta} Esc \e]49;#200020\a {Cyan} Esc \e]49;#002020\a {Grey} Esc \e]49;#202020\a ../ [done:background] [menu:foreground] ./Foreground/* {Black} Esc \e]39;#000000\a {Red} Esc \e]39;#9a0000\a {Green} Esc \e]39;#009a00\a {Yellow} Esc \e]39;#9a9a00\a {Blue} Esc \e]39;#00009a\a {Magenta} Esc \e]39;#9a009a\a {Cyan} Esc \e]39;#009a9a\a {Grey} Esc \e]39;#9a9a9a\a ../ [done:foreground] # Translucency related options [menu:translucent] ./Translucency/* {Increase}{Ctrl-Shift-o} Esc \e]70;+5\a {Decrease}{Ctrl-Shift-u} Esc \e]70;-5\a ../ [done:translucent] # Selection related operations [menu:selection] ./Open selection in/* {Firefox} Exec firefox %s {w3m} NewTab "w3m" w3m %s {mutt} NewTab "mutt" mutt %s ../ [done:selection] mrxvt-0.5.4/share/scripts/0000777000175000001440000000000011045531320012464 500000000000000mrxvt-0.5.4/share/scripts/mrxvtset.pl0000644000175000001440000002377310756127603014662 00000000000000#!/usr/bin/perl -w # # All portions of code are copyright by their respective author/s. # Copyright (c) 2004 Avi Yagodnick # Copyright (c) 2006 mark olesen # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. # # --------------------------------------------------------------------------- # # Mark Olesen: 2006-01-10 # Complete code re-write (uses warnings/strict) as all perl code should. # The entire program is a set of callbacks for Getopt::Long # # --------------------------------------------------------------------------- use strict; use Getopt::Long; ( my $Script = $0 ) =~ s{^.*/}{}; our ( $VERSION, $DATE ) = do { my ( $ver, $date ) = q{$Id: mrxvtset.pl,v 1.2 2006/02/24 23:51:44 jimmyzhou Exp $} =~ m{\s+(\d+\.\d+).*?\s+(\d{4}[-/]\d{2}[-/]\d{2})}; $date =~ s{/}{-}g; # ISO-formatted ( $ver, $date ); }; my %config = ( ## set it to your favourite location you wish pixmap => "/tmp/rxvtpixmap-" . getpwuid($<) . ".xpm", ); # # conversion of file formats # sub convert_pixmap { my ($val) = @_; -f $val or return undef; return $val if $val =~ /\.(xpm)$/; if ( $val =~ /\.(gif|jpe?g|png)$/i ) { system( convert => $val => $config{pixmap} ); chmod 0666 => $config{pixmap}; return $config{pixmap}; } return undef; } # # lookup table with the xterm codes # my %opcode = ( title => 0, # change title and iconName ## XTerm_name (0) ## XTerm_iconName (1) ## XTerm_title (2) ## XTerm_Color (4) /* change colors */ cursor => 12, # Xterm_Color_cursor: change actual 'Cursor' color pointer => 13, # Xterm_Color_pointer: change actual 'Pointer' color highlight => 17, # XTerm_Color_RV: change actual 'Highlight' color bold => 18, # Xterm_Color_BD: change actual 'Bold' color underline => 19, # Xterm_Color_UL: change actual 'Underline' color ## XTerm_logfile (46) /* not implemented */ fn => 50, # Xterm_font: restrict our use to font numbers ## XTerm_Menu (10) /* set menu item */ pixmap => 20, # new bg pixmap fg => 39, # Xterm_restoreFG: change default fg color bg => 49, # Xterm_restoreBG: change default bg color ## XTerm_dumpscreen (55) /* dump scrollback and all screen */ tabtitle => 60, # Xterm_tab: change tab title ## Xterm_tabterm (62) /* change tab and terminal title */ newtab => 63, # create a new tab with title ## Xterm_prevtab (64) /* switch to previous tab */ ## Xterm_nexttab (65) /* switch to next tab */ ## Xterm_tint (66) /* change tinting color */ ## Xterm_shade (67) /* change shade level */ ## Xterm_encode (68) /* change encoding */ tb => 69, # Xterm_hide: hide/show tabbar ## Xterm_opacity (70) /* set opacity level */ tabbtn => 71, # hide/show tabbar buttons tabfg => 72, # change active tab fg tabbg => 73, # change tabbar/active tab bg itabfg => 74, # change inactive tab fg itabbg => 75, # change inactive tab bg trans => 76, # toggle transparency left => 77, # Xterm_moveleft: move active tab to left right => 78, # Xterm_moveright: move active tab to right ## Xterm_verybold (79) /* toggle bold font for color text */ ## Xterm_hotkeys (80) /* toggle hotkeys */ ## Xterm_saveconfig (81) /* save configuration */ ## Xterm_bgfade (82) /* set bgfade degree */ ## Xterm_termenv (83) /* set TERMENV type */ ); # # process high/low/toggle commands # sub high_low_toggle { my ( $type, $val, $opcode ) = @_; print "\033[?${opcode}$val\007" if $val =~ s/^(1|y|t).*$/h/i # high or $val =~ s/^(0|n|f).*$/l/i # low or $val =~ s/^$/t/ # toggle } # XTerm OSCs: # ESC ] Ps;Pt (ST|BEL) # process xterm toggle commands sub xterm_osc { my ( $type, $val, $opcode ) = @_; # warn "$type <$val>\n"; my $op = $opcode || $opcode{$type}; if ( defined $op ) { print "\033]${op};$val\007"; } else { warn "programming error for xterm_osc '$type'\n"; } } # --------------------------------------------------------------------------- sub usage { $! = 0; # clean exit warn @_, "\n" if @_; die << "USAGE"; usage: $Script { SETTINGS } SETTINGS: -fg COLOR change foreground color -fg 0-15 change foreground to a particular color index -bg COLOR change background color -bg 0-15 change background to a particular color index -cursor COLOR change cursor color (alias: -cr) -pointer COLOR change pointer color (alias: -pr) -bold COLOR change bold color (alias: -bd) -underline COLOR change underline color (alias: -ul) -highlight COLOR change highlight (reverse video) color (alias: -rv) -tabfg COLOR change active tab foreground -tabbg COLOR change active tab background -itabfg COLOR change inactive tab foreground (alias: -tabifg) -itabbg COLOR change inactive tab background (alias: -tabibg) -pixmap FILE if file is not xpm, uses 'convert'. Note special names: "none", "full", "tiled" (NB: full/tiled seem to be broken) -fn [INDEX] font number 0-6 or +/-, empty for default -title STRING change terminal title and icon name -tabtitle STRING change tab title (*) -newtab STRING create new tab with title (*) -left move active tab to left -right move active tab to right -tb toggle tabbar visibility (*) -tbb toggle tabbar button visibility (alias: tabbtn) (*) -tr toggle transparency (alias: trans) (*) -mb [Y|N|empty] set, unset or toggle menubar visibility -sb [Y|N|empty] set, unset or toggle scrollbar visibility Change (m)rxvt parameters on the fly. NB: 'COLOR' can be a color name or specification NB: aterm only supports some options (does not support fg) (*) - mrxvt only version $VERSION ($DATE) copyright (c) 2006 Mark Olesen USAGE } # --------------------------------------------------------------------------- my %opt; @ARGV or usage("missing settings"); GetOptions( \%opt, "help|h" => sub { die "\n"; }, # reverts to usage # select fonts by number or relative (-/+) # --------------- "fn:s" => sub { my ( $type, $val ) = @_; if ( $val =~ /^([-+]|\d+)$/ or $val =~ s/^(default|normal)?$// ) { xterm_osc( $type => "#$val" ); } }, # foreground color - ensure reset screen works # --------------- "fg=s" => sub { my ( $type, $val ) = @_; xterm_osc( fg => $val ); }, # background color - problematic with / without pixmap # --------------- "bg=s" => sub { my ( $type, $val ) = @_; ## use the direct method if an index was specified if ( $val =~ /^\d+$/ ) { xterm_osc( bg => $val ); } else { ## let us sneak in pixmaps here too! my $xpm = convert_pixmap($val); unless ( defined $xpm ) { $xpm = $config{pixmap}; ## cheat - set background color indirectly (via a pixmap) local *FILE; open FILE, ">$xpm" or warn "Cannot write to pixmap '$xpm'\n" and return; print FILE << "PIXMAP"; /* XPM */ static char *rxvtbg[] = { /* columns rows colors chars-per-pixel */ "1 1 1 1", "x c $val", /* pixels */ "x" }; PIXMAP chmod 0666 => $xpm; close FILE; } xterm_osc( pixmap => $xpm ); } }, # background pixmap control # --------------- "pixmap=s" => sub { my ( $type, $val ) = @_; if ( $val eq "none" ) { xterm_osc( pixmap => "" ); } ## this part seems to be very broken ! elsif ( $val eq "full" ) { print "\033[m"; xterm_osc( pixmap => ";100x100+50+50;?" ); } elsif ( $val eq "tiled" ) { print "\033[m"; xterm_osc( pixmap => ";;0" ); } elsif ( -f $val ) { my $xpm = convert_pixmap($val); defined $xpm or warn "skipping unknown file format\n" and return; xterm_osc( pixmap => $val ) if -f $val; } else { warn "skipping non-existent file\n"; } }, # # high/low/toggle # "sb:s" => sub { high_low_toggle( @_, 30 ) }, # scrollbar visibility "mb:s" => sub { high_low_toggle( @_, 10 ) }, # menubar visibility # # the following use xterm_osc() directly # ( map { ( $_ => \&xterm_osc ) } ( "cursor|cr=s", # change cursor color "pointer|pr=s", # change pointer color "bold|bd=s", # change bold color "underline|ul=s", # change underline color "highlight|rv=s", # change highlight color "tb", # toggle tabbar visibility "tabbtn|tbb", # toggle tabbar button visibility "tabfg=s", # change active tab fg "tabbg=s", # change active tab bg "itabfg|tabifg=s", # change inactive tab fg "itabbg|tabibg=s", # change inactive tab bg "trans|tr", # toggle transparency "left", # move active tab to left "right", # move active tab to right "title=s", # change terminal title and icon name "tabtitle=s", # change tab title "newtab=s", # create new tab with title ) ), ) or usage(); # use Data::Dumper; # warn Dumper(\%opt); # --------------------------------------------------------------- end-of-file mrxvt-0.5.4/share/scripts/mrxvt.vbs0000644000175000001440000000366010756127603014316 00000000000000' ' All portions of code are copyright by their respective author/s. ' Copyright (c) 2004 Matthew Melendy ' ' 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., 675 Mass Ave, Cambridge, MA 02139, USA. ' ' ' This program is used to launch mrxvt directly from a Windows ' shortcut for Cygwin users. ' ' You should change the CYGWIN_ROOT and PATH variables according to ' your installation path of cygwin and mrxvt.exe. ' ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Setup variables ' option explicit dim program, CYGWIN_ROOT, CurrentPath, WshProcessEnv, mrxvtCommandLine CYGWIN_ROOT = "C:\Cygwin" mrxvtCommandLine = "mrxvt.exe -e /bin/bash --login -i" ' ' Create WSH scripting object and obtain current PATH value ' set program = CreateObject("WScript.Shell") set WshProcessEnv = program.Environment("PROCESS") CurrentPath = WshProcessEnv("PATH") ' ' Set environment variables required by Xwin ' WshProcessEnv("DISPLAY") = "127.0.0.1:0.0" WshProcessEnv("CYGWIN_ROOT")=CYGWIN_ROOT WshProcessEnv("PATH")=CYGWIN_ROOT & "\bin;" & CYGWIN_ROOT & "\usr\X11R6\bin;" & CYGWIN_ROOT & "\usr\local\bin;" & CurrentPath ' ' Launch the XWin server with the console window hidden and continue ' program.run mrxvtCommandLine,0,0 ' ' Close WSH script object and exit ' set program=nothing mrxvt-0.5.4/share/scripts/settitle.c0000644000175000001440000001251310756127603014420 00000000000000/* * All portions of code are copyright by their respective author/s. * Copyright (c) 2004 Jingmin Zhou * * 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 Library 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 program acts as a wrapper of the escape sequence to set the ** tab and terminal title with user supplied string. */ #include #include /* ** mrxvt extensions of XTerm OSCs: ESC ] Ps;Pt (ST|BEL) ** Example: echo "\e]61;newtitle\a" */ #define Xterm_tab (61) /* change tab title */ #define Xterm_tabterm (62) /* change tab and terminal title */ #define Xterm_newtab (63) /* create a new tab with title */ #define Xterm_prevtab (64) /* switch to previous tab */ #define Xterm_nexttab (65) /* switch to next tab */ #define Xterm_tint (66) /* change tinting color */ #define Xterm_shade (67) /* change shade level */ #define Xterm_encode (68) /* change encoding */ #define Xterm_hide (69) /* hide/show tabbar */ #define Xterm_opacity (70) /* set opacity level */ #define Xterm_tabbtn (71) /* hide/show tabbar button */ #define Xterm_tabfg (72) /* change active tab fg */ #define Xterm_tabbg (73) /* change tabbar/active tab bg */ #define Xterm_itabfg (74) /* change inactive tab fg */ #define Xterm_itabbg (75) /* change inactive tab bg */ #define Xterm_trans (76) /* toggle background transparency */ #define Xterm_moveleft (77) /* move active tab to left */ #define Xterm_moveright (78) /* move active tab to right */ #define Xterm_verybold (79) /* toggle bold font for color text */ #define Xterm_hotkeys (80) /* toggle hotkeys */ #define Xterm_saveconfig (81) /* save configuration */ #define Xterm_bgfade (82) /* set bg fading degree */ static void usage (int argc, char** argv) { fprintf (stderr, "Usage:\n"); fprintf (stderr, " %s -t tab_title # set tab/terminal title\n", argv[0]); fprintf (stderr, " %s -c tab_title # create a new tab\n", argv[0]); fprintf (stderr, " %s -e encoding # change encoding method\n", argv[0]); fprintf (stderr, " %s -g color # change tinting color\n", argv[0]); fprintf (stderr, " %s -s number # change shade of tinting\n", argv[0]); fprintf (stderr, " %s -o [-+]number # change opacity level\n", argv[0]); fprintf (stderr, " %s -p # activate previous tab\n", argv[0]); fprintf (stderr, " %s -n # activate next tab\n", argv[0]); fprintf (stderr, " %s -a # hide/show tabbar buttons\n", argv[0]); fprintf (stderr, " %s -H [m|t|s] # hide/show tabbar/scrollbar/menubar\n", argv[0]); exit (1); } void main (int argc, char** argv) { if (2 != argc && 3 != argc) { usage (argc, argv); } if (3 == argc && strcmp ("-t", argv[1]) && strcmp ("-c", argv[1]) && strcmp ("-e", argv[1]) && strcmp ("-g", argv[1]) && strcmp ("-s", argv[1]) && strcmp ("-o", argv[1]) && strcmp ("-H", argv[1])) { usage (argc, argv); exit (1); } if (2 == argc) { if (!strcmp ("-H", argv[1])) /* switch to previous tab */ fprintf (stdout, "%c]%d;%c", 033, Xterm_hide, 007); else if (!strcmp ("-a", argv[1])) /* switch to previous tab */ fprintf (stdout, "%c]%d;%c", 033, Xterm_tabbtn, 007); else if (!strcmp ("-p", argv[1])) /* switch to previous tab */ fprintf (stdout, "%c]%d;%c", 033, Xterm_prevtab, 007); else if (!strcmp ("-n", argv[1])) /* switch to next tab */ fprintf (stdout, "%c]%d;%c", 033, Xterm_nexttab, 007); else if (!strcmp ("-t", argv[1]) || !strcmp ("-c", argv[1])) usage (argc, argv); /* switch to next tab */ else /* set tab title */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_tab, argv[1], 007); } else if (3 == argc && !strcmp ("-t", argv[1])) { /* set tab and terminal title */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_tabterm, argv[2], 007); } else if (3 == argc && !strcmp ("-c", argv[1])) { /* create new tab with user supplied title */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_newtab, argv[2], 007); } else if (3 == argc && !strcmp ("-e", argv[1])) { /* change encoding method */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_encode, argv[2], 007); } else if (3 == argc && !strcmp ("-g", argv[1])) { /* change tinting color */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_tint, argv[2], 007); } else if (3 == argc && !strcmp ("-s", argv[1])) { /* change shade value for tinting */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_shade, argv[2], 007); } else if (3 == argc && !strcmp ("-o", argv[1])) { /* change shade value for tinting */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_opacity, argv[2], 007); } else if (3 == argc && !strcmp ("-H", argv[1])) { /* show/hide tabbar/scrollbar/menubar */ fprintf (stdout, "%c]%d;%s%c", 033, Xterm_hide, argv[2], 007); } exit (0); } mrxvt-0.5.4/share/Makefile.am0000644000175000001440000000322410756127603012763 00000000000000# All portions of code are copyright by their respective author/s. # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. docdir = $(datadir)/doc/$(PACKAGE_NAME) dist_conf_DATA = default.menu submenus.menu mrxvtrc mrxvtrc.sample confdir = $(sysconfdir)/$(PACKAGE_NAME) # Distribute scripts with documentation. Package maintaners can clean them up # and install them if necessary. dist_scripts_DATA = scripts/mrxvt.vbs scripts/mrxvtset.pl scripts/settitle.c scriptsdir = $(docdir)/scripts dist_pixmap_DATA = pixmaps/mrxvt-csh.png \ pixmaps/mrxvt-root.png \ pixmaps/mrxvt.png \ pixmaps/mrxvt-csh.xpm \ pixmaps/mrxvt-root.xpm \ pixmaps/mrxvt.xpm pixmapdir = $(datadir)/pixmaps # builds_DATA = builds/mrxvt.SlackBuild \ # builds/mrxvt.slack-desc \ # builds/mrxvt.spec # buildsdir = $(pkgdatadir)/builds dist_etc_DATA = etc/XTerm.ad \ etc/mrxvt.terminfo \ etc/rxvt.termcap \ etc/rxvt.terminfo etcdir = $(docdir)/etc mrxvt-0.5.4/share/Makefile.in0000644000175000001440000003256411012076342012772 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # All portions of code are copyright by their respective author/s. # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = share DIST_COMMON = $(dist_conf_DATA) $(dist_etc_DATA) $(dist_pixmap_DATA) \ $(dist_scripts_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(confdir)" "$(DESTDIR)$(etcdir)" \ "$(DESTDIR)$(pixmapdir)" "$(DESTDIR)$(scriptsdir)" dist_confDATA_INSTALL = $(INSTALL_DATA) dist_etcDATA_INSTALL = $(INSTALL_DATA) dist_pixmapDATA_INSTALL = $(INSTALL_DATA) dist_scriptsDATA_INSTALL = $(INSTALL_DATA) DATA = $(dist_conf_DATA) $(dist_etc_DATA) $(dist_pixmap_DATA) \ $(dist_scripts_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = $(datadir)/doc/$(PACKAGE_NAME) dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ dist_conf_DATA = default.menu submenus.menu mrxvtrc mrxvtrc.sample confdir = $(sysconfdir)/$(PACKAGE_NAME) # Distribute scripts with documentation. Package maintaners can clean them up # and install them if necessary. dist_scripts_DATA = scripts/mrxvt.vbs scripts/mrxvtset.pl scripts/settitle.c scriptsdir = $(docdir)/scripts dist_pixmap_DATA = pixmaps/mrxvt-csh.png \ pixmaps/mrxvt-root.png \ pixmaps/mrxvt.png \ pixmaps/mrxvt-csh.xpm \ pixmaps/mrxvt-root.xpm \ pixmaps/mrxvt.xpm pixmapdir = $(datadir)/pixmaps # builds_DATA = builds/mrxvt.SlackBuild \ # builds/mrxvt.slack-desc \ # builds/mrxvt.spec # buildsdir = $(pkgdatadir)/builds dist_etc_DATA = etc/XTerm.ad \ etc/mrxvt.terminfo \ etc/rxvt.termcap \ etc/rxvt.terminfo etcdir = $(docdir)/etc all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu share/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu share/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-dist_confDATA: $(dist_conf_DATA) @$(NORMAL_INSTALL) test -z "$(confdir)" || $(MKDIR_P) "$(DESTDIR)$(confdir)" @list='$(dist_conf_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_confDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(confdir)/$$f'"; \ $(dist_confDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(confdir)/$$f"; \ done uninstall-dist_confDATA: @$(NORMAL_UNINSTALL) @list='$(dist_conf_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(confdir)/$$f'"; \ rm -f "$(DESTDIR)$(confdir)/$$f"; \ done install-dist_etcDATA: $(dist_etc_DATA) @$(NORMAL_INSTALL) test -z "$(etcdir)" || $(MKDIR_P) "$(DESTDIR)$(etcdir)" @list='$(dist_etc_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_etcDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(etcdir)/$$f'"; \ $(dist_etcDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(etcdir)/$$f"; \ done uninstall-dist_etcDATA: @$(NORMAL_UNINSTALL) @list='$(dist_etc_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(etcdir)/$$f'"; \ rm -f "$(DESTDIR)$(etcdir)/$$f"; \ done install-dist_pixmapDATA: $(dist_pixmap_DATA) @$(NORMAL_INSTALL) test -z "$(pixmapdir)" || $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" @list='$(dist_pixmap_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_pixmapDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pixmapdir)/$$f'"; \ $(dist_pixmapDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pixmapdir)/$$f"; \ done uninstall-dist_pixmapDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pixmap_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pixmapdir)/$$f'"; \ rm -f "$(DESTDIR)$(pixmapdir)/$$f"; \ done install-dist_scriptsDATA: $(dist_scripts_DATA) @$(NORMAL_INSTALL) test -z "$(scriptsdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptsdir)" @list='$(dist_scripts_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(dist_scriptsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(scriptsdir)/$$f'"; \ $(dist_scriptsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(scriptsdir)/$$f"; \ done uninstall-dist_scriptsDATA: @$(NORMAL_UNINSTALL) @list='$(dist_scripts_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(scriptsdir)/$$f'"; \ rm -f "$(DESTDIR)$(scriptsdir)/$$f"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(confdir)" "$(DESTDIR)$(etcdir)" "$(DESTDIR)$(pixmapdir)" "$(DESTDIR)$(scriptsdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dist_confDATA install-dist_etcDATA \ install-dist_pixmapDATA install-dist_scriptsDATA install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_confDATA uninstall-dist_etcDATA \ uninstall-dist_pixmapDATA uninstall-dist_scriptsDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_confDATA install-dist_etcDATA \ install-dist_pixmapDATA install-dist_scriptsDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_confDATA uninstall-dist_etcDATA \ uninstall-dist_pixmapDATA uninstall-dist_scriptsDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mrxvt-0.5.4/share/mrxvtrc0000644000175000001440000002525311035226241012352 00000000000000# ---------------------------------------------------------------------------- # # # For an example configuration file, you probably want to look at mrxvtrc.sample # (provided with the source archive), and not this file. # # This is the system wide configuration file for mrxvt (versions 0.5.0 or # higher). Only resources with application name 'Mrxvt' are read from this file. # The only resources defined in this file are default macro (formerly hotkey) # definitions for mrxvt. # # Preferably avoid making modifications to this file directly, but make # modifications to your user config file (~/.mrxvtrc) instead. Remember that # macros can be deleted by assigning "Dummy" to the keystroke. # # Starting mrxvt with --noSysConfig will disable reading this file completely. # # ---------------------------------------------------------------------------- # # ---------------------------------------------------------------------------- # # # GENERAL SETTINGS # # ---------------------------------------------------------------------------- # Mrxvt.showMenu: true # Tab bar colors Mrxvt.itabBackground: #101010 Mrxvt.tabBackground: #900000 Mrxvt.itabForeground: #909090 Mrxvt.tabForeground: #9a9a9a # Scroll bar colors Mrxvt.scrollColor: #808080 Mrxvt.troughColor: #202020 # Cursor Mrxvt.cursorBlink: true Mrxvt.cursorColor: #00ff00 Mrxvt.cursorColor2: #000000 # Setup colors for a black background. Mrxvt.background: #000000 Mrxvt.foreground: #ffffff Mrxvt.color0: #000000 Mrxvt.color1: #af0000 Mrxvt.color2: #00af00 Mrxvt.color3: #afaf00 Mrxvt.color4: #0000af Mrxvt.color5: #af00af Mrxvt.color6: #00afaf Mrxvt.color7: #9a9a9a Mrxvt.color8: #5f5f5f Mrxvt.color9: #d70000 Mrxvt.color10: #00d700 Mrxvt.color11: #d7d700 Mrxvt.color12: #0000d7 Mrxvt.color13: #d700d7 Mrxvt.color14: #00d7d7 Mrxvt.color15: #d7d7d7 # Display bold and underlined text in color, rather than using the terminal # attributes. This makes reading man pages a little easier. Mrxvt.colorBD: #00afaf Mrxvt.colorUL: #00af00 # Display the X selection as highlighted instead of using reverse video. Mrxvt.highlightColor: #303060 Mrxvt.bottomTabbar: True Mrxvt.scrollbarRight: True # Default shading to use when run with -tr Mrxvt.shading: 80 # NOTE: Macros defined with class Mrxvt or XTerm will NOT replace existing # macros. So user macros will not be replaced. # ---------------------------------------------------------------------------- # # # XTERM STYLE MACROS # # ---------------------------------------------------------------------------- # # # These were previously hardcoded into the source in command.c. # Mrxvt.macro.Primary+Shift+Prior: Scroll -1p Mrxvt.macro.Primary+Shift+Next: Scroll +1p Mrxvt.macro.Shift+Insert: Paste Mrxvt.macro.Shift+KP_Add: ResizeFont +1 Mrxvt.macro.Shift+KP_Subtract: ResizeFont -1 # Shift F1 -- F10 used to produce F11 -- F20. (This was also hardcoded into the # source). If desired those can be added here using the Str macro. # ---------------------------------------------------------------------------- # # # GNOME TERMINAL STYLE DEFAULT MACROS # # ---------------------------------------------------------------------------- # Mrxvt.macro.Ctrl+Shift+t: NewTab Mrxvt.macro.Ctrl+Shift+w: Close 0 Mrxvt.macro.Add+Ctrl+Shift+w: ToggleHold -6 Mrxvt.macro.Ctrl+Shift+q: Close Mrxvt.macro.Ctrl+Prior: GotoTab -1 Mrxvt.macro.Ctrl+Next: GotoTab +1 Mrxvt.macro.Alt+1: GotoTab 1 Mrxvt.macro.Alt+2: GotoTab 2 Mrxvt.macro.Alt+3: GotoTab 3 Mrxvt.macro.Alt+4: GotoTab 4 Mrxvt.macro.Alt+5: GotoTab 5 Mrxvt.macro.Alt+6: GotoTab 6 Mrxvt.macro.Alt+7: GotoTab 7 Mrxvt.macro.Alt+8: GotoTab 8 Mrxvt.macro.Alt+9: GotoTab 9 Mrxvt.macro.Alt+0: GotoTab 10 Mrxvt.macro.Ctrl+equal: ResizeFont +1 Mrxvt.macro.Ctrl+minus: ResizeFont -1 # Instead of having some 1500 macros do the same thing, resize the font in # increments of 2 for Ctrl+Shift. Mrxvt.macro.Ctrl+Shift+plus: ResizeFont +2 Mrxvt.macro.Ctrl+Shift+underscore: ResizeFont -2 # ---------------------------------------------------------------------------- # # # KONSOLE STYLE MACROS # # ---------------------------------------------------------------------------- # Mrxvt.macro.Ctrl+Shift+Left: MoveTab -1 Mrxvt.macro.Ctrl+Shift+Right: MoveTab +1 # # Vim uses Shift+Left / Shift+right, so enable these only in the primary screen # Mrxvt.macro.Primary+Shift+Left: GotoTab -1 Mrxvt.macro.Primary+Shift+Right: GotoTab +1 # We already have a shortcut to open a new tab. Rather make this a shortcut that # duplicates the current profile. Mrxvt.macro.Ctrl+Shift+n: NewTab - # # By default we should only have Ctrl+Shift modifier keys defined. Other # modifier combinations are sometimes used by the window manager, or # applications (e.g. emacs). # # Mrxvt.macro.Ctrl+Alt+n: NewTab # Mrxvt.macro.Ctrl+Alt+s: SetTitle # ---------------------------------------------------------------------------- # # # VIM STYLE MACROS # # ---------------------------------------------------------------------------- # Mrxvt.macro.Ctrl+Shift+h: GotoTab -1 Mrxvt.macro.Ctrl+Shift+l: GotoTab +1 # ---------------------------------------------------------------------------- # # # SCREEN STYLE MACROS # # ---------------------------------------------------------------------------- # Mrxvt.macro.Ctrl+Shift+p: GotoTab 0 # ---------------------------------------------------------------------------- # # # MRXVT STYLE MACROS # # ---------------------------------------------------------------------------- # # Move tab to position Alt+Shift+ # # 2006-02-26 gi1242: While Alt+Shift+ would be more intuitive to move # tabs, some terminal applications (e.g. mutt) use it. Terminal apps however # don't use (or recognize Ctrl+Shift+, so we can safely use them here. # Mrxvt.macro.Ctrl+Shift+exclam: MoveTab 1 Mrxvt.macro.Ctrl+Shift+at: MoveTab 2 Mrxvt.macro.Ctrl+Shift+numbersign: MoveTab 3 Mrxvt.macro.Ctrl+Shift+dollar: MoveTab 4 Mrxvt.macro.Ctrl+Shift+percent: MoveTab 5 Mrxvt.macro.Ctrl+Shift+asciicircum: MoveTab 6 Mrxvt.macro.Ctrl+Shift+ampersand: MoveTab 7 Mrxvt.macro.Ctrl+Shift+asterisk: MoveTab 8 Mrxvt.macro.Ctrl+Shift+parenleft: MoveTab 9 Mrxvt.macro.Ctrl+Shift+parenright: MoveTab 10 # Previous active tab Mrxvt.macro.Ctrl+Tab: GotoTab 0 # Alternately we can use Ctrl+Tab to switch to the left / right tab # Mrxvt.macro.Ctrl+Shift+ISO_Left_Tab: GotoTab -1 # Mrxvt.macro.Ctrl+Tab: GotoTab +1 Mrxvt.macro.Ctrl+Shift+less: MoveTab -1 Mrxvt.macro.Ctrl+Shift+greater: MoveTab +1 # Disable by default. When any arg is passed to PrintScreen, the entire # scrollback buffer is also printed. # Mrxvt.macro.Ctrl+Shift+z: PrintScreen Full # Mrxvt.macro.Print: PrintScreen # Mrxvt.macro.Shift+Print: PrintScreen Full # More / less opaque Mrxvt.macro.Ctrl+Shift+u: Esc \e]70;+5\a Mrxvt.macro.Ctrl+Shift+o: Esc \e]70;-5\a # More / less transparent Mrxvt.macro.Ctrl+Shift+j: Esc \e]67;+5\a Mrxvt.macro.Ctrl+Shift+k: Esc \e]67;-5\a # Toggle transparency Mrxvt.macro.Ctrl+Shift+r: ToggleTransparency # Hide / show subwindows Mrxvt.macro.Ctrl+Shift+m: ToggleSubwin m Mrxvt.macro.Ctrl+Shift+i: ToggleSubwin t Mrxvt.macro.Ctrl+Shift+s: ToggleSubwin s Mrxvt.macro.Ctrl+Shift+a: ToggleSubwin b Mrxvt.macro.Ctrl+Shift+b: ToggleVeryBold # Mrxvt.macro.Ctrl+Shift+d: ToggleBroadcast Mrxvt.macro.Ctrl+Shift+f: ToggleFullscreen Mrxvt.macro.Ctrl+Shift+e: ToggleHold Mrxvt.macro.Ctrl+Shift+x: SaveConfig # Toggle macros Mrxvt.macro.Ctrl+Shift+F12: ToggleMacros # Scrolling Mrxvt.macro.Primary+Shift+Up: Scroll -1 Mrxvt.macro.Primary+Shift+Down: Scroll +1 Mrxvt.macro.Primary+Shift+Home: Scroll -1000000 Mrxvt.macro.Primary+Shift+End: Scroll +1000000 # Pasting Mrxvt.macro.Ctrl+Shift+v: Paste # Paste contents of a file to active tab (e.g. a collection of shell settings # like aliases, environment variables, ...). The file name can also be got from # the selection if you use %s. #Mrxvt.macro.Ctrl+Shift+w: PasteFile ~/my-favourite-bash-settings #Mrxvt.macro.Ctrl+Shift+w: PasteFile %s # A selection buffer can be added as an argument (PRIMARY,SECONDARY, CLIPBOARD) Mrxvt.macro.Ctrl+Shift+c: Paste CLIPBOARD Mrxvt.macro.Shift+Delete: SetTitle # Monitor tabs for activity or inactivity # (valid arguments for MonitorTab macro : "INACTIVITY", "ACTIVITY" and "AUTO") Mrxvt.macro.Ctrl+Shift+g: MonitorTab AUTO #Mrxvt.monitorTimeout: 2000 #Mrxvt.monitorCommand: play ~/.ding_sound.wav #Mrxvt.monitorCommand: aosd_cat --fontdesc="Trebuchet 20" --ypos=50 --delay=4000 Alert on tab %n :: %t #Mrxvt.monitorCommand: xmessage Alert on tab %n # # Mrxvt Console: Enable the useFifo option, and then open a console in a new # tab. Anything typed there is executed as a macro. When done (on clean exit), # disable the useFifo option. # Mrxvt.macro.Ctrl+Shift+z: UseFifo 1 Mrxvt.macro.Add+Ctrl+Shift+z: NewTab "mrxvt Console" \!cat >> /tmp/.mrxvt-%P && echo "UseFifo 0" >> /tmp/.mrxvt-%P Mrxvt.macro.Add+Ctrl+Shift+z: ToggleHold -7 # External programs. In keeping with the Unix "minimalist" philosophy, we don't # define these shortcuts by default. # # Remember commands start in the current directory of the active tab by # default. Also prefixing commands with '!' will start them in a shell (so when # you're done, the tab won't close, and you'll have a shell prompt). # # As of mrxvt-0.5.0, new tabs will be opened in the current directory. So the # shortcut for Vim below is extremely useful :). Mrxvt.macro.Ctrl+Shift+F1: NewTab "man mrxvt" man mrxvt # Mrxvt.macro.Ctrl+Shift+F2: NewTab !vim # Mrxvt.macro.Ctrl+Shift+F3: NewTab !mutt # These are the keyboard combinations compatible with mrxvt 0.4x, and # they may be useful for some applications like mc. Thanks to Dimitri # AT sun.com for the information: # Mrxvt.macro.Ctrl+Home: Str \e\133\067\136 # Mrxvt.macro.Ctrl+End: Str \e\133\070\136 # Mrxvt.macro.Shift+Home: Str \e\133\067\044 # Mrxvt.macro.Shift+End: Str \e\133\070\044 # Mrxvt.macro.Shift+F1: Str \e\133\062\063\176 # Mrxvt.macro.Shift+F2: Str \e\133\062\064\176 # Mrxvt.macro.Shift+F3: Str \e\133\062\065\176 # Mrxvt.macro.Shift+F4: Str \e\133\062\066\176 # Mrxvt.macro.Shift+F5: Str \e\133\062\070\176 # Mrxvt.macro.Shift+F6: Str \e\133\062\071\176 # Mrxvt.macro.Shift+F7: Str \e\133\063\061\176 # Mrxvt.macro.Shift+F8: Str \e\133\063\062\176 # Mrxvt.macro.Shift+F9: Str \e\133\063\063\176 # Mrxvt.macro.Shift+F10: Str \e\133\063\064\176 # Mrxvt.macro.Alt+Return: Str \e\012 # vim: set ts=8 sts=4: mrxvt-0.5.4/share/pixmaps/0000777000175000001440000000000011045531320012456 500000000000000mrxvt-0.5.4/share/pixmaps/mrxvt.png0000644000175000001440000000444310756127602014301 00000000000000PNG  IHDR22? pHYs  tIME  #IDAThZ=W=zN][ׄƆ&@(]@E K-JA "Bd((B պ&Vˑٙwld #Gow=sgz"'X;:ݹ}'k4¤o޷͛7q…r>ݕ+Wvھmepylll`ܚ.~ivX;_o9}:KwHB`p:,y^d4z~?[fq  X>yd @NݻwAuw^tvE,"^ (bA9:詗 _R٘lFLI~;@o3"]>7~;T1i䓼$/lO>t: F 34q9 ah-Q{##ayl`a 1KnX O)E- WN@ a~,vC }!\uQV7~ {{˕b-AuRKuUvys䐷Ƨ5voH۲㎫o.?C|/[w(ϞCfȳ+-0:߫0[P|ZԼ0xz)7 (5 ظs^јwt?Qo~/lMr d .EoY$!j"W ׿ů~uvǢjeB{h>3SXMƊ@衴 XXH `|nςq꽄;Y!,tlH܄2~N5]7S7䒜 3ҨjGL0/EYk_CwSV]8sq᣿K~P$M]B%X;"L"曱B+{$Q`ᝰM *lLr((a`A,e5tv DL(=Fl4bIR05~r3 ΀NNbNgZUlZh9zhoC0"T\'kfHYd%^jp`0h#8R̚R7i8m*±VKdoNsjjNOk@&rH Tty?T3yF82 3Tj UPλ*4k/JQTN֖|_Ӭ*XWZ@ҡHVTNc񷪅YG Fє`(q㠬'DNR0iU QȒ'c!}5XEz8aFu(¿G c #F0EFF0", ", c #EFF0EF", "' c #EFF4EF", ") c #EFEEEF", "! c #F0F3F0", "~ c #F0F6F0", "{ c #EEF0EE", "] c #EAECEA", "^ c #EFF3EF", "/ c #EDEEED", "( c #EDEDED", "_ c #EEF1EE", ": c #EEEDEE", "< c #EDEFED", "[ c #EEF2EE", "} c #EFF2EF", "| c #E8EBE8", "1 c #DEDBDE", "2 c #F4F3F4", "3 c #F3F3F3", "4 c #F3F5F3", "5 c #F3F4F3", "6 c #F2F3F2", "7 c #F2F4F2", "8 c #F5F4F5", "9 c #F5F7F5", "0 c #F4F5F4", "a c #F5F5F5", "b c #F3F8F3", "c c #F2F2F2", "d c #F4F9F4", "e c #E8EEE8", "f c #E8ECE8", "g c #E3EAE3", "h c #EDF0ED", "i c #F1F1F1", "j c #DBD4DB", "k c #DBD5DB", "l c #DAD5DA", "m c #D5D5D5", "n c #DCD4DC", "o c #CDD4CD", "p c #D3D5D3", "q c #D4D4D4", "r c #CDD5CD", "s c #CBD5CB", "t c #D8D5D8", "u c #DCD5DC", "v c #DBDDDB", "w c #DBDCDB", "x c #DCDDDC", "y c #E8EDE8", "z c #E7EBE7", "A c #FAFBFA", "B c #434743", "C c #010001", "D c #010101", "E c #000100", "F c #1E271E", "G c #F9F9F9", "H c #FBFAFB", "I c #3C443C", "J c #161514", "K c #181515", "L c #181616", "M c #1A1718", "N c #1B1919", "O c #1C1A1A", "P c #1D1B1B", "Q c #1E1C1C", "R c #1F1C1D", "S c #211E1D", "T c #211F1F", "U c #222020", "V c #242121", "W c #252222", "X c #262323", "Y c #272424", "Z c #282525", "` c #292726", " . c #2B2727", ".. c #2C2828", "+. c #2D2929", "@. c #2E2B2B", "#. c #2F2B2C", "$. c #302C2C", "%. c #312E2D", "&. c #322F2F", "*. c #332F30", "=. c #353031", "-. c #353232", ";. c #373332", ">. c #383334", ",. c #393434", "'. c #3A3636", "). c #3C3737", "!. c #3C3838", "~. c #3E3939", "{. c #3F393A", "]. c #403B3B", "^. c #E6EAE6", "/. c #3C433C", "(. c #161414", "_. c #171515", ":. c #191716", "<. c #191818", "[. c #FFE125", "}. c #1D1B1A", "|. c #1F1C1C", "1. c #201D1D", "2. c #201E1E", "3. c #242221", "4. c #262324", "5. c #282424", "6. c #2A2727", "7. c #2B2828", "8. c #2C2928", "9. c #2D2A29", "0. c #2F2A2A", "a. c #2F2C2B", "b. c #322E2E", "c. c #332F2E", "d. c #343030", "e. c #353131", "f. c #363232", "g. c #373333", "h. c #3A3535", "i. c #3B3636", "j. c #3C3738", "k. c #3D3939", "l. c #3F3B3B", "m. c #EFF6EF", "n. c #E1E8E1", "o. c #141313", "p. c #171516", "q. c #655A1B", "r. c #E4CA23", "s. c #1E1B1B", "t. c #201D1E", "u. c #211E1E", "v. c #232120", "w. c #262223", "x. c #292625", "y. c #2C2929", "z. c #2D2A2A", "A. c #2F2B2B", "B. c #2F2C2C", "C. c #312D2D", "D. c #363131", "E. c #373232", "F. c #383434", "G. c #393535", "H. c #3D3938", "I. c #3E393A", "J. c #403A3B", "K. c #EDF5ED", "L. c #DEE6DE", "M. c #F8F8F8", "N. c #131312", "O. c #151314", "P. c #EED223", "Q. c #4A4319", "R. c #1B1819", "S. c #1E1B1C", "T. c #1F1D1C", "U. c #211E1F", "V. c #22201F", "W. c #242021", "X. c #252221", "Y. c #272324", "Z. c #2D292A", "`. c #2E2A2A", " + c #302C2D", ".+ c #332E2E", "++ c #343130", "@+ c #353231", "#+ c #383433", "$+ c #3B3737", "%+ c #3D3838", "&+ c #3E3938", "*+ c #3F3A3A", "=+ c #ECF5EC", "-+ c #121212", ";+ c #141212", ">+ c #EACF23", ",+ c #4F4619", "'+ c #1A1817", ")+ c #1A1819", "!+ c #1D1A1B", "~+ c #232020", "{+ c #252323", "]+ c #292626", "^+ c #2A2827", "/+ c #302B2C", "(+ c #332F2F", "_+ c #343131", ":+ c #ECF4EC", "<+ c #DEE5DE", "[+ c #121011", "}+ c #131112", "|+ c #141312", "1+ c #605519", "2+ c #E0C622", "3+ c #C7AF21", "4+ c #4E461B", "5+ c #1D1B1C", "6+ c #221F20", "7+ c #232121", "8+ c #252223", "9+ c #272323", "0+ c #292526", "a+ c #2A2726", "b+ c #2E2A2B", "c+ c #302D2D", "d+ c #111010", "e+ c #131111", "f+ c #151313", "g+ c #6B5F1B", "h+ c #EACE23", "i+ c #1A1818", "j+ c #1B191A", "k+ c #1D1A1A", "l+ c #1F1E1E", "m+ c #343031", "n+ c #363333", "o+ c #383333", "p+ c #393534", "q+ c #100F0F", "r+ c #131211", "s+ c #4B4219", "t+ c #191717", "u+ c #1B1818", "v+ c #1B1A1A", "w+ c #363132", "x+ c #3C3736", "y+ c #EDF3ED", "z+ c #F9F8F9", "A+ c #11100F", "B+ c #F9DC24", "C+ c #F2D524", "D+ c #E4C923", "E+ c #65591B", "F+ c #181617", "G+ c #1F1D1D", "H+ c #221F1F", "I+ c #262423", "J+ c #282524", "K+ c #2A2626", "L+ c #2E2B2A", "M+ c #353130", "N+ c #ECF1EC", "O+ c #DEE4DE", "P+ c #0F0E0E", "Q+ c #121110", "R+ c #151412", "S+ c #151414", "T+ c #1E1C1D", "U+ c #232021", "V+ c #252322", "W+ c #272423", "X+ c #2F2B2A", "Y+ c #312E2E", "Z+ c #0E0D0C", "`+ c #0F0E0D", " @ c #110F0F", ".@ c #121010", "+@ c #161515", "@@ c #191617", "#@ c #1C1B1B", "$@ c #221E1F", "%@ c #231F1F", "&@ c #332E2F", "*@ c #373233", "=@ c #DFE2DF", "-@ c #0D0C0C", ";@ c #0E0D0E", ">@ c #0F0E0F", ",@ c #161415", "'@ c #191616", ")@ c #1C1919", "!@ c #272425", "~@ c #2B2827", "{@ c #302D2C", "]@ c #322E2F", "^@ c #33302F", "/@ c #DFE1DF", "(@ c #0C0B0B", "_@ c #0E0C0D", ":@ c #100E0F", "<@ c #100F10", "[@ c #121111", "}@ c #141211", "|@ c #171616", "1@ c #181717", "2@ c #211F20", "3@ c #2B2728", "4@ c #312C2D", "5@ c #ECEDEC", "6@ c #DEDFDE", "7@ c #0B0B0A", "8@ c #0D0B0C", "9@ c #0E0D0D", "0@ c #12100F", "a@ c #131011", "b@ c #282425", "c@ c #DFDEDF", "d@ c #ECEFEC", "e@ c #0B090A", "f@ c #100E0E", "g@ c #191718", "h@ c #1C1B1A", "i@ c #201E1D", "j@ c #211F1E", "k@ c #292425", "l@ c #2C292A", "m@ c #322D2D", "n@ c #353132", "o@ c #EBEBEB", "p@ c #DEDEDE", "q@ c #E8EFE8", "r@ c #3D443D", "s@ c #0A0909", "t@ c #0B0A0A", "u@ c #0E0C0C", "v@ c #100F0E", "w@ c #101010", "x@ c #111110", "y@ c #141213", "z@ c #181716", "A@ c #1C1A19", "B@ c #1E1A1A", "C@ c #1E1C1B", "D@ c #272525", "E@ c #292525", "F@ c #090808", "G@ c #0A090A", "H@ c #0B0B0B", "I@ c #0F0D0D", "J@ c #141112", "K@ c #242222", "L@ c #282625", "M@ c #2A2627", "N@ c #302B2B", "O@ c #312D2E", "P@ c #DDDDDD", "Q@ c #090807", "R@ c #090809", "S@ c #0A0A0A", "T@ c #0C0C0C", "U@ c #0D0C0D", "V@ c #0F0D0E", "W@ c #151413", "X@ c #1B1A19", "Y@ c #342F2F", "Z@ c #EBEAEB", "`@ c #DDDADD", " # c #070707", ".# c #111011", "+# c #131212", "@# c #1B1918", "## c #1C191A", "$# c #231F20", "%# c #262322", "&# c #312D2C", "*# c #070606", "=# c #080707", "-# c #0B0A0B", ";# c #0D0B0B", "># c #10100F", ",# c #1A1717", "'# c #322E2D", ")# c #EBE7EB", "!# c #DDD8DD", "~# c #060605", "{# c #080808", "]# c #0E0E0E", "^# c #110F10", "/# c #161314", "(# c #DAD7DA", "_# c #050404", ":# c #060606", "<# c #070607", "[# c #080807", "}# c #0C0B0C", "|# c #242120", "1# c #EAE7EA", "2# c #D7D6D7", "3# c #E8EAE8", "4# c #040403", "5# c #050505", "6# c #090909", "7# c #D7D7D7", "8# c #E8E9E8", "9# c #030303", "0# c #070807", "a# c #0C0A0B", "b# c #0C0C0B", "c# c #242122", "d# c #272524", "e# c #282526", "f# c #E6E7E6", "g# c #D4D6D4", "h# c #020202", "i# c #030403", "j# c #050405", "k# c #0A0A09", "l# c #E0E6E0", "m# c #D2D7D2", "n# c #020303", "o# c #040303", "p# c #0B0A09", "q# c #121112", "r# c #DDE4DD", "s# c #CED6CE", "t# c #E8E6E8", "u# c #040404", "v# c #211D1E", "w# c #282626", "x# c #E6E5E6", "y# c #394039", "z# c #050605", "A# c #131010", "B# c #151213", "C# c #181615", "D# c #DBE3DB", "E# c #837E83", "F# c #4D524D", "G# c #505350", "H# c #505250", "I# c #4F504F", "J# c #4F534F", "K# c #696D69", "L# c #D6DCD6", " ", " ", " ", " . . . . . . . . . + + + + + + + + + + + + + + + + + ", " . @ @ @ @ @ @ @ @ # + + $ $ $ $ $ $ + . $ $ $ $ $ $ + ", " . @ @ @ @ @ @ @ @ @ # . % $ $ $ $ $ $ $ . % $ $ $ $ $ $ $ + ", " . @ @ @ @ @ @ @ @ @ # . % $ $ $ $ $ $ $ . % $ $ $ $ $ $ $ + ", " . @ @ @ @ @ @ @ @ @ @ @ # . % $ $ $ $ $ $ $ . % $ $ $ $ $ $ $ + % ", " . # # # # # # # # # # # # # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " . # & * = = = - - ; ; ; - = > , > ' * - , ; ; , - , = ) ! ) - - ; ; - - - = = ~ ) - { ] = ) . ", " . ^ # - ; / ; / - ( ( / / ; / ; ) _ { : < ( ( - ( < ; ) [ ; - < ( ( / / / ; / } - ; - | = 1 * . ", " . 2 / # 3 4 5 4 ! 6 6 6 5 7 5 8 4 9 0 2 a 2 3 4 6 5 5 3 b 3 7 3 c c 6 6 3 3 3 d 3 3 5 e 1 f g . ", " . h ; i # j j k l k k k m k n o j p q r o s t j u v w v v w x w v v v v w w v v w v k 1 y z g . ", " . h ; A B + + + + C C C C C D E D D D D D D D D D D D D D D D D D D D D D D D D D D + F G z g . ", " . h ; H I J K L M N O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].].d ^.g . ", " . h ; H /.(._.L :.<.[.}.P |.1.2.T U 3.W 4.5.Z 6.7.8.9.0.a.$.b.c.d.e.f.g.,.h.i.j.k.~.l.].m.n.g . ", " . h ; G /.o.(.p.q.r.[.[.[.s.|.t.u.U v.V w.Y Z x.6.7.y.z.A.B.C.b.*.d.D.E.>.F.G.i.).H.I.J.K.L.g . ", " . h ; M./.N.O.(.P.Q.[.R.O P S.T.1.U.V.W.X.X Y.Z x.6...Z.`.a. +%..+*.++@+E.#+,.'.$+%+&+*+=+L.g . ", " . h ; M./.-+;+O.>+,+[.'+)+O !+Q 1.2.T ~+V {+X Y Z ]+^+8.+.`./+$.%.(+*._+f.;.F.G.i.).%+~.:+<+g . ", " . h ; M./.[+}+|+1+2+[.3+4+N O 5+R t.2.6+7+V 8+9+Z 0+a+7.y.Z.b+B.c+b.(+d.e.f.g.,.h.i.).%+=+<+g . ", " . h ; M./.d+e+;+f+(.[.g+h+i+j+k+Q T.l+u.~+~+W X Y Z x.6.7.y.z.@.$.C.b.(+m+e.n+o+p+h.i.!.=+<+g . ", " . h ; M./.q+[+r+|+O.[.s+P.t+u+v+P [.[.[.[.[.[.W X Y Z ]+6.7.Z.`.A.c+C.b.(+++w+g.>.p+i.x+y+<+g . ", " . h ; z+/.q+A+[+B+C+[.D+E+F+i+N O s.S.G+2.H+~+3.W I+J+Z K+6.y.z.L+#. +%.(+d.M+f.g.F.h.'.N+O+g . ", " . h ; , I P+q+d+Q+R+[.S+_.L t+i+N O P T+1.u.V.U+W V+W+Z ]+6. .y.z.X+$.c+Y+(+d.D.f.g.F.G.N+O+g . ", " . h ; & I Z+`+ @.@e+e+o.+@_.@@t+i+v+#@s.G+1.$@%@U+W {+Y Z ]+6.7.+.z.A.$.C.&@(+d.-.*@>.G.h =@g . ", " . h ; & I -@;@>@ @[+}+;+O.,@K '@<.u+)@}.s.|.2.T U V W X !@Z ]+~@7.+.@.a.{@C.]@^@m+e.;.F.( /@g . ", " . h ; & I (@_@`+:@<@[@}@f+S++@|@1@i+N k+P |.1.u.2@~+V W X 5.x.]+3@y.9.L+$.4@b.(+d.e.f.g.5@6@g . ", " . h ; & I 7@8@9@`+q+0@a@r+f+(._.L t+i+N O s.R t.U.V.U+X.{+Y.b@]+6.7.y.z.@.B.C.b.(+d.@+g.5@c@g . ", " . h ; d@I e@(@-@9@f@q+d+e+;+f+(._.'@g@u+j+h@Q G+i@j@U 7+W V+W+k@]+6.7.l@z.A. +m@b.(+_+n@o@p@g . ", " . h ; q@r@s@t@(@u@9@v@w@x@e+y@f+,@_.z@t+R.A@B@C@G+2.H+~+V W 9+D@E@]+~@..y.b+a.c+%.(+d.e.o@p@g . ", " . h ; q@r@F@G@H@-@-@I@v@d+Q+J@o.O._.L t+i+N k+P |.t.u.V.~+K@{+X Z L@M@3@y.z.b+N@C.O@&@d.o@P@g . ", " . h ; e r@Q@R@S@(@T@U@V@ @d+e+;+W@(.|@L t+u+X@}.P T.1.j@V.v.W w.W+Z ]+6.7.y.z.@.{@C.b.Y@Z@`@g . ", " . h ; y r@ #F@s@S@(@-@9@f@q+.#+#;+W@(._.F+M @###k+C@R t.T $#V W %#Y Z ]+ ...y.`.a.&#m@(+o@`@g . ", " . h ; | r@*#=#F@s@-#;#9@`+>@>#.#+#f+f++@K z@,#N ##P Q G+U.H+U V W X 5.Z M@~@..+.b+A.&#'#)#!#g . ", " . h ; y r@~#*#{#F@s@7@8@u@]#q+^#Q+;+f+/#+@L t+i+N k+S.|.2.j@6+~+V %#I+J+Z a+~@y.+.A.a.{@)#(#g . ", " . h ; | r@_#:#<#[#s@G@H@}#9@P+ @d+e+;+o.(.p.'@,#i+##!+s.T.1.j@H+|#X.X Y 5.]+6.7.+.`.A.$.1#2#g . ", " . h ; 3#r@4#5#:#=#{#6#7@(@-@9@P+ @.@}+o.f++@K z@t+@#A@P Q 1.i@U.H+|#W X Y Z M@6...+.`.A.1#7#g . ", " . h ; 8#r@9#_#5#<#0#F@S@a#b#_@`+v@d+[+r+o.W@J p.1@i+R.O P Q G+2.H+U c#W I+d#e#K+7.y.Z.0.f#g#g . ", " . h ; 8#r@h#i#j#:#<#{#6#k#-#T@9@P+:@0@Q+J@f+S++@|@t+i+N k+C@|.G+T H+~+V {+W+J+Z 6.7.y.`.l#m#g . ", " . h ; 8#r@h#n#o#5#:#<#Q@s@p#a#-@9@P+ @d+q#y@f+(._.z@,#)+X@}.S.G+u.U.H+U+c#w.Y Z ]+M@7.+.r#s#g . ", " . h ; t#r@D h#9#u#5#:# #{#s@-#(@-@9@f@ @[+e+y@W@,@_.F+<.N X@}.Q G+v#$@U V W X !@w#K+6...O+s#g . ", " . h ; x#y#+ D h#9#_#z#*#=#R@k#a#b#-@`+q+A+A#+#B#W@+@C#t+i+N O P Q G+u.V.~+V V+4.d#x.]+7.D#s#g . ", " . h ; c@E#F#% % % % % % % % % % % G#H#% I#I#G#% % % % % % % % % % % % % % % % % % % J#K#L#s#g . ", " . h ; # # j j k l k k k m k n o j p q r o s t j u v w v v w x w v v v v w w v v w v k 1 # z g . ", " . 2 # ; 3 4 5 4 ! 6 6 6 5 7 5 8 4 9 0 2 a 2 3 4 6 5 5 3 b 3 7 3 c c 6 6 3 3 3 d 3 3 5 e ; # g . ", " . ^ # - ; / ; / - ( ( / / ; / ; ) _ { : < ( ( - ( < ; ) [ ; - < ( ( / / / ; / } - ; - | = # * . ", " . # & * = = = - - ; ; ; - = > , > ' * - , ; ; , - , = ) ! ) - - ; ; - - - = = ~ ) - { ] = ) # . ", " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " ", " "}; mrxvt-0.5.4/share/pixmaps/mrxvt-csh.png0000644000175000001440000000434410756127602015054 00000000000000PNG  IHDR22?bKGD pHYs  tIME  1k*EqIDAThZ=U=g]ZB]]+DrERE 8WX (p@%"e%G"%vAH{~-Wq̝>}\׋8ζ/xe<CNqGNsz7?ј*'p&wuCc'XrXGOell߽;ۺ/ꉂ.\(`Ay32G(B@&':\%4?_#Ozc f3^՘ ͭMDa,nmɹh>1O1mp< Pg}b`,TLCŏ"ccm$QXXL)6=:" ʿ$\zk^o֣!@0 P @ "@Ϟ 3:bqc5{l@)pCzuFb(~v)X (^o?0vd;uB=3 նegFI|OϿ{T`_* X)sUHs* y[N޽7IbyR{Z#F"<,h)1cŀcus_zpTBϪ8I$ ɔ8#;M[,:"[qk".zf,)mBτSԷ% ec8! e@̜bRɽP%Y$C!Ъ9옌~G:#ؘLvAꠈ T9*t8+ىJ!^G2ӬAҬJṄ\H}LXEDpD6`o2eeAVArn % aJ?䚫;SCA'yxJ9)$AspoސrX?\Ȯ7N S&:<,œ kQguGy*r+#ݪMX<dm':Cm FK\(IsMKxhu֚J]"v|uőISFJkthN.ľa[]OhcJY'=!ZX ֳ՜P͐98˚8lRpC>GPW$nR:TKvd0:b2fH*ô&1 y`!u)g%eA{4d2߾X)+'8an@ȫE=ľ|2̆:Oh_+ p¹QTCNƽե_\¥[EykXμzfѐ)ut:71ذCZQU*=d]oBXh9<_>!wG/C癡z{ZPWҌ(,(Z7KsMP_͍M~Yy yWV;yIENDB`mrxvt-0.5.4/share/pixmaps/mrxvt-csh.xpm0000644000175000001440000002737110756127602015101 00000000000000/* XPM */ static char * mrxvt_csh_xpm[] = { "50 50 423 2", " c None", ". c #1B1C1B", "+ c #FFFFFF", "@ c #DBDBDB", "# c #A5A5A5", "$ c #505450", "% c #F0F0F0", "& c #EFF1EF", "* c #EFEFEF", "= c #EEEFEE", "- c #EEEEEE", "; c #F0EFF0", "> c #EFF0EF", ", c #EFF4EF", "' c #EFEEEF", ") c #F0F3F0", "! c #F0F6F0", "~ c #EEF0EE", "{ c #EAECEA", "] c #EFF3EF", "^ c #EDEEED", "/ c #EDEDED", "( c #EEF1EE", "_ c #EEEDEE", ": c #EDEFED", "< c #EEF2EE", "[ c #EFF2EF", "} c #E8EBE8", "| c #DEDBDE", "1 c #F4F3F4", "2 c #F3F3F3", "3 c #F3F5F3", "4 c #F3F4F3", "5 c #F2F3F2", "6 c #F2F4F2", "7 c #F5F4F5", "8 c #F5F7F5", "9 c #F4F5F4", "0 c #F5F5F5", "a c #F3F8F3", "b c #F2F2F2", "c c #F4F9F4", "d c #E8EEE8", "e c #E8ECE8", "f c #E3EAE3", "g c #EDF0ED", "h c #F1F1F1", "i c #DBD4DB", "j c #DBD5DB", "k c #DAD5DA", "l c #D5D5D5", "m c #DCD4DC", "n c #CDD4CD", "o c #D3D5D3", "p c #D4D4D4", "q c #CDD5CD", "r c #CBD5CB", "s c #D8D5D8", "t c #DCD5DC", "u c #DBDDDB", "v c #DBDCDB", "w c #DCDDDC", "x c #E8EDE8", "y c #E7EBE7", "z c #FAFBFA", "A c #434743", "B c #000000", "C c #010001", "D c #010101", "E c #000100", "F c #1E271E", "G c #F9F9F9", "H c #FBFAFB", "I c #3C443C", "J c #161413", "K c #171515", "L c #181616", "M c #191617", "N c #1A1818", "O c #1B1919", "P c #1C1A1A", "Q c #1D1C1B", "R c #1F1C1C", "S c #201D1D", "T c #211E1E", "U c #211F1F", "V c #232020", "W c #242121", "X c #252222", "Y c #272323", "Z c #282425", "` c #292625", " . c #292626", ".. c #2B2827", "+. c #2C2928", "@. c #2D2929", "#. c #2E2A2B", "$. c #2F2C2B", "%. c #302D2D", "&. c #312E2E", "*. c #332F2F", "=. c #34302F", "-. c #353130", ";. c #363232", ">. c #373332", ",. c #383433", "'. c #3A3534", "). c #3B3636", "!. c #3C3737", "~. c #3C3838", "{. c #3E3939", "]. c #3F3A3A", "^. c #403B3B", "/. c #E6EAE6", "(. c #3C433C", "_. c #151313", ":. c #161414", "<. c #171615", "[. c #FFE125", "}. c #191717", "|. c #1B1818", "1. c #1C1919", "2. c #1D1A1A", "3. c #1F1C1D", "4. c #201E1D", "5. c #211F1E", "6. c #22201F", "7. c #242020", "8. c #242122", "9. c #262223", "0. c #262424", "a. c #282524", "b. c #2A2627", "c. c #2B2728", "d. c #2C2828", "e. c #2E2A2A", "f. c #2F2B2B", "g. c #2F2C2C", "h. c #312C2D", "i. c #322E2E", "j. c #332E2F", "k. c #343030", "l. c #353131", "m. c #373333", "n. c #383434", "o. c #393535", "p. c #3D3838", "q. c #3E3A39", "r. c #EFF6EF", "s. c #E1E8E1", "t. c #141313", "u. c #151314", "v. c #161514", "w. c #181515", "x. c #1C191A", "y. c #1D1B1B", "z. c #1E1B1B", "A. c #201E1E", "B. c #221E1F", "C. c #242021", "D. c #272423", "E. c #282525", "F. c #2A2727", "G. c #2B2828", "H. c #2D2A2A", "I. c #302C2C", "J. c #312D2D", "K. c #322F2E", "L. c #343130", "M. c #393534", "N. c #3A3635", "O. c #3B3737", "P. c #3E3838", "Q. c #EDF5ED", "R. c #DEE6DE", "S. c #F8F8F8", "T. c #131212", "U. c #141212", "V. c #151413", "W. c #161515", "X. c #171516", "Y. c #191716", "Z. c #1F1C1B", "`. c #1F1D1D", " + c #262323", ".+ c #272424", "++ c #292526", "@+ c #2A2626", "#+ c #2A2828", "$+ c #2D292A", "%+ c #322E2D", "&+ c #353031", "*+ c #353132", "=+ c #383333", "-+ c #3C3738", ";+ c #3E3938", ">+ c #ECF5EC", ",+ c #121011", "'+ c #211E1F", ")+ c #221F1F", "!+ c #262222", "~+ c #262324", "{+ c #282526", "]+ c #2D2829", "^+ c #2D2A29", "/+ c #2E2B2B", "(+ c #302D2C", "_+ c #333030", ":+ c #3A3535", "<+ c #3A3636", "[+ c #3C3837", "}+ c #ECF4EC", "|+ c #DEE5DE", "1+ c #121010", "2+ c #131111", "3+ c #1E1C1B", "4+ c #1E1C1C", "5+ c #252122", "6+ c #252322", "7+ c #2A2726", "8+ c #363131", "9+ c #373232", "0+ c #3B3637", "a+ c #110F0F", "b+ c #121110", "c+ c #131211", "d+ c #1A1717", "e+ c #1C1A19", "f+ c #1D1A1B", "g+ c #1F1D1C", "h+ c #201D1E", "i+ c #231F20", "j+ c #242222", "k+ c #2B2727", "l+ c #2C2929", "m+ c #2F2B2C", "n+ c #312D2E", "o+ c #363231", "p+ c #393434", "q+ c #3A3536", "r+ c #3B3736", "s+ c #100F0F", "t+ c #11100F", "u+ c #161314", "v+ c #332F2E", "w+ c #373233", "x+ c #3A3435", "y+ c #3B3536", "z+ c #EDF3ED", "A+ c #F9F8F9", "B+ c #100D0E", "C+ c #121111", "D+ c #181617", "E+ c #191817", "F+ c #1B1819", "G+ c #1F1D1E", "H+ c #232121", "I+ c #252221", "J+ c #252323", "K+ c #272324", "L+ c #393536", "M+ c #ECF1EC", "N+ c #DEE4DE", "O+ c #0E0D0D", "P+ c #100F0E", "Q+ c #111011", "R+ c #141312", "S+ c #161415", "T+ c #171616", "U+ c #181717", "V+ c #1B1918", "W+ c #1B191A", "X+ c #1D1B1A", "Y+ c #211D1E", "Z+ c #221F1E", "`+ c #2F2C2D", " @ c #33302F", ".@ c #0D0C0C", "+@ c #0E0E0E", "@@ c #100E0F", "#@ c #111010", "$@ c #131112", "%@ c #171415", "&@ c #1A1817", "*@ c #222020", "=@ c #292726", "-@ c #2A2728", ";@ c #2E2B2A", ">@ c #383334", ",@ c #DFE2DF", "'@ c #0C0B0C", ")@ c #0F0E0E", "!@ c #191718", "~@ c #242221", "{@ c #282424", "]@ c #292727", "^@ c #322E2F", "/@ c #DFE1DF", "(@ c #0C0B0B", "_@ c #1A1819", ":@ c #221F20", "<@ c #232120", "[@ c #2C2829", "}@ c #363132", "|@ c #ECEDEC", "1@ c #DEDFDE", "2@ c #0B0B0A", "3@ c #0E0D0E", "4@ c #171514", "5@ c #181716", "6@ c #312E2D", "7@ c #353030", "8@ c #DFDEDF", "9@ c #ECEFEC", "0@ c #0A0A0A", "a@ c #0C0A0A", "b@ c #0E0C0C", "c@ c #0F0E0D", "d@ c #141213", "e@ c #EBEBEB", "f@ c #DEDEDE", "g@ c #E8EFE8", "h@ c #3D443D", "i@ c #0A0809", "j@ c #0B0A0A", "k@ c #100E0E", "l@ c #151414", "m@ c #1E1B1C", "n@ c #1E1D1D", "o@ c #232021", "p@ c #090808", "q@ c #0A0909", "r@ c #0F0F0E", "s@ c #191616", "t@ c #342F2F", "u@ c #DDDDDD", "v@ c #080707", "w@ c #090909", "x@ c #0A0A09", "y@ c #0D0C0D", "z@ c #110F10", "A@ c #181516", "B@ c #252223", "C@ c #292525", "D@ c #2B2829", "E@ c #EBEAEB", "F@ c #DDDADD", "G@ c #070607", "H@ c #080708", "I@ c #0A090A", "J@ c #0D0B0C", "K@ c #262322", "L@ c #070606", "M@ c #0F0D0D", "N@ c #0F0E0F", "O@ c #1A1918", "P@ c #1B1A19", "Q@ c #EBE7EB", "R@ c #DDD8DD", "S@ c #060505", "T@ c #070707", "U@ c #0C0C0B", "V@ c #0D0D0C", "W@ c #0E0E0D", "X@ c #302C2D", "Y@ c #DAD7DA", "Z@ c #040405", "`@ c #060605", " # c #090908", ".# c #0B0A0B", "+# c #0D0B0B", "@# c #1E1D1C", "## c #EAE7EA", "$# c #D7D6D7", "%# c #E8EAE8", "&# c #040404", "*# c #050505", "=# c #060606", "-# c #080607", ";# c #0B090A", "># c #1C1B1B", ",# c #262423", "'# c #2F2B2A", ")# c #D7D7D7", "!# c #E8E9E8", "~# c #030302", "{# c #050404", "]# c #10100F", "^# c #191818", "/# c #242120", "(# c #E6E7E6", "_# c #D4D6D4", ":# c #020202", "<# c #040304", "[# c #040504", "}# c #050605", "|# c #0E0D0C", "1# c #1A1718", "2# c #E0E6E0", "3# c #D2D7D2", "4# c #030303", "5# c #030304", "6# c #0B0B0B", "7# c #0C0C0C", "8# c #DDE4DD", "9# c #CED6CE", "0# c #E8E6E8", "a# c #010100", "b# c #030202", "c# c #1D1C1C", "d# c #E6E5E6", "e# c #394039", "f# c #070706", "g# c #100F10", "h# c #DBE3DB", "i# c #837E83", "j# c #4D524D", "k# c #505350", "l# c #505250", "m# c #4F504F", "n# c #4F534F", "o# c #696D69", "p# c #D6DCD6", " ", " ", " ", " . . . . . . . . . . . . . . . . . . . . . . . . . . ", " . + + + + + + + + @ . . # # # # # # . . # # # # # # . ", " . + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . ", " . + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . ", " . + + + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . $ ", " . @ @ @ @ @ @ @ @ @ @ @ @ @ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " . @ % & * * * = = - - - = * ; > ; , & = > - - > = > * ' ) ' = = - - = = = * * ! ' = ~ { * ' . ", " . ] @ = - ^ - ^ = / / ^ ^ - ^ - ' ( ~ _ : / / = / : - ' < - = : / / ^ ^ ^ - ^ [ = - = } * | & . ", " . 1 ^ @ 2 3 4 3 ) 5 5 5 4 6 4 7 3 8 9 1 0 1 2 3 5 4 4 2 a 2 6 2 b b 5 5 2 2 2 c 2 2 4 d | e f . ", " . g - h @ i i j k j j j l j m n i o p q n r s i t u v u u v w v u u u u v v u u v u j | x y f . ", " . g - z A B B B B C C C C C D E D D D D D D D D D D D D D D D D D D D D D D D D D D B F G y f . ", " . g - H I J K L M N O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^.c /.f . ", " . g - H (._.:.<.[.}.|.1.2.Q 3.4.5.6.7.8.9.0.a. .b.c.d.e.f.g.h.i.j.k.l.;.m.n.o.).!.p.q.].r.s.f . ", " . g - G (.t.u.v.w.[.[.N x.y.z.3.A.B.V C.X 9.D.E. .F.G.@.H.f.I.J.K.*.L.l.>.m.M.N.O.!.P.{.Q.R.f . ", " . g - S.(.T.U.V.W.X.Y.[.[.x.z.Z.`.T U V W X +.+++@+#++.$+e.$.I.%+*.=.&+*+>.=+M.).!.-+;+>+R.f . ", " . g - S.(.,+T.t.:.K L }.[.[.[.Q 3.A.'+)+V W !+~+E.{+F.G.]+^+/+I.(+%+*._+-.;.m.n.:+<+[+p.}+|+f . ", " . g - S.(.1+2+U._.v.K [.[.|.O 2.3+4+4.T )+W 5+6+.+E.++7+d.@.e.f.I.J.i.*.k.8+9+m.M.:+0+-+>+|+f . ", " . g - S.(.a+b+c+t.[.[.<.}.d+O e+f+4+g+h+U i+W j+ +.+E. .k+d.l+e.m+I.n+i.*.&+o+9+n.p+q+r+>+|+f . ", " . g - S.(.s+t+,+[.t.u+v.L }.N 1.[.[.[.[.[.[.[.[.X 0..+` @+k+d.@./+g.J.i.v+k.&+;.w+n.x+y+z+|+f . ", " . g - A+(.B+s+1+C+U._.:.K D+E+F+O y.z.3.G+T )+H+I+J+K+E. .F.G.l+$+/+I.J.i.*.k.l.;.=+p+L+M+N+f . ", " . g - > I O+P+a+Q+c+R+u.S+T+U+E+V+W+X+4+g+Y+Z+6.H+I+ +.+E. .F.d.@.e.f.`+J.i. @-.o+m.=+n.M+N+f . ", " . g - % I .@+@@@#@b+$@R+:.%@L U+&@O P f+R S T )+*@W X +.+{+=@-@d.^+;@f.%.J.*. @L.;.w+>@g ,@f . ", " . g - % I '@O+)@s+t+C+T.t.:.K L !@V+O P y.3.S T *@H+~@X ~+{@ .]@..d.$+/+g.(+n+^@_+l.;.m./ /@f . ", " . g - % I (@.@O+)@s+1+C+U.V.:.K L !@_@W+f+z.3.4.Z+:@<@X +.+E. .F.G.[@e./+g.J.K.*.k.}@m.|@1@f . ", " . g - % I 2@(@.@3@s+#@#@$@U.u.4@X.5@N O e+X+R S T 5.V W X +.+E. .F.G.^+;@f.I.6@j. @7@}@|@8@f . ", " . g - 9@I 0@a@.@b@c@s+#@2+T.d@:.K L U+N O P z.R `.T U <@W X ~+{@++=@..+.$+#.$.%.i.*.=.-.e@f@f . ", " . g - g@h@i@j@(@.@O+k@s+#@C+d@u.l@<.L }.F+W+2.m@n@S '+:@o@X !+ +E. .F...l+H.#.I.J.i.*.L.e@f@f . ", " . g - g@h@p@q@j@'@.@O+r@t+b+c+d@V.4@w.s@&@V+W+y.3+`.Y+U V C.8. +D.E. .k+d.l+H./+I.n+i.t@e@u@f . ", " . g - d h@v@w@x@j@.@y@3@@@z@b+T.R+l@W.A@U+&@O P y.4+`.T U V W B@D.Z C@F.k+D@$+e.m+%.J.j.E@F@f . ", " . g - x h@G@H@p@I@2@J@O+)@s+1+2+c+_.:.W.L }._@O P y.R 4.T 6.o@X K@K+a.C@@+G.[@$+/+I.J.%+e@F@f . ", " . g - } h@L@v@p@q@j@(@.@M@N@s+1+T.T._.:.A@5@E+O@P@y.z.3.S U )+H+X +.+E. .F.G.l+e.f.I.J.Q@R@f . ", " . g - x h@S@L@T@p@q@a@U@V@W@@@t+1+T.R+:.%@T+}.N O@P y.3+g+A.)+*@W j+ +{@C@@+..d.@.e.f.X@Q@Y@f . ", " . g - } h@Z@`@G@v@ #0@.#+#O++@P+z@b+T.d@:.K L U+N O P y.@#S T 6.o@8.J+ +.+{+b.G.d.@.#.$.##$#f . ", " . g - %#h@&#*#=#-#p@ #;#(@.@O+k@s+#@2+U.u.:.<.L !@|.1.>#m@g+4.U *@<@W +,#E. .b.G.[@H.'###)#f . ", " . g - !#h@~#{#*#=#T@p@q@j@(@.@W@)@]#1+2+R+u.:.<.L ^#O@P 2.4+S h+'+*@/#X J+.+E. .F.G.$+H.(#_#f . ", " . g - !#h@:#<#[#}#L@H@i@q@2@U@|#c@P+t+b+$@t.l@W.L }.1#O 2.y.R S A.)+V W 6+0.{@E.F.F.D@$+2#3#f . ", " . g - !#h@D 4#5#*#`@T@p@q@j@6#7#|#)@@@t+2+T._.:.K L }.O@O P 3+4+S A.:@o@8.X Y Z .]@G.d.8#9#f . ", " . g - 0#h@a#:#b#&#S@=#-#p@q@j@(@.@O+k@a+#@C+T.u.v.X.5@&@V+W+f+c#g+A.5.:@7.5+ +D.Z .k+G.N+9#f . ", " . g - d#e#B D :#4#&#S@f#v@w@q@a@+#b@W@k@g#1+$@R+u.:.T+5@N O P f+4+S A.)+V W j+,#.+C@b.k+h#9#f . ", " . g - 8@i#j#$ $ $ $ $ $ $ $ $ $ $ k#l#$ m#m#k#$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ n#o#p#9#f . ", " . g - @ @ i i j k j j j l j m n i o p q n r s i t u v u u v w v u u u u v v u u v u j | @ y f . ", " . 1 @ - 2 3 4 3 ) 5 5 5 4 6 4 7 3 8 9 1 0 1 2 3 5 4 4 2 a 2 6 2 b b 5 5 2 2 2 c 2 2 4 d - @ f . ", " . ] @ = - ^ - ^ = / / ^ ^ - ^ - ' ( ~ _ : / / = / : - ' < - = : / / ^ ^ ^ - ^ [ = - = } * @ & . ", " . @ % & * * * = = - - - = * ; > ; , & = > - - > = > * ' ) ' = = - - = = = * * ! ' = ~ { * ' @ . ", " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " ", " "}; mrxvt-0.5.4/share/pixmaps/mrxvt-root.png0000644000175000001440000000460610756127602015263 00000000000000PNG  IHDR22?bKGD pHYs  tIME  (6 IDAThZoTlH6R!".4RtUeHlaQ%Ro,*JV*%4YTtQmJCRg|]sof#PCü{~}w3B?lnnbrsg޿:Ⴧ2wznaȁ>ܽ{޸wK㖮.#Ǽ̝iHm̅.?㸥K{s)*y/\^̩3n nt]k0;3 Hrg/\S4ٳX۷n?k_Ә +$TF:VY[7Ko\ސѣGX_4CNq2fffz- IQczPIҾ ʘt}}y,/ǘh'SBhW@ьc2#;j&M%PRr$21: Z" MHPQ, -J9h ]~6?I$::AJnS YCڂh&˿N оk{OvR)!_WL6~~6@B$d޶8QA(t] L%*N^x/c_{&t?<-j$.jS(K3J,v.%d<g%(Y6Nš$)A+RQZώ4~! Q/ Bq@!6e\EH El`.@vdM<N?V?;ӯ=sHNADHs 306$eW7!)_Jċn dɖ+Y!JVFK1Tòm,BWf~:{SO4<"d(ZH0à)  91d~.G2^vQ6U7/bJ-d y d"Uh{_*H w<ɋo6)EHE \ VPH(2Bp@㡕Dpɠt.eA]{%SB S#51G5:jqLjt7q_K+HTgk!IV%םds%8Q:_P,$mWCfaGҨ&s-qI`!h>ۅ˚FCJPCubVT<18Z<[sI!XΑ:DdGl HY-}2]+He&qI/Ŗ~~/ȵ'CD2/Kb,1pHD@RfqӇ\U/R! -S!(e@$ JzBh4JJ1wU$wFc]ȍ𛚩F4`4zb8W0HمWT0\HC3Z cooml\`~I!X@-}$􍷾L6ۜ@SܸmHF(ay+6gQ)]*4:4[M(RzJ2b ZzAj,f=Tp#J+d\7:"Mb2oT1 )TW-S7.mF=Ґ%4Zgo$8JfS!W؀(+} V}^R;ҫ^cs깥 I~g ͘LA((ii6n]]!Z a) @џ"Rl%xe33vg>nob4Z沇ʮ'IK c #EFF0EF", ", c #EFF4EF", "' c #EFEEEF", ") c #F0F3F0", "! c #F0F6F0", "~ c #EEF0EE", "{ c #EAECEA", "] c #EFF3EF", "^ c #EDEEED", "/ c #EDEDED", "( c #EEF1EE", "_ c #EEEDEE", ": c #EDEFED", "< c #EEF2EE", "[ c #EFF2EF", "} c #E8EBE8", "| c #DEDBDE", "1 c #F4F3F4", "2 c #F3F3F3", "3 c #F3F5F3", "4 c #F3F4F3", "5 c #F2F3F2", "6 c #F2F4F2", "7 c #F5F4F5", "8 c #F5F7F5", "9 c #F4F5F4", "0 c #F5F5F5", "a c #F3F8F3", "b c #F2F2F2", "c c #F4F9F4", "d c #E8EEE8", "e c #E8ECE8", "f c #E3EAE3", "g c #EDF0ED", "h c #F1F1F1", "i c #DBD4DB", "j c #DBD5DB", "k c #DAD5DA", "l c #D5D5D5", "m c #DCD4DC", "n c #CDD4CD", "o c #D3D5D3", "p c #D4D4D4", "q c #CDD5CD", "r c #CBD5CB", "s c #D8D5D8", "t c #DCD5DC", "u c #DBDDDB", "v c #DBDCDB", "w c #DCDDDC", "x c #E8EDE8", "y c #E7EBE7", "z c #FAFBFA", "A c #434743", "B c #000000", "C c #010001", "D c #010101", "E c #000100", "F c #1E271E", "G c #F9F9F9", "H c #FBFAFB", "I c #3C443C", "J c #1A1717", "K c #1A1818", "L c #1B191A", "M c #1C1A1A", "N c #1D1B1B", "O c #1E1C1C", "P c #1F1D1D", "Q c #211E1E", "R c #221F1F", "S c #232020", "T c #232121", "U c #252222", "V c #262323", "W c #272424", "X c #282425", "Y c #282625", "Z c #292727", "` c #2B2828", " . c #2C2929", ".. c #2D2A2A", "+. c #2E2A2B", "@. c #2F2C2C", "#. c #302C2C", "$. c #312E2D", "%. c #332E2E", "&. c #333030", "*. c #343030", "=. c #363231", "-. c #373232", ";. c #373434", ">. c #393434", ",. c #3A3535", "'. c #3A3636", "). c #3B3737", "!. c #3C3838", "~. c #3E3939", "{. c #3F3A3A", "]. c #403B3B", "^. c #252925", "/. c #E6EAE6", "(. c #3C433C", "_. c #181617", ":. c #191817", "<. c #1A1919", "[. c #1B1919", "}. c #1D1A1A", "|. c #1E1C1B", "1. c #1F1C1C", "2. c #201D1D", "3. c #211F1F", "4. c #242222", "5. c #262424", "6. c #272525", "7. c #292626", "8. c #2A2727", "9. c #2E2B2A", "0. c #2F2B2C", "a. c #302D2C", "b. c #312D2E", "c. c #332F2F", "d. c #353232", "e. c #363332", "f. c #383433", "g. c #393435", "h. c #3A3635", "i. c #3B3736", "j. c #3C3738", "k. c #3D3939", "l. c #3E3A39", "m. c #3F3B3B", "n. c #242824", "o. c #EFF6EF", "p. c #E1E8E1", "q. c #171516", "r. c #191616", "s. c #191818", "t. c #FFE125", "u. c #1C1B1B", "v. c #1E1D1C", "w. c #211F1E", "x. c #221F20", "y. c #232021", "z. c #242122", "A. c #252223", "B. c #262324", "C. c #282424", "D. c #282526", "E. c #2A2827", "F. c #2C2828", "G. c #2D2A29", "H. c #2E2A2A", "I. c #2F2B2B", "J. c #312D2D", "K. c #322E2E", "L. c #353131", "M. c #363232", "N. c #373333", "O. c #383434", "P. c #393535", "Q. c #3B3636", "R. c #3C3837", "S. c #3E3A3A", "T. c #EDF5ED", "U. c #DEE6DE", "V. c #F8F8F8", "W. c #171515", "X. c #181616", "Y. c #242121", "Z. c #252122", "`. c #252322", " + c #262423", ".+ c #292525", "++ c #2A2728", "@+ c #2D292A", "#+ c #2F2C2B", "$+ c #302D2D", "%+ c #322F2E", "&+ c #3D3838", "*+ c #3D3839", "=+ c #252825", "-+ c #ECF5EC", ";+ c #161414", ">+ c #1D1A1B", ",+ c #1F1E1D", "'+ c #201E1E", ")+ c #222020", "!+ c #272423", "~+ c #282524", "{+ c #2E2B2B", "]+ c #322D2E", "^+ c #332F2E", "/+ c #33302F", "(+ c #343131", "_+ c #353231", ":+ c #373334", "<+ c #ECF4EC", "[+ c #DEE5DE", "}+ c #161313", "|+ c #1B1A19", "1+ c #1D1B1C", "2+ c #1F1D1E", "3+ c #211E1F", "4+ c #232122", "5+ c #282525", "6+ c #34302F", "7+ c #363233", "8+ c #383334", "9+ c #3C3737", "0+ c #151313", "a+ c #242221", "b+ c #292627", "c+ c #312E2E", "d+ c #322F2F", "e+ c #3A3536", "f+ c #141213", "g+ c #141313", "h+ c #161515", "i+ c #171616", "j+ c #181717", "k+ c #1C1A19", "l+ c #2C2829", "m+ c #343031", "n+ c #363131", "o+ c #383435", "p+ c #EDF3ED", "q+ c #F9F8F9", "r+ c #131211", "s+ c #141312", "t+ c #1A1718", "u+ c #252323", "v+ c #2A2627", "w+ c #2D2929", "x+ c #2F2A2B", "y+ c #353130", "z+ c #373233", "A+ c #383333", "B+ c #ECF1EC", "C+ c #DEE4DE", "D+ c #121111", "E+ c #161314", "F+ c #161415", "G+ c #191716", "H+ c #1B1A1A", "I+ c #1C1B1A", "J+ c #232120", "K+ c #342F30", "L+ c #343130", "M+ c #393534", "N+ c #111010", "O+ c #131212", "P+ c #151414", "Q+ c #191717", "R+ c #1A1819", "S+ c #1F1D1C", "T+ c #201E1D", "U+ c #22201F", "V+ c #2E2B2C", "W+ c #242924", "X+ c #DFE2DF", "Y+ c #11100F", "Z+ c #121011", "`+ c #131111", " @ c #151314", ".@ c #161514", "+@ c #201D1E", "@@ c #262322", "#@ c #2B2728", "$@ c #2C292A", "%@ c #363333", "&@ c #DFE1DF", "*@ c #100E0F", "=@ c #10100F", "-@ c #131112", ";@ c #292526", ">@ c #2B2727", ",@ c #2C2928", "'@ c #302C2D", ")@ c #322D2D", "!@ c #353030", "~@ c #ECEDEC", "{@ c #DEDFDE", "]@ c #0F0E0D", "^@ c #100F0F", "/@ c #151213", "(@ c #1E1C1D", "_@ c #201E1F", ":@ c #302C2B", "<@ c #322E2D", "[@ c #DFDEDF", "}@ c #ECEFEC", "|@ c #0E0D0D", "1@ c #0F0E0E", "2@ c #1C1919", "3@ c #1F1C1D", "4@ c #292625", "5@ c #292726", "6@ c #262A26", "7@ c #EBEBEB", "8@ c #DEDEDE", "9@ c #E8EFE8", "0@ c #3D443D", "a@ c #0D0C0C", "b@ c #0E0E0E", "c@ c #0F0E0F", "d@ c #101010", "e@ c #111011", "f@ c #171615", "g@ c #221E1F", "h@ c #2C2A2A", "i@ c #262926", "j@ c #0D0B0C", "k@ c #110F10", "l@ c #151413", "m@ c #191718", "n@ c #1A1918", "o@ c #1E1B1B", "p@ c #DDDDDD", "q@ c #0C0B0B", "r@ c #161413", "s@ c #21201F", "t@ c #EBEAEB", "u@ c #DDDADD", "v@ c #0B0A0B", "w@ c #0D0D0C", "x@ c #0E0D0E", "y@ c #100F0E", "z@ c #110F0F", "A@ c #262223", "B@ c #272324", "C@ c #2B2928", "D@ c #0A090A", "E@ c #0B0B0A", "F@ c #0F0D0D", "G@ c #100E0E", "H@ c #121010", "I@ c #141413", "J@ c #181716", "K@ c #1C1A1B", "L@ c #2A2828", "M@ c #EBE7EB", "N@ c #DDD8DD", "O@ c #090909", "P@ c #0B0A0A", "Q@ c #0D0B0B", "R@ c #0D0D0D", "S@ c #1A1817", "T@ c #211F20", "U@ c #2C2827", "V@ c #DAD7DA", "W@ c #090908", "X@ c #0A0909", "Y@ c #171415", "Z@ c #1D1B1A", "`@ c #1E1B1C", " # c #EAE7EA", ".# c #D7D6D7", "+# c #E8EAE8", "@# c #080707", "## c #0A0809", "$# c #0A0A0A", "%# c #0C0B0C", "&# c #0D0C0D", "*# c #252221", "=# c #272323", "-# c #272524", ";# c #2A2626", "># c #D7D7D7", ",# c #E8E9E8", "'# c #070607", ")# c #090708", "!# c #0B0A09", "~# c #0C0B0A", "{# c #100F10", "]# c #262B26", "^# c #E6E7E6", "/# c #D4D6D4", "(# c #070606", "_# c #070707", ":# c #090808", "<# c #0C0C0C", "[# c #0F0D0E", "}# c #141212", "|# c #1B1818", "1# c #262D26", "2# c #E0E6E0", "3# c #D2D7D2", "4# c #050506", "5# c #060706", "6# c #0A0A09", "7# c #1B1918", "8# c #2B2829", "9# c #DDE4DD", "0# c #CED6CE", "a# c #E8E6E8", "b# c #050504", "c# c #060505", "d# c #0D0C0B", "e# c #1B1819", "f# c #201C1C", "g# c #231F20", "h# c #2A2726", "i# c #2B2827", "j# c #E6E5E6", "k# c #394039", "l# c #040404", "m# c #050505", "n# c #060606", "o# c #080807", "p# c #0C0A0B", "q# c #121110", "r# c #242021", "s# c #212721", "t# c #DBE3DB", "u# c #837E83", "v# c #4D524D", "w# c #505350", "x# c #505250", "y# c #4F504F", "z# c #4F534F", "A# c #696D69", "B# c #D6DCD6", " ", " ", " ", " . . . . . . . . . . . . . . . . . . . . . . . . . . ", " . + + + + + + + + @ . . # # # # # # . . # # # # # # . ", " . + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . ", " . + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . ", " . + + + + + + + + + + + @ . $ # # # # # # # . $ # # # # # # # . $ ", " . @ @ @ @ @ @ @ @ @ @ @ @ @ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " . @ % & * * * = = - - - = * ; > ; , & = > - - > = > * ' ) ' = = - - = = = * * ! ' = ~ { * ' . ", " . ] @ = - ^ - ^ = / / ^ ^ - ^ - ' ( ~ _ : / / = / : - ' < - = : / / ^ ^ ^ - ^ [ = - = } * | & . ", " . 1 ^ @ 2 3 4 3 ) 5 5 5 4 6 4 7 3 8 9 1 0 1 2 3 5 4 4 2 a 2 6 2 b b 5 5 2 2 2 c 2 2 4 d | e f . ", " . g - h @ i i j k j j j l j m n i o p q n r s i t u v u u v w v u u u u v v u u v u j | x y f . ", " . g - z A B B B B C C C C C D E D D D D D D D D D D D D D D D D D D D D D D D D D D B F G y f . ", " . g - H I J K L M N O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^.c /.f . ", " . g - H (._.:.<.[.}.|.1.2.Q 3.S T 4.V 5.6.7.8.` ...9.0.a.b.c.*.*.d.e.f.g.h.i.j.k.l.m.n.o.p.f . ", " . g - G (.q.r.s.<.t.u.O v.t.w.x.y.z.A.B.C.D.7.E.F.G.H.I.#.J.K.c.*.L.M.N.O.P.Q.).R.~.S.^.T.U.f . ", " . g - V.(.W.X.t.t.t.t.t.t.t.t.3.R Y.Z.`. +C..+7.++F.@+H.#+$+J.%+c.*.L.M.N.>.P.'.).&+*+=+-+U.f . ", " . g - V.(.;+W.X.t.K [.>+t.O ,+'+3.)+T Z.V !+~+7.Z ` F.G.{+I.$+]+^+/+(+_+-.:+O.h.Q.j.*+^.<+[+f . ", " . g - V.(.}+W.W.t.J K |+t.1+1.2+3+R S 4+U V W 5+7.8.` .@+I.@.$+K.^+6+L.M.7+8+g.,.).9+n.-+[+f . ", " . g - V.(.0+t.t.t.t.t.t.t.t.O P 2.3.)+S a+U B.W Y b+8.` ...I.@.$+c+d+*.L.=.N.O.P.e+).=+-+[+f . ", " . g - V.(.f+g+t.h+i+j+t.[.k+N O P t.t.t.t.t.t.B.X 7.Z ++l+G.+.I.#.J.K.c.m+n+M.N.o+,.'.n.p+[+f . ", " . g - q+(.r+s+0+h+q.r.t+K |+M N 1.P '+3.)+Y.U u+W 5+7.v+` F.w+x+@.a.K.%+6+y+L.z+A+O.,.^.B+C+f . ", " . g - > I D+r+f+E+F+W.G+:.<.H+I+|.1.,+3+x.J+Y.`.V W 5+7.8.` .H.{+@.$+$.%+K+L+M.e.O.M+^.B+C+f . ", " . g - % I N+D+O+g+P+W.i+Q+K R+k+}.O S+T+3+U+S Y.`.V C.5+7.8.F. .H.V+#.$+c+c.*.L.M.N.O.W+g X+f . ", " . g - % I Y+Z+`+f+ @.@W.i+Q+K [.M N O P +@w.U+Y.4.@@W ~+.+v+#@F.$@{+I.#.$.%+c.L+_+%@N.W+/ &@f . ", " . g - % I *@=@Z+-@s+P+;+q.j+Q+K L M N 1.2.Q R S Y.4.V W 6.;@8.>@,@w+9.0.'@)@c./+!@L.z+W+~@{@f . ", " . g - % I ]@^@N+Z+O+/@P+h+q._.K <.[.N |.(@T+_@R J+Y.A.V W 5+7.8.,@w+..{+:@$+<@%+&.L+M.W+~@[@f . ", " . g - }@I |@1@^@N+`+O+g+;+W.X.Q+s.[.2@N O 3@T+w.S S Z.V +~+4@5@E.,@w+H.I.#.$.d+c.*.L.6@7@8@f . ", " . g - 9@0@a@b@c@d@e@r+O+ @;+f@X.Q+K [.M N O P '+g@S Y.4.@@!+C.7.8.>@` h@{+@.a.J.K./+(+i@7@8@f . ", " . g - 9@0@j@|@1@^@k@Z+`+g+l@;+i+X.m@n@L M o@(@2.3+R S Y.U u+W 5+7.8.` l+H.I.#+$+K.c./+i@7@p@f . ", " . g - d 0@q@a@|@1@*@k@D+O+g+r@h+i+G+K R+k+}.O S+2+3+s@S a+U V W 5+5@8.` .H.I.#.J.K.d+i@t@u@f . ", " . g - x 0@v@j@w@x@y@z@N+`+O+0+P+h+X.Q+K [.H+N o@P '+3.R T 4.A@B@6..+b+8.C@$@..{+#.J.K.i@7@u@f . ", " . g - } 0@D@E@a@w@F@G@N+H@r+O+I@h+h+J@Q+K [.K@N O P '+g@)+T z.u+W ~+.+8.L@l+$@9.@.#.J.i@M@N@f . ", " . g - x 0@O@P@q@Q@R@1@*@k@D+r+f+ @.@f@_.S@<.[.>+N 1.P '+T@)+Y.A.V W 5+7.>@U@ .H.x+@.$+i@M@V@f . ", " . g - } 0@W@X@P@q@a@|@1@^@N+Z+-@g+P+Y@i+r.:.[.M Z@`@v.T+w.x.J+4.`.V W ;@b+#@` w+H.I.#.i@ #.#f . ", " . g - +#0@@###$#P@%#@^@^@H@-@O+0+P+h+X.j+s.[.M Z@O S+T+w.)+S *#A.=#-#7.;#8.,@ .9.@.i@ #>#f . ", " . g - ,#0@'#)#O@!#~#j@|@1@y@{#N+D+s+l@h+W.X.Q+K [.M |.O P Q R x.T 4.A@5.6.7.Z ` l+w+{+]#^#/#f . ", " . g - ,#0@(#_#:#X@P@~#<#|@[#^@k@D+`+}#l@F+f@J@m@|#L }.1+1.2.Q R S T U V W 5+7.8.F. ...1#2#3#f . ", " . g - ,#0@4#5#@#:#6#P@q@a@|@1@^@N+`+O+0+ @W.i+_.m@7#k+>+`@1.2.3+U+S Y.A. +-#D.7.8.8#w+1#9#0#f . ", " . g - a#0@b#c#(#@#O@X@E@d#R@|@1@^@N+D+O+I@P+h+X.j+K e#k+Z@O f#'+R g#J+4.A@5.5+7.h#i# .1#C+0#f . ", " . g - j#k#l#m#n#_#o#O@6#p#q@|@]@^@z@q#-@O+0+;+W.X.m@K 2@}.N v.2.'+R S r#U V W 5+7.h#` s#t#0#f . ", " . g - [@u#v#$ $ $ $ $ $ $ $ $ $ $ w#x#$ y#y#w#$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ z#A#B#0#f . ", " . g - @ @ i i j k j j j l j m n i o p q n r s i t u v u u v w v u u u u v v u u v u j | @ y f . ", " . 1 @ - 2 3 4 3 ) 5 5 5 4 6 4 7 3 8 9 1 0 1 2 3 5 4 4 2 a 2 6 2 b b 5 5 2 2 2 c 2 2 4 d - @ f . ", " . ] @ = - ^ - ^ = / / ^ ^ - ^ - ' ( ~ _ : / / = / : - ' < - = : / / ^ ^ ^ - ^ [ = - = } * @ & . ", " . @ % & * * * = = - - - = * ; > ; , & = > - - > = > * ' ) ' = = - - = = = * * ! ' = ~ { * ' @ . ", " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", " ", " "}; mrxvt-0.5.4/share/mrxvtrc.sample0000644000175000001440000002471011035226241013627 00000000000000# Sample configuration for mrxvt-0.5.0. To use, copy it to ~/.mrxvtrc. # # This sets up a pseudo-transparent terminal with black tinted background, Xft # font, a transparent Firefox style tab-bar, and a next style scroll bar. # # Additionally, using the -name option you can get the following behaviour: # # Full screen: # Start mrxvt with "mrxvt -name FullScreen". Produces a full screen # terminal. # # Kitchen Sink: # Start mrxvt with "mrxvt -name KitchenSink". This produces an mrxvt # window with three tabs on startup. It loads your shell in the first tab, # and vim and mutt in the other two tabs. There aren't any other # applications you need to load anyway... ;) # # FvwmConsole: # Produces a small blue tinted terminal, mainly for use as an fvwm # console. Just load the FvwmConsole module with # # FvwmConsole -terminal mrxvt # # and these settings will be used. # # Root: # Start mrxvt with "mrxvt -name Root". This produces a green tinted mrxvt # windows which loads a root shell in the first tab. Ctrl+Shift+t opens a # new tab as root, and Ctrl+Shift+n opens a new tab as a regular user. # # # ----------------------------- TAB-BAR OPTIONS ------------------------------ # # Mrxvt.bottomTabbar: True # Only show the tab bar if there is more than one tab. Mrxvt.autohideTabbar: True # The number of tabs to attempt to keep visible. The width of tabs will shrink # to keep at least these many tabs visible. Mrxvt.minVisibleTabs: 8 # The max width in chars for each tab (only used with x11 fonts, or if xftPFont # is not specified). # Mrxvt.maxTabWidth: 17 # Hide left / right / close buttons in the tab bar. # Mrxvt.hideButtons: True # Make the terminal title the same as the active tab title. Mrxvt.syncTabTitle: True # Mrxvt.syncTabIcon: true # Display the tab number in the title. Useful so that you can use Alt+digit to # quickly switch between tabs. Mrxvt.titleFormat: %n. %t # Highlight inactive tabs only when they sound a bell (and not whenever they # produce output). Mrxvt.highlightTabOnBell: True # Tab bar colors Mrxvt.itabBackground: #101010 Mrxvt.tabBackground: #000000 Mrxvt.itabForeground: #909090 Mrxvt.tabForeground: #9a9a9a # Mrxvt.tabbarPixmap: tabbarbg.png # Mrxvt.tabUsePixmap: false # Monitor tabs for activity or inactivity # (alternate arguments for MonitorTab macro : "INACTIVITY" / "ACTIVITY") Mrxvt.macro.Ctrl+Shift+g: MonitorTab AUTO #Mrxvt.monitorTimeout: 2000 #Mrxvt.monitorCommand: play ~/.ding_sound.wav #Mrxvt.monitorCommand: aosd_cat --fontdesc="Trebuchet 20" --ypos=50 --delay=4000 Alert on tab %n :: %t #Mrxvt.monitorCommand: xmessage Monitor alert on tab %n # # ---------------------- SCROLLING / SCROLLBAR OPTIONS ----------------------- # # Mrxvt.scrollBar: true Mrxvt.scrollbarRight: true Mrxvt.scrollbarStyle: rxvt # Number of lines to save in the scroll back buffer for all tabs Mrxvt.saveLines: 500 # Don't scroll to the bottom every time some output is produced. Mrxvt.scrollTtyOutputInhibit: true # Scroll to the bottom when a key is pressed. Mrxvt.scrollTtyKeypress: true # Scroll bar colors Mrxvt.scrollColor: #808080 Mrxvt.troughColor: #202020 # Mrxvt.scrollbarPixmap: scrollbarbg.jpg # # ------------------------------- TRANSPARENCY ------------------------------- # # # True translucency (using Xorg's composite extension). # Mrxvt.opacity: 75 # Mrxvt.opacityDegree: 5 # Pseudo transparency. As long as you set the background using an esetroot # compatible program (e.g. feh), then the following will work. It is pretty # resource friendly too :). Mrxvt.transparent: True Mrxvt.transparentScrollbar: True Mrxvt.transparentTabbar: True Mrxvt.transparentMenubar: False # Color / degree to which the root background should be tinted. Mrxvt.tintColor: #000000 Mrxvt.shading: 75 # # ---------------------------------- FONTS ----------------------------------- # # Mrxvt.xft: 1 Mrxvt.xftFont: Bitstream Vera Sans Mono Mrxvt.xftSize: 13 Mrxvt.xftAntialias: 1 # The options below are better set using ~/.fonts.config. Mrxvt will use the # defaults passed to the fontconfig library. # # Mrxvt.xftHinting: 1 # Mrxvt.xftAutoHint: 1 # Mrxvt.xftGlobalAdvance: 1 # Mrxvt.xftRGBA: rgb # Mrxvt.xftslow: 1 # Don't load a multi-char font. This will reduce the line space if your multi # char font has different dimensions than the regular font. You might need to # comment it out if you want to use XIM and non-english fonts. Mrxvt.xftNomFont: 1 # Font to use for tab bar / menus. This need not be mono-spaced ;). Mrxvt.xftPFont: Bitstream Vera Sans Mrxvt.xftPSize: 10 # Shadow text # Mrxvt.textShadow: red # Mrxvt.textShadowMode: botright # # XIM input / multi char support. To use this, you should also comment out the # xftNomFont line above. # # Mrxvt.xftmFont: SimSun # Mrxvt.multichar_encoding: GB # Mrxvt.inputMethod: SCIM # # ---------------------------------- CURSOR ---------------------------------- # # Mrxvt.cursorBlink: true Mrxvt.cursorColor: #00ff00 Mrxvt.cursorColor2: #000000 # # ---------------------------------- COLORS ---------------------------------- # # # Setup colors for a black background. Mrxvt.background: #000000 Mrxvt.foreground: #9a9a9a Mrxvt.color0: #000000 Mrxvt.color1: #af0000 Mrxvt.color2: #00af00 Mrxvt.color3: #afaf00 Mrxvt.color4: #0000af Mrxvt.color5: #af00af Mrxvt.color6: #00afaf Mrxvt.color7: #9a9a9a Mrxvt.color8: #5f5f5f Mrxvt.color9: #d70000 Mrxvt.color10: #00d700 Mrxvt.color11: #d7d700 Mrxvt.color12: #0000d7 Mrxvt.color13: #d700d7 Mrxvt.color14: #00d7d7 Mrxvt.color15: #d7d7d7 # Display bold and underlined text in color, rather than using the terminal # attributes. This makes reading man pages a little easier. Mrxvt.colorBD: #00afaf Mrxvt.colorUL: #00af00 # Mrxvt.colorRV: #000040 # Display the X selection as highlighted instead of using reverse video. Mrxvt.highlightColor: #303060 # Colors when terminal window looses focus. (Does not work well with Xft). # Mrxvt.ufBackground: yellow # Mrxvt.backgroundFade: 50 # # ------------------------------- MISC OPTIONS ------------------------------- # # # Display menu Mrxvt.showMenu: True # The value of the TERM environment variable. Default is rxvt. If you have # trouble, try uncommenting the following line. # Mrxvt.termName: xterm # Default title of each tab. Mrxvt.tabTitle: mrxvt # Border to leave around terminal text Mrxvt.internalBorder: 2 # Make double click select whole URL's Mrxvt.cutChars: :=/~#@?%&_-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0abcdefghijklmnopqrstuvwxyz # Blank the mouse pointer on keystrokes or after 10 seconds of inactivity. Mrxvt.pointerBlank: True Mrxvt.pointerBlankDelay: 10 # Don't close the tab if the secondary screen is displayed (e.g. when running # vim). Mrxvt.protectSecondary: True # Run as a login shell. # Mrxvt.loginShell: True # Enable session management # Mrxvt.sessionMgt: true # # --------------------------------- PROFILES --------------------------------- # # # Root console on profile 1. Matrix like green font for root :). Mrxvt.profile1.foreground: #809a70 Mrxvt.profile1.background: #002000 Mrxvt.profile1.command: su Mrxvt.profile1.tabTitle: su # Better to start root consoles in root's home directory (and not the current # directory). Mrxvt.profile1.workingDirectory:/root # Mrxvt.profile1.Pixmap: matrix.jpg # Vim on profile 2. Vim is run in a shell, so after Vim exits, you'll get the # shell prompt. Mrxvt.profile2.command: !vim # Mrxvt.profile2.Pixmap: vim.png # Mutt on profile 3. Kill the scroll back buffer, to save a little memory. # Mrxvt.profile3.Pixmap: email.jpg Mrxvt.profile3.saveLines: 0 Mrxvt.profile3.command: mutt Mrxvt.profile3.workingDirectory: # # ---------------------------- KEYBOARD SHORTCUTS ---------------------------- # # # Open profiles 1 -- 4 on Ctrl+Shift+F1 -- F4. Mrxvt.macro.Ctrl+Shift+F1: NewTab -1 Mrxvt.macro.Ctrl+Shift+F2: NewTab -2 Mrxvt.macro.Ctrl+Shift+F3: NewTab -3 Mrxvt.macro.Ctrl+Shift+F4: NewTab -4 # # Save the scroll back buffer to a file, and open it (in less / vim) in a new # tab. Useful for searching, or cut/paste from the scroll back buffer. # Mrxvt.macro.Primary+Ctrl+Shift+question: PrintScreen -ps perl -e '$_=join("",); s/\n+$/\n/g; print' > /tmp/%p-scrollback Mrxvt.macro.Primary+Add+Ctrl+Shift+question: NewTab "(Tab %n scrollback)" \!less -ifLR +G /tmp/%p-scrollback; rm /tmp/%p-scrollback Mrxvt.macro.Primary+Ctrl+slash: PrintScreen -s perl -e '$_=join("",); s/\n+$/\n/g; print' > /tmp/%p-scrollback Mrxvt.macro.Primary+Add+Ctrl+slash: NewTab "(Tab %n scrollback)" \!view +"syn off| set nospell notitle noreadonly modifiable buftype=nofile |normal G" /tmp/%p-scrollback; rm /tmp/%p-scrollback # # When running a shell, this clears the scroll back buffer and executes the # current command. Useful if you're going to (or have just) run a command that # produces a lot of output. (Primary screen only). # Mrxvt.macro.Primary+Shift+Return: Esc \ec Mrxvt.macro.Primary+Add+Shift+Return: Str ^M # ---------------------------------------------------------------------------- # # # CLASS SETTINGS # # # ------------------------------- FULL SCREEN -------------------------------- # # FullScreen.bottomTabbar: False # Set a large font ;) FullScreen.xftSize: 17 FullScreen.xftPSize: 12 # Keep as many tabs as possible on screen FullScreen.minVisibleTabs: 15 # Set the window size increment to 1, so that the X server can resize our window # to the screen size without leaving any border. FullScreen.smoothResize: True # Request a full screen window from the window manager. Requires a EWMH # compatible window manager. This certainly works on OpenBox, Fvwm, KDE, and # possibly many others. FullScreen.fullscreen: True # # ------------------------------- KITCHEN SINK ------------------------------- # # # Number of tabs to launch initially KitchenSink.initProfileList: 0,2,3 # # ------------------------------- FVWM CONSOLE ------------------------------- # # FvwmConsole.initProfileList: 4 FvwmConsole.profile4.tabTitle: FvwmConsole FvwmConsole.profile4.background: #101020 FvwmConsole.profile4.holdExit: 4 FvwmConsole.xftSize: 12 FvwmConsole.tintColor: #181830 FvwmConsole.geometry: 60x15 FvwmConsole.scrollBar: False # # ------------------------------- ROOT CONSOLE ------------------------------- # # Root.initProfileList: 1 Root.tintColor: #002000 Root.itabBackground: #002000 # ---------------------------------------------------------------------------- # # vim: set ft=mrxvtrc ts=8 sts=4: mrxvt-0.5.4/README0000644000175000001440000003326310756127603010513 00000000000000 Congratulations! You have purchased an extremely fine device that would give you thousands of years of trouble-free service, except that you undoubtably will destroy it via some typical bonehead consumer maneuver. Which is why we ask you to PLEASE FOR GOD'S SAKE READ THIS OWNER'S MANUAL CAREFULLY BEFORE YOU UNPACK THE DEVICE. YOU ALREADY UNPACKED IT, DIDN'T YOU? YOU UNPACKED IT AND PLUGGED IT IN AND TURNED IT ON AND FIDDLED WITH THE KNOBS, AND NOW YOUR CHILD, THE SAME CHILD WHO ONCE SHOVED A POLISH SAUSAGE INTO YOUR VIDEOCASSETTE RECORDER AND SET IT ON "FAST FORWARD", THIS CHILD ALSO IS FIDDLING WITH THE KNOBS, RIGHT? AND YOU'RE JUST NOW STARTING TO READ THE INSTRUCTIONS, RIGHT??? WE MIGHT AS WELL JUST BREAK THESE DEVICES RIGHT AT THE FACTORY BEFORE WE SHIP THEM OUT, YOU KNOW THAT? -- Dave Barry, "Read This First!" 00 INTRODUCTION Mrxvt is a multi-tabbed (like gnome-terminal/konsole) terminal emulator for the X Window System. It targets to be light-weight, so the desktop environment, like CDE, KDE or GTK is not required in order to run it. It achieves this without losing the common useful features, like tab, image and pseudo-transparent background, multi-style scrollbars, XIM and CJK support, etc. 01 A BRIEF HISTORY You can safely skip this section if you do not have time. For years, a multi-tabbed rxvt has been requested by the users with no luck. Now, things have changed! Mrxvt (previously named as materm) is a tabbed X terminal emulator based on aterm/rxvt. It's small, fast, portable, feature rich and only depends on X library. An early version of mrxvt is based on multi-aterm v0.1 and named materm. Multi-aterm was first developed by Alexis from 2002 based on aterm. But the development seems to stop in 2004 without reaching a usable stable status. So I took over the project, began to hack it and renamed it to materm. I have made lots of changes to the code since I dislike the original code style. Hopefully, I have not broken too many things. ;-) Due to the limits of aterm, many features are not well implemented in materm, such as XIM support. So after release 0.2, I decided to pick up the latest rxvt as the base of new development branch. And the name of the project is changed to mrxvt. This branch is completely new compared to the branch prior to 0.2. I have found that rxvt coding style is much better than aterm (except the indent is horrible ;-)), and it is enjoyable to work on it. I have also ported many features from aterm and eterm to mrxvt, like tinting and text shadow. Be aware that some features in the new branch are slightly different from release 0.2, e.g., color background tinting is available for each individual terminal in release 0.2, but is global from 0.3.0. [quote="Gautam Iyer"] In 2005, I decided to join Jimmy in his wonderful efforts on mrxvt. Mainly because I had finished my thesis and had a few months to kill before graduating. I started by fixing a bug with Xft (to get the ACS graphics characters drawn under Xft), and gradually did major rewrites to the legacy rxvt code. Most of the code Jimmy wrote was great. But the old rxvt code sucked! The screen refresh routines for instance were "flicker-rama". If you moved a tiny clock over the mrxvt window, then the *whole* window would flicker. Of course, I was running this on a AMD K6, 500 mHz, with Xft and anti aliasing, so the flicker was *quite* prominent. By around August 2006, significant portions of the legacy code has been overhauled, and I think we have a rock solid code base. If all goes well, maybe we'll come out with a 1.0 version in 2008. [/quote] 02 BUG REPORT AND FAQ Bug reports are very welcome! You can build mrxvt with debug support. So if you have gdb in your system, you may run mrxvt in gdb with the source to track down the bug, and report it to me. To save both your time and my time, please write down detailed steps to replicate the bug. If I cannot replicate it by myself, I will ignore it even if it may destroy the universe. Patches are extremely welcome since I am not familiar with many things, like multi-languages and accent. In addition, I may not have time to update the documents in time. Feel free to help me and the users to improve them. Translations are also welcome. Of course, not from C to C++ or something like that! You know my meaning of translations. If you run into certain problems, please read the FAQ file and the man page before trying to contact me! Your question may be answered by them already. I most likely will dump your question to /dev/null if it is already answered there. 03 BUILD AND INSTALL To build and install from the source, please read INSTALL file! A quick (lazy) choice is to configure mrxvt as the following. After you --enable-everything, usually there is no need to enable other options explicitly. I have found that many distributions, like gentoo, enable other options with --enable-everything. This is NOT necessary in fact. The option is a shortcut to avoid a long list of configuration options. $ ./configure --enable-everything --disable-debug 04 CONFIGURATION FILE To run mrxvt with your own preferences, you can set X resources in ~/.mrxvtrc. A sample mrxvtrc.sample is included in the share/ directory of the source code, and you can start to hack your own ~/.mrxvtrc from it. You can also customize mrxvt for all users via a system-wide configuration file, usually /etc/mrxvt/mrxvtrc or /usr/local/etc/mrxvt/mrxvtrc. Since 0.5.0, configuration via file ~/.Xdefaults and ~/.Xresources is not supported any longer. Most options in the config file can be replace by a (short) command line option if you like command line options. 05 HOTKEY BINDINGS NOTE: As of 0.5.0, the "hotkey" feature was renamed to "macros". Several hot key combinations are available for keyboard users. Mrxvt is designed to be as flexible as possible. It can be surprising to see that many features can be altered during runtime using hotkeys or escape sequences. Please read the manual for a list of them. Be aware that they may be changed in the near future because the shortage of combinations for all features. ;-) If you do not like the default hot key combinations, you can define the combinations by yourself. Please read the manual page to find out how to define them. 06 CJK DISPLAY AND INPUT To display and input Chinese (Korea/Japanese), you can do the following: . Configure mrxvt with "--enable-cjk --enable-xim" options, and build it. . Install the correct CJK fonts. Mrxvt will try to look for some default CJK fonts if you do not specify them using the -fm option or mfont X resource name. The default CJK fonts are listed in the src/encoding.h file. Notice that they are -fm and mfont, NOT -fn and font!!! If you use freetype font, use -xftfm option to specify the CJK font family. Notice that -fm and -xftfm options use different formats of font names. For details about the difference, read the FAQ file. . Set environment variable LC_CTYPE to zh_CN (or zh_CN.GBK, zh_CN.GB2312, zh_CN.EUC based on your system). Make sure to unset environment variable LC_ALL, otherwise LC_CTYPE is overrided. Notice that this setting is global for all the following commands you will type in the same shell session. You can supply the environment variable to mrxvt at runtime instead of setting it globally here. Keep reading the following for details. . Set X resources in ~/.mrxvtrc. Notice that the value of inputMethod is case sensitive. Mrxvt.mfont: hanzigb16st Mrxvt.xftmfont: simsun Mrxvt.xftSize: 14 Mrxvt.multichar_encoding: GB Mrxvt.inputMethod: SCIM . Start the SCIM X input server as usual. For example: $ # for ksh/bash users $ LC_ALL=zh_CN LANG=zh_CN scim -d $ # for csh/tcsh users $ env LC_ALL=zh_CN LANG=zh_CN scim -d . Execute mrxvt. You can supply the environment variable LC_CTYPE and XMODIFIERS to mrxvt at runtime instead of setting them globally as above. All you need to do is to run mrxvt as following: # the following command is for bash/ksh LC_CTYPE=zh_CN XMODIFIERS=@im=SCIM mrxvt & # the following command is for csh/tcsh env LC_CTYPE=zh_CN XMODIFIERS=@im=SCIM mrxvt & . Focus on the mrxvt window, click Ctrl_Space to invoke SCIM . For Linux and Mac OS X, setting environment variable LC_ALL (for scim) and LC_CTYPE (for mrxvt) to zh_CN or zh_CN.GBK are both good for SCIM/fcitx input. For FreeBSD, they must be zh_CN.eucCN for fcitx input. For OpenBSD, they can be zh_CN.EUC or zh_CN.GBK for fcitx input. Mrxvt is tested to work with SCIM, fcitx and gcin on Linux, FreeBSD, OpenBSD and Mac OS X. It should work fine with other X Input methods, like xcin, Chinput and miniChinput. It is reported to work with French ascent as well. 07 FEATURES Major features (* are new features compared with rxvt, + are enhanced features compared with rxvt): * multi-tab support * runtime changedable tab title and tab order * simple command support (session) for each tab terminal * profiles for different tabs * macros to define shortcut key combinations * input broadcasting to all tab terminals * freetype font (Xft) support * built-in true translucent window support * user configurable keyboard shortcuts . pseudo-transparent terminal background * pseudo-transparent tabbar background * pseudo-transparent scrollbar background * pseudo-transparent menubar background + user supplied background image per terminal * user supplied background image for tabbar * user supplied background image for scrollbar * user supplied background image for menubar + xpm/jpeg/png background image * background color tinting * runtime changedable tinting color and shading * color text shadow and different shadow mode * background fading and off-focus fading + NeXT/Rxvt/Xterm/SGI/Plain style scrollbar + XIM and multi-languages (Chinese/Japanese/Korean) suppport . multiple platforms . utmp/wtmp/lastlog logging . only depends on X, no GTK, no Qt . small and fast For a complete list of all features, please read README.configure file. 08 PORTABILITY Here are tested platforms that mrxvt is known to work with: Slackware Linux 8.1/10.0/10.1/10.2, -current Slackintosh 10.1, 10.2 (PPC) RedHat Linux 9.0, Enterprise 3, Fedora Core 2/3 Debian Linux Gentoo Linux SuSE Linux 8.2, 9.0, 9.1, 9.2 SUN Solaris (SPARC) 7/8/9/10 FreeBSD 4.8/5.2.1/5.3 OpenBSD 3.5/3.6/3.8/3.9 NetBSD 2.0 IRIX 6.5 HP-UX Tru64/OSF 5.1 Mac OS X 10.3 (Panther), 10.4 (Tiger) Cygwin If you cannot find mrxvt in your favorite system (especially open source systems like Linux and BSD), you may try to contact the system developers and request them to add it into the system. :-) 09 KNOWN ISSUES Here are several known issues of mrxvt: . UTF-8 is not supported yet. . Some users report that they have problem to envoke the SCIM Chinese input method under Gentoo 2004.3 and Debian Sarge. I have no idea why this is the case because it always works for me. The solution? Dump Gentoo/Debian and turn to Slackware, or trace the program and send me patch. ;-) . To build mrxvt on HP-UX, you need to disable logging features. . Background image support requires libxpm, libpng or libjpeg be installed. The images are only tiled on the background of the terminal window. They cannot be scaled to fit the window size. . XFT support requires freetype, xft and fontconfig libraries be installed. Multichar support under XFT requires GNU iconv library be installed, which is usually included in GLIBC for Linux systems. . If swap screen option is disabled, screen scrolling may behave randomly. ;-) So the safe choice is to always enable it. . Tinting and pseudo-transparent are global since 0.3.0. Well, we could implement tinting and pseudo-transparent for each individual terminal (not a technical difficulty), but it will significantly increase the X resources usage since each terminal needs at least one pixmap. . Certain characters, e.g., characters with accent in European languages may not be correctly displayed under XFT. 10 SECURITY ISSUES Here are several security issues of mrxvt: Before 0.3.10, by default, mrxvt binary is installed as setuid root. Although we have tried hard to avoid security problems raised by setuid root permission, we do not guarantee 100% safety. You have been warned!!! From 0.3.10, mrxvt binary will be installed without setuid root due to security concerns. Thus, if mrxvt is not compiled with utempter library support, you will lose the logging features. From 0.3.5, mrxvt supports utempter library, which means if you have installed the utempter library, you can remove the setuid root permission from mrxvt binary without losing the logging feature. But doing so may cause trouble to chown the tty on some systems. From 0.4.x, numerous escape sequences were introduced to manipulate tabs. This are potential security risks. From 0.5.x the above escape sequences are disabled by default, and more secure alternates have been provided (macros + popup menus). 11 COPYRIGHT Mrxvt is licensed under GNU General Public License (GPL). You are free to copy, modify and redistribute the source and binary of mrxvt under GPL. But there is a issue with SCO Corp.: According to section 4 of the GPL, SCO Corporation of Lindon, Utah (formerly Caldera) has no rights to redistribute any versions of Mrxvt and/or Materm in any of their products, including (without limitation) OpenLinux, Skunkware, OpenServer, and UNIXWare. mrxvt-0.5.4/configure0000755000175000001440000134000011012076343011517 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for mrxvt 0.5.4. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='mrxvt' PACKAGE_TARNAME='mrxvt' PACKAGE_VERSION='0.5.4' PACKAGE_STRING='mrxvt 0.5.4' PACKAGE_BUGREPORT='jimmyzhou@users.sourceforge.net' ac_unique_file="src/main.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os RXVT_SCROLLBAR_TRUE RXVT_SCROLLBAR_FALSE NEXT_SCROLLBAR_TRUE NEXT_SCROLLBAR_FALSE XTERM_SCROLLBAR_TRUE XTERM_SCROLLBAR_FALSE PLAIN_SCROLLBAR_TRUE PLAIN_SCROLLBAR_FALSE SGI_SCROLLBAR_TRUE SGI_SCROLLBAR_FALSE UTMP_SUPPORT_TRUE UTMP_SUPPORT_FALSE GREEK_TRUE GREEK_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE XMKMF CPP SESSION_SUPPORT_TRUE SESSION_SUPPORT_FALSE USE_JPEG_TRUE USE_JPEG_FALSE USE_PNG_TRUE USE_PNG_FALSE XFT_SUPPORT_TRUE XFT_SUPPORT_FALSE GREP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS XMKMF CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures mrxvt 0.5.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/mrxvt] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of mrxvt 0.5.4:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-everything enable all options [no] --enable-minimal enable minimal options [no] --enable-debug enable debug mode - for developper [no] --enable-ourstrings enable our strings functions [no] --enable-frills enable internal borders / smart resizing [yes] --enable-keepscrolling enable continual scrolling on scrollbar arrow press [yes] --enable-selectionscrolling enable continual scrolling on selection [yes] --enable-mousewheel enable scrolling via mouse wheel or buttons 4 & 5 [yes] --enable-mouseslipwheel enable slip scrolling via mouse wheel or buttons 4 & 5 [no] --enable-rxvt-scroll enable rxvt style scrollbar [yes] --enable-next-scroll enable NeXT style scrollbar [yes] --enable-xterm-scroll enable Xterm style scrollbar [yes] --enable-plain-scroll enable plain style scrollbar [yes] --enable-sgi-scroll enable SGI IRIX style scrollbar [yes] --enable-half-shadow enable half width/height shadow on rxvt scrollbar [yes] --enable-utmp enable utmp/utmpx support [yes] --enable-wtmp enable wtmp support (need utmp support) [yes] --enable-lastlog enable lastlog support [yes] --enable-sessionmgr enable X session manager [yes] --enable-utempter enable utempter library for utmp/wtmp/lastlog [no] --enable-linespace enable linespace support [yes] --enable-24bits prefer 24 bits color [no] --enable-256colors use 256 color [yes] --enable-cursor-blink enable cursor blinking [yes] --enable-pointer-blank enable blank pointer [yes] --enable-text-shadow enable colors shadow for text [no] --enable-menubar enable menu bar [no] --enable-transparency enable transparent background [yes] --enable-tinting enable colors tinting [yes] --enable-xrender tint using XRender (slower but nicer results) [yes] --enable-xpm enable XPM background pixmaps [yes] --enable-jpeg enable JPEG background pixmaps [yes] --enable-png enable PNG background pixmaps [yes] --enable-xft enable freetype font support [no] --enable-xim enable XIM support [no] --enable-greek enable Greek keyboard support [no] --enable-cjk enable CJK multichar language support [no] --enable-ttygid enable ttygid to group tty [yes] --enable-backspace-key enable handling of the backspace key [yes] --enable-delete-key enable handling of the delete key [yes] --enable-use-fifo Enable listening for macros on a fifo [yes] --enable-resources enable all resource checking [yes] --enable-swapscreen enable swap screen support [yes] --enable-old-selection enable old mouse selection code [no] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-term=NAME set the terminal to NAME [rxvt] --with-line-space=NUM set the space between lines [0] --with-int-border=NUM set the width of internal border, frills option must be enabled [0] --with-ext-border=NUM set the width of external border, frills option must be enabled [0] --with-save-lines=NUM set the lines to save in scroll [100] --with-max-profiles=NUM set the max number of terminal [5] --with-max-term=NUM set the max number of terminal [15] --with-atab-extra=% The extra height (as a % of the font height) active tabs should have --with-tab-radius=% The radius (as a % of the font X offset) of tab corners --with-terminfo=PATH set the path to the terminfo tree to PATH --with-encoding=NAME set language default encoding (eucj|sjis|big5|gb|gbk|kr|noenc) to NAME (default is noenc) --with-x use the X Window System Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory XMKMF Path to xmkmf, Makefile generator for X Window System CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF mrxvt configure 0.5.4 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by mrxvt $as_me 0.5.4, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.10' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE=mrxvt VERSION=0.5.4 cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_headers="$ac_config_headers config.h" { echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac local_os_type="unknown" case "$host" in *-cygwin*) cat >>confdefs.h <<\_ACEOF #define OS_CYGWIN _ACEOF local_os_type="cygwin" ;; *-linux*) cat >>confdefs.h <<\_ACEOF #define OS_LINUX _ACEOF cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE _ACEOF local_os_type="linux" ;; *-irix*) cat >>confdefs.h <<\_ACEOF #define OS_IRIX _ACEOF local_os_type="irix" ;; *-sunos*) cat >>confdefs.h <<\_ACEOF #define OS_SUNOS _ACEOF local_os_type="sunos" ;; *-solaris*) cat >>confdefs.h <<\_ACEOF #define OS_SOLARIS _ACEOF local_os_type="solaris" ;; *-aix*) cat >>confdefs.h <<\_ACEOF #define OS_AIX _ACEOF local_os_type="aix" ;; *-hpux*) cat >>confdefs.h <<\_ACEOF #define OS_HPUX _ACEOF local_os_type="hpux" ;; *-freebsd*) cat >>confdefs.h <<\_ACEOF #define OS_BSD _ACEOF cat >>confdefs.h <<\_ACEOF #define OS_FREEBSD _ACEOF local_os_type="freebsd" CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-netbsd*) cat >>confdefs.h <<\_ACEOF #define OS_BSD _ACEOF cat >>confdefs.h <<\_ACEOF #define OS_NETBSD _ACEOF local_os_type="netbsd" CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-openbsd*) cat >>confdefs.h <<\_ACEOF #define OS_BSD _ACEOF cat >>confdefs.h <<\_ACEOF #define OS_OPENBSD _ACEOF local_os_type="openbsd" OBSD_REL=`/usr/bin/uname -r | sed 's/\.//g'` cat >>confdefs.h <<_ACEOF #define OS_OPENBSD_REL ${OBSD_REL} _ACEOF CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-osf*) cat >>confdefs.h <<\_ACEOF #define OS_OSF _ACEOF local_os_type="osf" ;; *-darwin*) cat >>confdefs.h <<\_ACEOF #define OS_BSD _ACEOF cat >>confdefs.h <<\_ACEOF #define OS_DARWIN _ACEOF local_os_type="darwin" ;; *-sco*) cat >>confdefs.h <<\_ACEOF #define OS_SCO _ACEOF cat >>confdefs.h <<\_ACEOF #define OS_SVR4 _ACEOF local_os_type="sco" { { echo "$as_me:$LINENO: error: Mrxvt does not support f*cking SCO's products!" >&5 echo "$as_me: error: Mrxvt does not support f*cking SCO's products!" >&2;} { (exit 1); exit 1; }; } esac support_everything=no support_minimal=no support_debug=no support_ourstrings=no support_frills=yes support_keepscrolling=yes support_selectionscrolling=yes support_mousewheel=yes support_mouseslipwheel=no support_scroll_rxvt=yes support_scroll_next=yes support_scroll_xterm=yes support_scroll_plain=yes support_scroll_sgi=yes support_half_shadow=yes support_utmp=yes support_wtmp=yes support_lastlog=yes support_sessionmgr=yes support_utempter=no support_linespace=yes support_24bits=no support_256colors=yes support_cursor_blink=yes support_pointer_blank=yes support_text_shadow=no support_smart_resize=no support_menubar=no support_background_image=yes support_transparency=yes support_tinting=yes support_xrender=yes support_xpm=yes support_jpeg=yes support_png=yes support_xft=no support_xim=no support_greek=no support_cjk=no support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=yes support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no # Check whether --enable-everything was given. if test "${enable_everything+set}" = set; then enableval=$enable_everything; support_everything=$enableval else support_everything=no fi if test "x$support_everything" = "xyes"; then support_debug=yes support_ourstrings=no support_frills=yes support_keepscrolling=yes support_selectionscrolling=yes support_mousewheel=yes support_mouseslipwheel=yes support_scroll_rxvt=yes support_scroll_next=yes support_scroll_sgi=yes support_scroll_xterm=yes support_scroll_plain=yes support_half_shadow=yes support_utmp=yes support_wtmp=yes support_lastlog=yes support_sessionmgr=yes support_utempter=yes support_linespace=yes support_24bits=yes support_256colors=yes support_cursor_blink=yes support_pointer_blank=yes support_text_shadow=yes support_smart_resize=yes support_menubar=yes support_background_image=yes support_transparency=yes support_tinting=yes support_xrender=yes support_xpm=yes support_jpeg=yes support_png=yes support_xft=yes support_xim=yes support_greek=yes support_cjk=yes support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=yes support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no fi # Check whether --enable-minimal was given. if test "${enable_minimal+set}" = set; then enableval=$enable_minimal; support_minimal=$enableval else support_minimal=no fi if test "x$support_minimal" = "xyes"; then support_debug=no support_ourstrings=no support_frills=no support_keepscrolling=no support_selectionscrolling=no support_mousewheel=no support_mouseslipwheel=no support_scroll_rxvt=no support_scroll_next=no support_scroll_sgi=no support_scroll_xterm=yes support_scroll_plain=no support_half_shadow=no support_utmp=no support_wtmp=no support_lastlog=no support_sessionmgr=no support_utempter=no support_linespace=no support_24bits=no support_256colors=no support_cursor_blink=no support_pointer_blank=no support_text_shadow=no support_smart_resize=no support_menubar=no support_background_image=no support_transparency=no support_tinting=no support_xrender=no support_xpm=no support_jpeg=no support_png=no support_xft=no support_xim=no support_greek=no support_cjk=no support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=no support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; support_debug=$enableval fi if test "x$support_debug" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define DEBUG _ACEOF CFLAGS="$CFLAGS -g" else cat >>confdefs.h <<\_ACEOF #define NDEBUG _ACEOF fi # Check whether --enable-ourstrings was given. if test "${enable_ourstrings+set}" = set; then enableval=$enable_ourstrings; support_ourstrings=$enableval fi if test "x$support_ourstrings" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define OUR_STRINGS _ACEOF fi # Check whether --enable-frills was given. if test "${enable_frills+set}" = set; then enableval=$enable_frills; support_frills=$enableval fi if test "x$support_frills" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_FRILLS _ACEOF fi # Check whether --enable-keepscrolling was given. if test "${enable_keepscrolling+set}" = set; then enableval=$enable_keepscrolling; support_keepscrolling=$enableval fi if test "x$support_keepscrolling" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING _ACEOF fi # Check whether --enable-selectionscrolling was given. if test "${enable_selectionscrolling+set}" = set; then enableval=$enable_selectionscrolling; support_selectionscrolling=$enableval fi if test "x$support_selectionscrolling" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define SELECTION_SCROLLING _ACEOF fi # Check whether --enable-mousewheel was given. if test "${enable_mousewheel+set}" = set; then enableval=$enable_mousewheel; support_mousewheel=$enableval fi if test "x$support_mousewheel" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define MOUSE_WHEEL _ACEOF fi # Check whether --enable-mouseslipwheel was given. if test "${enable_mouseslipwheel+set}" = set; then enableval=$enable_mouseslipwheel; support_mouseslipwheel=$enableval fi if test "x$support_mousewheel x$support_mouseslipwheel" = "xyes xyes"; then cat >>confdefs.h <<\_ACEOF #define MOUSE_SLIP_WHEELING _ACEOF fi # Check whether --enable-rxvt-scroll was given. if test "${enable_rxvt_scroll+set}" = set; then enableval=$enable_rxvt_scroll; support_scroll_rxvt=$enableval fi if test "x$support_scroll_rxvt" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define RXVT_SCROLLBAR _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SCROLLBARS _ACEOF support_scroll="yes" fi # Check whether --enable-next-scroll was given. if test "${enable_next_scroll+set}" = set; then enableval=$enable_next_scroll; support_scroll_next=$enableval fi if test "x$support_scroll_next" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define NEXT_SCROLLBAR _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SCROLLBARS _ACEOF support_scroll="yes" fi # Check whether --enable-xterm-scroll was given. if test "${enable_xterm_scroll+set}" = set; then enableval=$enable_xterm_scroll; support_scroll_xterm=$enableval fi if test "x$support_scroll_xterm" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define XTERM_SCROLLBAR _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SCROLLBARS _ACEOF support_scroll="yes" fi # Check whether --enable-plain-scroll was given. if test "${enable_plain_scroll+set}" = set; then enableval=$enable_plain_scroll; support_scroll_plain=$enableval fi if test "x$support_scroll_plain" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define PLAIN_SCROLLBAR _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SCROLLBARS _ACEOF support_scroll="yes" fi # Check whether --enable-sgi-scroll was given. if test "${enable_sgi_scroll+set}" = set; then enableval=$enable_sgi_scroll; support_scroll_sgi=$enableval fi if test "x$support_scroll_sgi" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define SGI_SCROLLBAR _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_SCROLLBARS _ACEOF support_scroll="yes" fi if test "x$support_scroll_rxvt" = "xyes"; then RXVT_SCROLLBAR_TRUE= RXVT_SCROLLBAR_FALSE='#' else RXVT_SCROLLBAR_TRUE='#' RXVT_SCROLLBAR_FALSE= fi if test "x$support_scroll_next" = "xyes"; then NEXT_SCROLLBAR_TRUE= NEXT_SCROLLBAR_FALSE='#' else NEXT_SCROLLBAR_TRUE='#' NEXT_SCROLLBAR_FALSE= fi if test "x$support_scroll_xterm" = "xyes"; then XTERM_SCROLLBAR_TRUE= XTERM_SCROLLBAR_FALSE='#' else XTERM_SCROLLBAR_TRUE='#' XTERM_SCROLLBAR_FALSE= fi if test "x$support_scroll_plain" = "xyes"; then PLAIN_SCROLLBAR_TRUE= PLAIN_SCROLLBAR_FALSE='#' else PLAIN_SCROLLBAR_TRUE='#' PLAIN_SCROLLBAR_FALSE= fi if test "x$support_scroll_sgi" = "xyes"; then SGI_SCROLLBAR_TRUE= SGI_SCROLLBAR_FALSE='#' else SGI_SCROLLBAR_TRUE='#' SGI_SCROLLBAR_FALSE= fi # Check whether --enable-half-shadow was given. if test "${enable_half_shadow+set}" = set; then enableval=$enable_half_shadow; support_half_shadow=$enableval fi if test "x$support_scroll_rxvt x$support_half_shadow" = "xyes xyes"; then cat >>confdefs.h <<\_ACEOF #define HALFSHADOW _ACEOF fi # Check whether --enable-utmp was given. if test "${enable_utmp+set}" = set; then enableval=$enable_utmp; support_utmp=$enableval fi if test "x$support_utmp" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define UTMP_SUPPORT _ACEOF fi # Check whether --enable-wtmp was given. if test "${enable_wtmp+set}" = set; then enableval=$enable_wtmp; support_wtmp=$enableval fi if test "x$support_utmp x$support_wtmp" = "xyes xyes"; then cat >>confdefs.h <<\_ACEOF #define WTMP_SUPPORT _ACEOF fi # Check whether --enable-lastlog was given. if test "${enable_lastlog+set}" = set; then enableval=$enable_lastlog; support_lastlog=$enableval fi if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then cat >>confdefs.h <<\_ACEOF #define LASTLOG_SUPPORT _ACEOF fi if test "x$support_utmp" = "xyes"; then UTMP_SUPPORT_TRUE= UTMP_SUPPORT_FALSE='#' else UTMP_SUPPORT_TRUE='#' UTMP_SUPPORT_FALSE= fi # Check whether --enable-sessionmgr was given. if test "${enable_sessionmgr+set}" = set; then enableval=$enable_sessionmgr; support_sessionmgr=$enableval fi # Check whether --enable-utempter was given. if test "${enable_utempter+set}" = set; then enableval=$enable_utempter; support_utempter=$enableval fi # Check whether --enable-linespace was given. if test "${enable_linespace+set}" = set; then enableval=$enable_linespace; support_linespace=$enableval fi if test "x$support_linespace" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_LINESPACE _ACEOF fi # Check whether --enable-24bits was given. if test "${enable_24bits+set}" = set; then enableval=$enable_24bits; support_24bits=$enableval fi if test "x$support_24bits" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define PREFER_24BIT _ACEOF fi # Check whether --enable-256colors was given. if test "${enable_256colors+set}" = set; then enableval=$enable_256colors; support_256colors=$enableval fi if test "x$support_256colors" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define TTY_256COLOR _ACEOF fi # Check whether --enable-cursor-blink was given. if test "${enable_cursor_blink+set}" = set; then enableval=$enable_cursor_blink; support_cursor_blink=$enableval fi if test "x$support_cursor_blink" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define CURSOR_BLINK _ACEOF fi # Check whether --enable-pointer-blank was given. if test "${enable_pointer_blank+set}" = set; then enableval=$enable_pointer_blank; support_pointer_blank=$enableval fi if test "x$support_pointer_blank" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define POINTER_BLANK _ACEOF fi # Check whether --enable-text-shadow was given. if test "${enable_text_shadow+set}" = set; then enableval=$enable_text_shadow; support_text_shadow=$enableval fi if test "x$support_text_shadow" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define TEXT_SHADOW _ACEOF fi # Check whether --enable-menubar was given. if test "${enable_menubar+set}" = set; then enableval=$enable_menubar; support_menubar=$enableval fi if test "x$support_menubar" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_MENUBAR _ACEOF fi # Check whether --enable-transparency was given. if test "${enable_transparency+set}" = set; then enableval=$enable_transparency; support_transparency=$enableval fi if test "x$support_transparency" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define TRANSPARENT _ACEOF fi # Check whether --enable-tinting was given. if test "${enable_tinting+set}" = set; then enableval=$enable_tinting; support_tinting=$enableval fi # Check whether --enable-xrender was given. if test "${enable_xrender+set}" = set; then enableval=$enable_xrender; support_xrender=$enableval fi # Check whether --enable-xpm was given. if test "${enable_xpm+set}" = set; then enableval=$enable_xpm; support_xpm=$enableval fi # Check whether --enable-jpeg was given. if test "${enable_jpeg+set}" = set; then enableval=$enable_jpeg; support_jpeg=$enableval fi # Check whether --enable-png was given. if test "${enable_png+set}" = set; then enableval=$enable_png; support_png=$enableval fi # Check whether --enable-xft was given. if test "${enable_xft+set}" = set; then enableval=$enable_xft; support_xft=$enableval fi # Check whether --enable-xim was given. if test "${enable_xim+set}" = set; then enableval=$enable_xim; support_xim=$enableval fi # Check whether --enable-greek was given. if test "${enable_greek+set}" = set; then enableval=$enable_greek; support_greek=$enableval fi if test "x$support_greek" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define GREEK_SUPPORT _ACEOF fi if test "x$support_greek" = "xyes"; then GREEK_TRUE= GREEK_FALSE='#' else GREEK_TRUE='#' GREEK_FALSE= fi # Check whether --enable-cjk was given. if test "${enable_cjk+set}" = set; then enableval=$enable_cjk; support_cjk=$enableval fi # Check whether --enable-ttygid was given. if test "${enable_ttygid+set}" = set; then enableval=$enable_ttygid; support_ttygid=$enableval fi if test "x$support_ttygid" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define TTY_GID_SUPPORT _ACEOF fi # Check whether --enable-backspace-key was given. if test "${enable_backspace_key+set}" = set; then enableval=$enable_backspace_key; support_backspace_key=$enableval fi if test "x$support_backspace_key" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_BACKSPACE_KEY _ACEOF fi # Check whether --enable-delete-key was given. if test "${enable_delete_key+set}" = set; then enableval=$enable_delete_key; support_delete_key=$enableval fi if test "x$support_delete_key" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_DELETE_KEY _ACEOF fi # Check whether --enable-use-fifo was given. if test "${enable_use_fifo+set}" = set; then enableval=$enable_use_fifo; use_fifo=$enableval fi if test "x$use_fifo" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define USE_FIFO _ACEOF fi # Check whether --enable-resources was given. if test "${enable_resources+set}" = set; then enableval=$enable_resources; support_resources=$enableval fi if test "x$support_resources" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_RESOURCES _ACEOF fi # Check whether --enable-swapscreen was given. if test "${enable_swapscreen+set}" = set; then enableval=$enable_swapscreen; support_swapscreen=$enableval fi if test "x$support_swapscreen" != "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_SECONDARY_SCREEN _ACEOF fi # Check whether --enable-old-selection was given. if test "${enable_old_selection+set}" = set; then enableval=$enable_old_selection; support_old_selection=$enableval fi if test "x$support_old_selection" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define NO_NEW_SELECTION _ACEOF else cat >>confdefs.h <<\_ACEOF #define NO_OLD_SELECTION _ACEOF fi # Check whether --with-term was given. if test "${with_term+set}" = set; then withval=$with_term; term_name_option=$withval else term_name_option=rxvt fi cat >>confdefs.h <<_ACEOF #define TERMENV "$term_name_option" _ACEOF # Check whether --with-line-space was given. if test "${with_line_space+set}" = set; then withval=$with_line_space; line_space_option=$withval else line_space_option=0 fi cat >>confdefs.h <<_ACEOF #define LINESPACE $line_space_option _ACEOF # Check whether --with-int-border was given. if test "${with_int_border+set}" = set; then withval=$with_int_border; int_border_option=$withval else int_border_option=0 fi cat >>confdefs.h <<_ACEOF #define INTERNALBORDERWIDTH $int_border_option _ACEOF # Check whether --with-ext-border was given. if test "${with_ext_border+set}" = set; then withval=$with_ext_border; ext_border_option=$withval else ext_border_option=0 fi cat >>confdefs.h <<_ACEOF #define EXTERNALBORDERWIDTH $ext_border_option _ACEOF # Check whether --with-save-lines was given. if test "${with_save_lines+set}" = set; then withval=$with_save_lines; save_lines_option=$withval else save_lines_option=100 fi cat >>confdefs.h <<_ACEOF #define SAVELINES $save_lines_option _ACEOF # Check whether --with-max-profiles was given. if test "${with_max_profiles+set}" = set; then withval=$with_max_profiles; max_prof_option=$withval else max_prof_option=5 fi cat >>confdefs.h <<_ACEOF #define MAX_PROFILES $max_prof_option _ACEOF # Check whether --with-max-term was given. if test "${with_max_term+set}" = set; then withval=$with_max_term; max_term_option=$withval else max_term_option=15 fi cat >>confdefs.h <<_ACEOF #define MAX_PAGES $max_term_option _ACEOF # Check whether --with-atab-extra was given. if test "${with_atab_extra+set}" = set; then withval=$with_atab_extra; atab_extra_option=$withval else atab_extra_option=20 fi cat >>confdefs.h <<_ACEOF #define ATAB_EXTRA_PERCENT $atab_extra_option _ACEOF # Check whether --with-tab-radius was given. if test "${with_tab_radius+set}" = set; then withval=$with_tab_radius; tab_radius_option=$withval else tab_radius_option=100 fi cat >>confdefs.h <<_ACEOF #define TAB_RADIUS_PERCENT $tab_radius_option _ACEOF withval="" # Check whether --with-terminfo was given. if test "${with_terminfo+set}" = set; then withval=$with_terminfo; terminfo_option=$withval else terminfo_option="/usr/share/terminfo" fi if test "x$withval" != "x"; then cat >>confdefs.h <<_ACEOF #define RXVT_TERMINFO "$terminfo_option" _ACEOF fi # Check whether --with-encoding was given. if test "${with_encoding+set}" = set; then withval=$with_encoding; encoding_option=$withval else encoding_option="noenc" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in gcc cc egcs do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in gcc cc egcs do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -fPIC" fi { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' #AM_PROG_LIBTOOL if test "x$local_os_type" = "xfreebsd" -o \ "x$local_os_type" = "xopenbsd" -o \ "x$local_os_type" = "xnetbsd"; then { echo "$as_me:$LINENO: checking for setlocale in -lxpg4" >&5 echo $ECHO_N "checking for setlocale in -lxpg4... $ECHO_C" >&6; } if test "${ac_cv_lib_xpg4_setlocale+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lxpg4 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char setlocale (); int main () { return setlocale (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_xpg4_setlocale=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_xpg4_setlocale=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_xpg4_setlocale" >&5 echo "${ECHO_T}$ac_cv_lib_xpg4_setlocale" >&6; } if test $ac_cv_lib_xpg4_setlocale = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXPG4 1 _ACEOF LIBS="-lxpg4 $LIBS" fi { echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; } if test "${ac_cv_lib_util_openpty+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char openpty (); int main () { return openpty (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_util_openpty=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_util_openpty=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; } if test $ac_cv_lib_util_openpty = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBUTIL 1 _ACEOF LIBS="-lutil $LIBS" fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 echo "$as_me: error: Cannot use X directory names containing '" >&2;} { (exit 1); exit 1; }; };; #( *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; } fi if test "x$no_x" = "xyes"; then { { echo "$as_me:$LINENO: error: Mrxvt requires the X Window System libraries and headers." >&5 echo "$as_me: error: Mrxvt requires the X Window System libraries and headers." >&2;} { (exit 1); exit 1; }; } fi if test "x$x_includes" != "x" -a \ "x$ac_x_includes" != "x" -a \ "$x_includes" != "$ac_x_includes"; then { echo "$as_me:$LINENO: WARNING: X includes path detected differs from the supplied!" >&5 echo "$as_me: WARNING: X includes path detected differs from the supplied!" >&2;} fi if test "x$x_libraries" != "x" -a \ "x$ac_x_libraries" != "x" -a \ "$x_libraries" != "$ac_x_libraries"; then { echo "$as_me:$LINENO: WARNING: X libraries path detected differs from the supplied!" >&5 echo "$as_me: WARNING: X libraries path detected differs from the supplied!" >&2;} fi test "x$x_includes" = "x" && x_includes="$ac_x_includes" test "x$x_libraries" = "x" && x_libraries="$ac_x_libraries" test "x$x_includes" != "x" && CFLAGS="$CFLAGS -I$x_includes" test "x$x_libraries" != "x" && LDFLAGS="$LDFLAGS -L$x_libraries" test "x$x_libraries" != "x" && LIBS="$LIBS -L$x_libraries" { echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5 echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6; } if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_X11_XOpenDisplay=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_XOpenDisplay=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5 echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6; } if test $ac_cv_lib_X11_XOpenDisplay = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBX11 1 _ACEOF LIBS="-lX11 $LIBS" else { { echo "$as_me:$LINENO: error: Mrxvt requires the libX11 libraries." >&5 echo "$as_me: error: Mrxvt requires the libX11 libraries." >&2;} { (exit 1); exit 1; }; } fi if test "x$support_xim" = "xyes"; then { echo "$as_me:$LINENO: checking for XRegisterIMInstantiateCallback in -lX11" >&5 echo $ECHO_N "checking for XRegisterIMInstantiateCallback in -lX11... $ECHO_C" >&6; } if test "${ac_cv_lib_X11_XRegisterIMInstantiateCallback+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XRegisterIMInstantiateCallback (); int main () { return XRegisterIMInstantiateCallback (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_X11_XRegisterIMInstantiateCallback=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_X11_XRegisterIMInstantiateCallback=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XRegisterIMInstantiateCallback" >&5 echo "${ECHO_T}$ac_cv_lib_X11_XRegisterIMInstantiateCallback" >&6; } if test $ac_cv_lib_X11_XRegisterIMInstantiateCallback = yes; then cat >>confdefs.h <<\_ACEOF #define USE_XIM _ACEOF else support_xim=no fi fi if test "x$support_sessionmgr" = "xyes"; then { echo "$as_me:$LINENO: checking for SmcOpenConnection in -lSM" >&5 echo $ECHO_N "checking for SmcOpenConnection in -lSM... $ECHO_C" >&6; } if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSM $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SmcOpenConnection (); int main () { return SmcOpenConnection (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_SM_SmcOpenConnection=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SM_SmcOpenConnection=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SM_SmcOpenConnection" >&5 echo "${ECHO_T}$ac_cv_lib_SM_SmcOpenConnection" >&6; } if test $ac_cv_lib_SM_SmcOpenConnection = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBSM 1 _ACEOF LIBS="-lSM $LIBS" else support_sessionmgr=no fi { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; } if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBICE 1 _ACEOF LIBS="-lICE $LIBS" else support_sessionmgr=no fi fi if test "x$support_sessionmgr" = "xyes"; then SESSION_SUPPORT_TRUE= SESSION_SUPPORT_FALSE='#' else SESSION_SUPPORT_TRUE='#' SESSION_SUPPORT_FALSE= fi if test "x$support_utempter" = "xyes"; then { echo "$as_me:$LINENO: checking for utempter_add_record in -lutempter" >&5 echo $ECHO_N "checking for utempter_add_record in -lutempter... $ECHO_C" >&6; } if test "${ac_cv_lib_utempter_utempter_add_record+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutempter $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char utempter_add_record (); int main () { return utempter_add_record (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_utempter_utempter_add_record=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_utempter_utempter_add_record=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_utempter_utempter_add_record" >&5 echo "${ECHO_T}$ac_cv_lib_utempter_utempter_add_record" >&6; } if test $ac_cv_lib_utempter_utempter_add_record = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBUTEMPTER 1 _ACEOF LIBS="-lutempter $LIBS" else support_utempter=no fi fi if test "x$support_utempter" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define UTEMPTER_SUPPORT _ACEOF fi if test "x$support_xpm" = "xyes"; then { echo "$as_me:$LINENO: checking for XpmCreateImageFromXpmImage in -lXpm" >&5 echo $ECHO_N "checking for XpmCreateImageFromXpmImage in -lXpm... $ECHO_C" >&6; } if test "${ac_cv_lib_Xpm_XpmCreateImageFromXpmImage+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXpm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XpmCreateImageFromXpmImage (); int main () { return XpmCreateImageFromXpmImage (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xpm_XpmCreateImageFromXpmImage=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xpm_XpmCreateImageFromXpmImage=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmCreateImageFromXpmImage" >&5 echo "${ECHO_T}$ac_cv_lib_Xpm_XpmCreateImageFromXpmImage" >&6; } if test $ac_cv_lib_Xpm_XpmCreateImageFromXpmImage = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXPM 1 _ACEOF LIBS="-lXpm $LIBS" else support_xpm=no fi fi if test "x$support_jpeg" = "xyes"; then { echo "$as_me:$LINENO: checking for jpeg_read_header in -ljpeg" >&5 echo $ECHO_N "checking for jpeg_read_header in -ljpeg... $ECHO_C" >&6; } if test "${ac_cv_lib_jpeg_jpeg_read_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ljpeg $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char jpeg_read_header (); int main () { return jpeg_read_header (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_jpeg_jpeg_read_header=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_jpeg_jpeg_read_header=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jpeg_read_header" >&5 echo "${ECHO_T}$ac_cv_lib_jpeg_jpeg_read_header" >&6; } if test $ac_cv_lib_jpeg_jpeg_read_header = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBJPEG 1 _ACEOF LIBS="-ljpeg $LIBS" else support_jpeg=no fi fi if test "x$support_jpeg" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define USE_JPEG _ACEOF fi if test "x$support_jpeg" = "xyes"; then USE_JPEG_TRUE= USE_JPEG_FALSE='#' else USE_JPEG_TRUE='#' USE_JPEG_FALSE= fi if test "x$support_png" = "xyes"; then { echo "$as_me:$LINENO: checking for png_check_sig in -lpng" >&5 echo $ECHO_N "checking for png_check_sig in -lpng... $ECHO_C" >&6; } if test "${ac_cv_lib_png_png_check_sig+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpng -lz -lm $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char png_check_sig (); int main () { return png_check_sig (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_png_png_check_sig=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_png_png_check_sig=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_check_sig" >&5 echo "${ECHO_T}$ac_cv_lib_png_png_check_sig" >&6; } if test $ac_cv_lib_png_png_check_sig = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPNG 1 _ACEOF LIBS="-lpng $LIBS" else support_png=no fi fi if test "x$support_png" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define USE_PNG _ACEOF LIBS="$LIBS -lz -lm" fi if test "x$support_png" = "xyes"; then USE_PNG_TRUE= USE_PNG_FALSE='#' else USE_PNG_TRUE='#' USE_PNG_FALSE= fi if test "x$support_xpm" != "xyes" -a "x$support_jpeg" != "xyes" -a "x$support_png" != "xyes"; then support_background_image=no if test "x$support_transparency" = "xno"; then support_tinting=no fi fi if test "x$support_background_image" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define BACKGROUND_IMAGE _ACEOF fi if test "x$support_tinting" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define TINTING_SUPPORT _ACEOF fi if test "x$support_xrender" = "xyes" -a "x$support_tinting" = "xyes"; then { echo "$as_me:$LINENO: checking for XRenderCreatePicture in -lXrender" >&5 echo $ECHO_N "checking for XRenderCreatePicture in -lXrender... $ECHO_C" >&6; } if test "${ac_cv_lib_Xrender_XRenderCreatePicture+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXrender $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XRenderCreatePicture (); int main () { return XRenderCreatePicture (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xrender_XRenderCreatePicture=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xrender_XRenderCreatePicture=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xrender_XRenderCreatePicture" >&5 echo "${ECHO_T}$ac_cv_lib_Xrender_XRenderCreatePicture" >&6; } if test $ac_cv_lib_Xrender_XRenderCreatePicture = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXRENDER 1 _ACEOF LIBS="-lXrender $LIBS" fi fi if test "x$support_xft" = "xyes"; then OLD_LIBS="$LIBS" OLD_CFLAGS="$CFLAGS" OLD_LDFLAGS="$LDFLAGS" if which pkg-config >/dev/null 2>&1 && pkg-config --exists xft; then LIBS="$LIBS `pkg-config --libs xft`" CFLAGS="$CFLAGS `pkg-config --cflags xft`" LDFLAGS="$LDFLAGS `pkg-config --libs xft`" else if which xft-config >/dev/null 2>&1; then LIBS="$LIBS `xft-config --libs`" CFLAGS="$CFLAGS `xft-config --cflags`" LDFLAGS="$LDFLAGS `xft-config --libs`" else support_xft="no" fi fi if test "x$local_os_type" = "xsolaris"; then CFLAGS="$CFLAGS -I/usr/sfw/include -I/usr/sfw/include/freetype2" fi for ac_header in fontconfig/fontconfig.h X11/Xft/Xft.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else support_xft=no fi done { echo "$as_me:$LINENO: checking for FcPatternAddInteger in -lfontconfig" >&5 echo $ECHO_N "checking for FcPatternAddInteger in -lfontconfig... $ECHO_C" >&6; } if test "${ac_cv_lib_fontconfig_FcPatternAddInteger+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfontconfig $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char FcPatternAddInteger (); int main () { return FcPatternAddInteger (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_fontconfig_FcPatternAddInteger=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fontconfig_FcPatternAddInteger=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_fontconfig_FcPatternAddInteger" >&5 echo "${ECHO_T}$ac_cv_lib_fontconfig_FcPatternAddInteger" >&6; } if test $ac_cv_lib_fontconfig_FcPatternAddInteger = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBFONTCONFIG 1 _ACEOF LIBS="-lfontconfig $LIBS" else support_xft=no fi { echo "$as_me:$LINENO: checking for XftDrawString16 in -lXft" >&5 echo $ECHO_N "checking for XftDrawString16 in -lXft... $ECHO_C" >&6; } if test "${ac_cv_lib_Xft_XftDrawString16+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXft $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XftDrawString16 (); int main () { return XftDrawString16 (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_Xft_XftDrawString16=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_Xft_XftDrawString16=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftDrawString16" >&5 echo "${ECHO_T}$ac_cv_lib_Xft_XftDrawString16" >&6; } if test $ac_cv_lib_Xft_XftDrawString16 = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBXFT 1 _ACEOF LIBS="-lXft $LIBS" else support_xft=no fi if test "x$support_xft x$support_cjk" = "xyes xyes"; then { echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5 echo $ECHO_N "checking for iconv_open in -liconv... $ECHO_C" >&6; } if test "${ac_cv_lib_iconv_iconv_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-liconv $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char iconv_open (); int main () { return iconv_open (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_iconv_iconv_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_iconv_iconv_open=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5 echo "${ECHO_T}$ac_cv_lib_iconv_iconv_open" >&6; } if test $ac_cv_lib_iconv_iconv_open = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBICONV 1 _ACEOF LIBS="-liconv $LIBS" fi if test "x$local_os_type" = "xdarwin"; then LIBS="$LIBS -liconv" fi if test "x$local_os_type" = "xcygwin"; then LIBS="$LIBS -liconv" fi if test "x$local_os_type" = "xopenbsd"; then LIBS="$LIBS -liconv" fi fi if test "x$support_xft" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define XFT_SUPPORT _ACEOF else LIBS="$OLD_LIBS" CFLAGS="$OLD_CFLAGS" LDFLAGS="$OLD_LDFLAGS" fi fi if test "x$support_xft" = "xyes"; then XFT_SUPPORT_TRUE= XFT_SUPPORT_FALSE='#' else XFT_SUPPORT_TRUE='#' XFT_SUPPORT_FALSE= fi if test "x$support_cjk" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define MULTICHAR_SET _ACEOF cat >>confdefs.h <<_ACEOF #define MULTICHAR_ENCODING "$encoding_option" _ACEOF fi { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi { echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; } if test "${ac_cv_header_sys_wait_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifndef WEXITSTATUS # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) #endif #ifndef WIFEXITED # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_sys_wait_h=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; } if test $ac_cv_header_sys_wait_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_WAIT_H 1 _ACEOF fi for ac_header in stdlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in sys/socket.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in \ arpa/inet.h \ assert.h \ fcntl.h \ iconv.h \ lastlog.h \ limits.h \ locale.h \ langinfo.h \ netinet/in.h \ pty.h \ sgtty.h \ stdarg.h \ stdlib.h \ string.h \ sys/byteorder.h \ sys/ioctl.h \ sys/select.h \ sys/sockio.h \ sys/stropts.h \ sys/strredir.h \ sys/stat.h \ sys/time.h \ sys/times.h \ sys/types.h \ sys/wait.h \ time.h \ termios.h \ unistd.h \ utmp.h \ utmpx.h \ wordexp.h \ wchar.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------- ## ## Report this to jimmyzhou@users.sourceforge.net ## ## ---------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "x$support_sessionmgr" = "xyes"; then for ac_header in X11/SM/SMlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------- ## ## Report this to jimmyzhou@users.sourceforge.net ## ## ---------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi for ac_header in net/if.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #if HAVE_SYS_SOCKET_H # include #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in net/if_arp.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #if HAVE_SYS_SOCKET_H # include #endif #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { echo "$as_me:$LINENO: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6; } if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_inline=$ac_kw else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } if test "${ac_cv_struct_tm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 echo "${ECHO_T}$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF #define TM_IN_SYS_TIME 1 _ACEOF fi { echo "$as_me:$LINENO: checking for mode_t" >&5 echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; } if test "${ac_cv_type_mode_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef mode_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_mode_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_mode_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 echo "${ECHO_T}$ac_cv_type_mode_t" >&6; } if test $ac_cv_type_mode_t = yes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi { echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; } if test "${ac_cv_type_uid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 echo "${ECHO_T}$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF #define uid_t int _ACEOF cat >>confdefs.h <<\_ACEOF #define gid_t int _ACEOF fi { echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef pid_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi { echo "$as_me:$LINENO: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF { echo "$as_me:$LINENO: checking for working nl_langinfo" >&5 echo $ECHO_N "checking for working nl_langinfo... $ECHO_C" >&6; } if test "${rxvt_cv_func_nl_langinfo+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { nl_langinfo(CODESET); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then rxvt_cv_func_nl_langinfo=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_func_nl_langinfo=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_func_nl_langinfo" >&5 echo "${ECHO_T}$rxvt_cv_func_nl_langinfo" >&6; } if test "x$rxvt_cv_func_nl_langinfo" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_NL_LANGINFO 1 _ACEOF fi { echo "$as_me:$LINENO: checking for XPointer" >&5 echo $ECHO_N "checking for XPointer... $ECHO_C" >&6; } if test "${rxvt_cv_xpointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XPointer dummy; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_xpointer=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_xpointer=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_xpointer" >&5 echo "${ECHO_T}$rxvt_cv_xpointer" >&6; } if test "x$rxvt_cv_xpointer" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_XPOINTER 1 _ACEOF fi if test "x$support_utmp" = "xyes"; then { echo "$as_me:$LINENO: checking for struct utmp" >&5 echo $ECHO_N "checking for struct utmp... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmp ut; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmp=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmp" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmp" >&6; } if test "x$rxvt_cv_struct_utmp" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_UTMP 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ut_host in utmp struct" >&5 echo $ECHO_N "checking for ut_host in utmp struct... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmp_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmp ut; ut.ut_host; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmp_host=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmp_host=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmp_host" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmp_host" >&6; } if test "x$rxvt_cv_struct_utmp_host" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_UTMP_HOST 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ut_pid in utmp struct" >&5 echo $ECHO_N "checking for ut_pid in utmp struct... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmp_pid+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmp ut; ut.ut_pid; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmp_pid=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmp_pid=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmp_pid" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmp_pid" >&6; } if test "x$rxvt_cv_struct_utmp_pid" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_UTMP_PID 1 _ACEOF fi { echo "$as_me:$LINENO: checking for struct utmpx" >&5 echo $ECHO_N "checking for struct utmpx... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmpx+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmpx ut; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmpx=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmpx=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmpx" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmpx" >&6; } if test "x$rxvt_cv_struct_utmpx" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_UTMPX 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ut_host in utmpx struct" >&5 echo $ECHO_N "checking for ut_host in utmpx struct... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmpx_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmpx utx; utx.ut_host; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmpx_host=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmpx_host=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmpx_host" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmpx_host" >&6; } if test "x$rxvt_cv_struct_utmpx_host" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_UTMPX_HOST 1 _ACEOF fi { echo "$as_me:$LINENO: checking for ut_session in utmpx struct" >&5 echo $ECHO_N "checking for ut_session in utmpx struct... $ECHO_C" >&6; } if test "${rxvt_cv_struct_utmpx_session+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct utmpx utx; utx.ut_session; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_utmpx_session=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_utmpx_session=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_utmpx_session" >&5 echo "${ECHO_T}$rxvt_cv_struct_utmpx_session" >&6; } if test "x$rxvt_cv_struct_utmpx_session" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_UTMPX_SESSION 1 _ACEOF fi fi if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then { echo "$as_me:$LINENO: checking for struct lastlog" >&5 echo $ECHO_N "checking for struct lastlog... $ECHO_C" >&6; } if test "${rxvt_cv_struct_lastlog+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #ifdef HAVE_LASTLOG_H #include #endif int main () { struct lastlog ll; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then rxvt_cv_struct_lastlog=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 rxvt_cv_struct_lastlog=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $rxvt_cv_struct_lastlog" >&5 echo "${ECHO_T}$rxvt_cv_struct_lastlog" >&6; } if test "x$rxvt_cv_struct_lastlog" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_STRUCT_LASTLOG 1 _ACEOF fi fi { echo "$as_me:$LINENO: checking for char" >&5 echo $ECHO_N "checking for char... $ECHO_C" >&6; } if test "${ac_cv_type_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_char=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_char=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5 echo "${ECHO_T}$ac_cv_type_char" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of char" >&5 echo $ECHO_N "checking size of char... $ECHO_C" >&6; } if test "${ac_cv_sizeof_char+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_char=$ac_lo;; '') if test "$ac_cv_type_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_char=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef char ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_char=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_char" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (char) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (char) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_char=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5 echo "${ECHO_T}$ac_cv_sizeof_char" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_CHAR $ac_cv_sizeof_char _ACEOF { echo "$as_me:$LINENO: checking for short" >&5 echo $ECHO_N "checking for short... $ECHO_C" >&6; } if test "${ac_cv_type_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_short=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_short=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 echo "${ECHO_T}$ac_cv_type_short" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of short" >&5 echo $ECHO_N "checking size of short... $ECHO_C" >&6; } if test "${ac_cv_sizeof_short+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef short ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_short" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 echo "${ECHO_T}$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF { echo "$as_me:$LINENO: checking for int" >&5 echo $ECHO_N "checking for int... $ECHO_C" >&6; } if test "${ac_cv_type_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 echo "${ECHO_T}$ac_cv_type_int" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of int" >&5 echo $ECHO_N "checking size of int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF { echo "$as_me:$LINENO: checking for long" >&5 echo $ECHO_N "checking for long... $ECHO_C" >&6; } if test "${ac_cv_type_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 echo "${ECHO_T}$ac_cv_type_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long" >&5 echo $ECHO_N "checking size of long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF { echo "$as_me:$LINENO: checking for long long" >&5 echo $ECHO_N "checking for long long... $ECHO_C" >&6; } if test "${ac_cv_type_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_long_long=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_long_long=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 echo "${ECHO_T}$ac_cv_type_long_long" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of long long" >&5 echo $ECHO_N "checking size of long long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef long long ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_long" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF { echo "$as_me:$LINENO: checking for int *" >&5 echo $ECHO_N "checking for int *... $ECHO_C" >&6; } if test "${ac_cv_type_int_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_int_p=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_int_p=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_type_int_p" >&5 echo "${ECHO_T}$ac_cv_type_int_p" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { echo "$as_me:$LINENO: checking size of int *" >&5 echo $ECHO_N "checking size of int *... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int_p+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=0 ac_mid=0 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=-1 ac_mid=-1 while :; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi ac_mid=`expr 2 '*' $ac_mid` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; int main () { static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in ?*) ac_cv_sizeof_int_p=$ac_lo;; '') if test "$ac_cv_type_int_p" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int *) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int *) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int_p=0 fi ;; esac else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default typedef int * ac__type_sizeof_; static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; fprintf (f, "%lu\n", i); } return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int_p=`cat conftest.val` else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int_p" = yes; then { { echo "$as_me:$LINENO: error: cannot compute sizeof (int *) See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute sizeof (int *) See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } else ac_cv_sizeof_int_p=0 fi fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi { echo "$as_me:$LINENO: result: $ac_cv_sizeof_int_p" >&5 echo "${ECHO_T}$ac_cv_sizeof_int_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT_P $ac_cv_sizeof_int_p _ACEOF if test $ac_cv_sizeof_char -ge 2; then RINT16T=char cat >>confdefs.h <<\_ACEOF #define RINT16T char _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT16T unsigned char _ACEOF else if test $ac_cv_sizeof_short -ge 2; then RINT16T=short cat >>confdefs.h <<\_ACEOF #define RINT16T short _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT16T unsigned short _ACEOF else if test $ac_cv_sizeof_int -ge 2; then RINT16T=int cat >>confdefs.h <<\_ACEOF #define RINT16T int _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT16T unsigned int _ACEOF else RINT16T=long cat >>confdefs.h <<\_ACEOF #define RINT16T long _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT16T unsigned long _ACEOF fi fi fi if test $ac_cv_sizeof_char -ge 4; then RINT32T=char cat >>confdefs.h <<\_ACEOF #define RINT32T char _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT32T unsigned char _ACEOF else if test $ac_cv_sizeof_short -ge 4; then RINT32T=short cat >>confdefs.h <<\_ACEOF #define RINT32T short _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT32T unsigned short _ACEOF else if test $ac_cv_sizeof_int -ge 4; then RINT32T=int cat >>confdefs.h <<\_ACEOF #define RINT32T int _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT32T unsigned int _ACEOF else RINT32T=long cat >>confdefs.h <<\_ACEOF #define RINT32T long _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINT32T unsigned long _ACEOF fi fi fi if test $ac_cv_sizeof_char -eq $ac_cv_sizeof_int_p; then RINTPT=char cat >>confdefs.h <<\_ACEOF #define RINTPT char _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINTPT unsigned char _ACEOF else if test $ac_cv_sizeof_short -eq $ac_cv_sizeof_int_p; then RINTPT=short cat >>confdefs.h <<\_ACEOF #define RINTPT short _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINTPT unsigned short _ACEOF else if test $ac_cv_sizeof_int -eq $ac_cv_sizeof_int_p; then RINTPT=int cat >>confdefs.h <<\_ACEOF #define RINTPT int _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINTPT unsigned int _ACEOF else RINTPT=long cat >>confdefs.h <<\_ACEOF #define RINTPT long _ACEOF cat >>confdefs.h <<\_ACEOF #define RUINTPT unsigned long _ACEOF fi fi fi for ac_header in unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------- ## ## Report this to jimmyzhou@users.sourceforge.net ## ## ---------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for working chown" >&5 echo $ECHO_N "checking for working chown... $ECHO_C" >&6; } if test "${ac_cv_func_chown_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_chown_works=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include int main () { char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) return 1; if (stat (f, &before) < 0) return 1; if (chown (f, (uid_t) -1, (gid_t) -1) == -1) return 1; if (stat (f, &after) < 0) return 1; return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_chown_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_chown_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.chown fi { echo "$as_me:$LINENO: result: $ac_cv_func_chown_works" >&5 echo "${ECHO_T}$ac_cv_func_chown_works" >&6; } if test $ac_cv_func_chown_works = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_CHOWN 1 _ACEOF fi for ac_header in vfork.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ---------------------------------------------- ## ## Report this to jimmyzhou@users.sourceforge.net ## ## ---------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in fork vfork do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_fork" = xyes; then { echo "$as_me:$LINENO: checking for working fork" >&5 echo $ECHO_N "checking for working fork... $ECHO_C" >&6; } if test "${ac_cv_func_fork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_fork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5 echo "${ECHO_T}$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { echo "$as_me:$LINENO: checking for working vfork" >&5 echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; } if test "${ac_cv_func_vfork_works+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_vfork_works=cross else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_vfork_works=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_vfork_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5 echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_VFORK 1 _ACEOF else cat >>confdefs.h <<\_ACEOF #define vfork fork _ACEOF fi if test "x$ac_cv_func_fork_works" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_WORKING_FORK 1 _ACEOF fi if test $ac_cv_c_compiler_gnu = yes; then { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; } if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6; } if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then ac_cv_func_lstat_dereferences_slashed_symlink=no else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_lstat_dereferences_slashed_symlink=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { echo "$as_me:$LINENO: checking whether lstat accepts an empty string" >&5 echo $ECHO_N "checking whether lstat accepts an empty string... $ECHO_C" >&6; } if test "${ac_cv_func_lstat_empty_string_bug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_func_lstat_empty_string_bug=yes else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return lstat ("", &sbuf) == 0; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_lstat_empty_string_bug=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_lstat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_lstat_empty_string_bug" >&5 echo "${ECHO_T}$ac_cv_func_lstat_empty_string_bug" >&6; } if test $ac_cv_func_lstat_empty_string_bug = yes; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_LSTAT_EMPTY_STRING_BUG 1 _ACEOF fi { echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5 echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6; } if test "${ac_cv_func_setpgrp_void+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5 echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { /* If this system has a BSD-style setpgrp which takes arguments, setpgrp(1, 1) will fail with ESRCH and return -1, in that case exit successfully. */ return setpgrp (1,1) != -1; ; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setpgrp_void=no else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_setpgrp_void=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi { echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5 echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6; } if test $ac_cv_func_setpgrp_void = yes; then cat >>confdefs.h <<\_ACEOF #define SETPGRP_VOID 1 _ACEOF fi for ac_func in vprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF { echo "$as_me:$LINENO: checking for _doprnt" >&5 echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; } if test "${ac_cv_func__doprnt+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define _doprnt to an innocuous variant, in case declares _doprnt. For example, HP-UX 11i declares gettimeofday. */ #define _doprnt innocuous__doprnt /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef _doprnt /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char _doprnt (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub__doprnt || defined __stub____doprnt choke me #endif int main () { return _doprnt (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_func__doprnt=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func__doprnt=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 echo "${ECHO_T}$ac_cv_func__doprnt" >&6; } if test $ac_cv_func__doprnt = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_DOPRNT 1 _ACEOF fi fi done for ac_func in getcwd \ getpt \ _getpty \ getpwuid \ grantpt \ isastream \ nanosleep \ openpty \ putenv \ revoke \ select \ setlocale \ seteuid \ setpgrp \ setpgid \ setreuid \ setsid \ setutent \ socket \ strcasestr \ strchr \ strdup \ strndup \ strrchr \ ttyslot \ unlockpt \ unsetenv \ updwtmp \ updwtmpx \ xsetlocale \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done if test "x$ac_cv_func_openpty" = "xyes"; then rxvt_cv_ptys=OPENPTY else if test "x$ac_cv_func__getpty" = "xyes"; then rxvt_cv_ptys=SGI4 else if test -c /dev/ttyp20; then rxvt_cv_ptys=SCO else if test -c /dev/ptym/clone; then rxvt_cv_ptys=HPUX else if test "x$ac_cv_func_getpt" = "xyes"; then rxvt_cv_ptys=GLIBC else if test -c /dev/ptc -a -c /dev/pts; then rxvt_cv_ptys=PTC else if test -c /dev/ptc -a -d /dev/pts; then rxvt_cv_ptys=PTC else if test -c /dev/ptmx -a -c /dev/pts/0; then rxvt_cv_ptys=STREAMS else if test "x$ac_cv_func_grantpt x$ac_cv_func_unlockpt" = "xyes xyes"; then rxvt_cv_ptys=STREAMS else rxvt_cv_ptys=BSD fi fi fi fi fi fi fi fi fi if test "x$rxvt_cv_ptys" = "xOPENPTY"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_OPENPTY 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xSCO"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_NUMERIC 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xSTREAMS"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_PTMX 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xPTC"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_PTC 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xSGI4"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE__GETPTY 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xCONVEX"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_GETPTY 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xGLIBC"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_GETPT 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xHPUX"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_CLONE 1 _ACEOF fi if test "x$rxvt_cv_ptys" = "xBSD" -o "x$rxvt_cv_ptys" = "xHPUX" -o "x$rxvt_cv_ptys" = "xGLIBC"; then cat >>confdefs.h <<\_ACEOF #define PTYS_ARE_SEARCHED 1 _ACEOF fi { echo "$as_me:$LINENO: checking for pty ranges..." >&5 echo "$as_me: checking for pty ranges..." >&6;} ptys=`echo /dev/pty??` pch1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` pch2=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` if test x$pch1 != x; then cat >>confdefs.h <<_ACEOF #define PTYCHAR1 "$pch1" _ACEOF fi if test x$pch2 != x; then cat >>confdefs.h <<_ACEOF #define PTYCHAR2 "$pch2" _ACEOF fi ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile share/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${RXVT_SCROLLBAR_TRUE}" && test -z "${RXVT_SCROLLBAR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"RXVT_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"RXVT_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${NEXT_SCROLLBAR_TRUE}" && test -z "${NEXT_SCROLLBAR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"NEXT_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"NEXT_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${XTERM_SCROLLBAR_TRUE}" && test -z "${XTERM_SCROLLBAR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"XTERM_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"XTERM_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${PLAIN_SCROLLBAR_TRUE}" && test -z "${PLAIN_SCROLLBAR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"PLAIN_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"PLAIN_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${SGI_SCROLLBAR_TRUE}" && test -z "${SGI_SCROLLBAR_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"SGI_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"SGI_SCROLLBAR\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${UTMP_SUPPORT_TRUE}" && test -z "${UTMP_SUPPORT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"UTMP_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"UTMP_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${GREEK_TRUE}" && test -z "${GREEK_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"GREEK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"GREEK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${SESSION_SUPPORT_TRUE}" && test -z "${SESSION_SUPPORT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"SESSION_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"SESSION_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_JPEG_TRUE}" && test -z "${USE_JPEG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_JPEG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_JPEG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${USE_PNG_TRUE}" && test -z "${USE_PNG_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"USE_PNG\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"USE_PNG\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${XFT_SUPPORT_TRUE}" && test -z "${XFT_SUPPORT_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"XFT_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"XFT_SUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by mrxvt $as_me 0.5.4, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ mrxvt config.status 0.5.4 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "share/Makefile") CONFIG_FILES="$CONFIG_FILES share/Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim MAINT!$MAINT$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim RXVT_SCROLLBAR_TRUE!$RXVT_SCROLLBAR_TRUE$ac_delim RXVT_SCROLLBAR_FALSE!$RXVT_SCROLLBAR_FALSE$ac_delim NEXT_SCROLLBAR_TRUE!$NEXT_SCROLLBAR_TRUE$ac_delim NEXT_SCROLLBAR_FALSE!$NEXT_SCROLLBAR_FALSE$ac_delim XTERM_SCROLLBAR_TRUE!$XTERM_SCROLLBAR_TRUE$ac_delim XTERM_SCROLLBAR_FALSE!$XTERM_SCROLLBAR_FALSE$ac_delim PLAIN_SCROLLBAR_TRUE!$PLAIN_SCROLLBAR_TRUE$ac_delim PLAIN_SCROLLBAR_FALSE!$PLAIN_SCROLLBAR_FALSE$ac_delim SGI_SCROLLBAR_TRUE!$SGI_SCROLLBAR_TRUE$ac_delim SGI_SCROLLBAR_FALSE!$SGI_SCROLLBAR_FALSE$ac_delim UTMP_SUPPORT_TRUE!$UTMP_SUPPORT_TRUE$ac_delim UTMP_SUPPORT_FALSE!$UTMP_SUPPORT_FALSE$ac_delim GREEK_TRUE!$GREEK_TRUE$ac_delim GREEK_FALSE!$GREEK_FALSE$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim XMKMF!$XMKMF$ac_delim CPP!$CPP$ac_delim SESSION_SUPPORT_TRUE!$SESSION_SUPPORT_TRUE$ac_delim SESSION_SUPPORT_FALSE!$SESSION_SUPPORT_FALSE$ac_delim USE_JPEG_TRUE!$USE_JPEG_TRUE$ac_delim USE_JPEG_FALSE!$USE_JPEG_FALSE$ac_delim USE_PNG_TRUE!$USE_PNG_TRUE$ac_delim USE_PNG_FALSE!$USE_PNG_FALSE$ac_delim XFT_SUPPORT_TRUE!$XFT_SUPPORT_TRUE$ac_delim XFT_SUPPORT_FALSE!$XFT_SUPPORT_FALSE$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 17; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. _am_arg=$ac_file _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi echo echo echo "Configurations:" echo echo echo "Maintenance:" echo "Debug mode : $support_debug" echo "Private string functions : $support_ourstrings" echo "Rarely used features : $support_frills" echo echo "Scroll features:" echo "Keep scroll : $support_keepscrolling" echo "Scroll on selection : $support_selectionscrolling" echo "Mouse wheel scroll : $support_mousewheel" if test "x$support_mousewheel" = "xyes"; then echo "Slip mouse wheel scroll : $support_mouseslipwheel" fi if test "x$support_scroll" = "xyes"; then echo "RXVT style scrollbar : $support_scroll_rxvt" echo "NeXT style scrollbar : $support_scroll_next" echo "Xterm style scrollbar : $support_scroll_xterm" echo "Plain style scrollbar : $support_scroll_plain" echo "SGI IRIX style scrollbar : $support_scroll_sgi" if test "x$support_scroll_rxvt" = "xyes"; then echo "Half shadow scrollbar : $support_half_shadow" fi fi echo echo "Logging features:" echo "Support utmp records : $support_utmp" echo "Support wtmp records : $support_wtmp" echo "Support lastlog records : $support_lastlog" echo "Support X session manager : $support_sessionmgr" echo "Use utempter library : $support_utempter" echo echo "Visual features:" echo "Support line space : $support_linespace" echo "24 bits color mode : $support_24bits" echo "256 color mode : $support_256colors" echo "Blink cursor : $support_cursor_blink" echo "Blank pointer : $support_pointer_blank" echo "Color text shadow : $support_text_shadow" echo "Smart resize : $support_smart_resize" echo "Menu bar : $support_menubar" echo echo "Background features:" echo "Background image : $support_background_image" echo "XPM background image : $support_xpm" echo "JPEG background image : $support_jpeg" echo "PNG background image : $support_png" echo "Transparent background : $support_transparency" if test "x$support_tinting" = "xno"; then echo "Background tinting : $support_tinting" else if test "x$support_xrender" = "xyes"; then echo "Background tinting : $support_tinting (XRender)" else echo "Background tinting : $support_tinting (Fast)" fi fi echo echo "Multi-language and font features:" echo "Freetype Font : $support_xft" echo "X Input Method : $support_xim" echo "Greek keyboard : $support_greek" echo "CJK multichar language : $support_cjk" if test "x$support_cjk" = "xyes"; then echo "Default encoding method : $encoding_option" fi echo echo "System features:" echo "TTY/PTY type : $rxvt_cv_ptys" echo "TTY gid : $support_ttygid" echo "Backspace key : $support_backspace_key" echo "Delete key : $support_delete_key" echo "Use fifo : $use_fifo" echo "X resources : $support_resources" echo "X default resources : $support_xgetdefault" echo "Swap screen : $support_swapscreen" echo "Old selection : $support_old_selection" echo echo "Options:" echo "Terminal name : $term_name_option" echo "Maximal profiles : $max_prof_option" echo "Maximal tabs : $max_term_option" echo "Extra height% of active tab : $atab_extra_option" echo "Radius% of tab corners : $tab_radius_option" if test "x$support_linespace" = "xyes"; then echo "Line space : $line_space_option" fi if test "x$support_frills" = "xyes"; then echo "Internal border width : $int_border_option" echo "External border width : $ext_border_option" fi if test "x$support_scroll" = "xyes"; then echo "Saved lines in scroll : $save_lines_option" fi echo mrxvt-0.5.4/configure.ac0000644000175000001440000012461011012076264012106 00000000000000dnl# All portions of code are copyright by their respective author/s. dnl# dnl# Copyright (c) 1998-2001 Geoff Wing dnl# Copyright (c) 2003-2004 Marc Lehmann dnl# Copyright (c) 2004 Hiramatsu Yoshifumi dnl# Copyright (c) 2004-2006 Jingmin Zhou dnl# Copyright (c) 2006 Gautam Iyer dnl# Copyright (c) 2007 Jehan Hysseo dnl# dnl# This program is free software; you can redistribute it and/or dnl# modify it under the terms of the GNU General Public License as dnl# published by the Free Software Foundation; either version 2 of dnl# the License, or (at your option) any later version. dnl# dnl# This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. dnl# dnl 2006-02-20 gi1242: If the version contains a letter, then it sometimes dnl produces spurious results when programs use an escape sequence to query the dnl terminal version. AC_INIT(mrxvt, 0.5.4, [jimmyzhou@users.sourceforge.net]) AM_INIT_AUTOMAKE(mrxvt, 0.5.4) AM_CONFIG_HEADER(config.h) AC_CONFIG_SRCDIR([src/main.c]) AM_MAINTAINER_MODE dnl Check OS AC_CANONICAL_HOST local_os_type="unknown" case "$host" in *-cygwin*) AC_DEFINE(OS_CYGWIN, [], [set OS to cygwin]) local_os_type="cygwin" ;; *-linux*) AC_DEFINE(OS_LINUX, [], [set OS to linux]) dnl hack for some 64-bit systems AC_DEFINE(_GNU_SOURCE, [], [set GNU source flag for linux]) local_os_type="linux" ;; *-irix*) AC_DEFINE(OS_IRIX, [], [set OS to irix]) local_os_type="irix" ;; *-sunos*) AC_DEFINE(OS_SUNOS, [], [set OS to sunos]) local_os_type="sunos" ;; *-solaris*) AC_DEFINE(OS_SOLARIS, [], [set OS to solaris]) local_os_type="solaris" ;; *-aix*) AC_DEFINE(OS_AIX, [], [set OS to aix]) local_os_type="aix" ;; *-hpux*) AC_DEFINE(OS_HPUX, [], [set OS to hp-ux]) local_os_type="hpux" ;; *-freebsd*) AC_DEFINE(OS_BSD, [], [set OS to bsd]) AC_DEFINE(OS_FREEBSD, [], [set OS to freebsd]) local_os_type="freebsd" dnl our hack for freebsd system CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-netbsd*) AC_DEFINE(OS_BSD, [], [set OS to bsd]) AC_DEFINE(OS_NETBSD, [], [set OS to netbsd]) local_os_type="netbsd" dnl our hack for netbsd system CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-openbsd*) AC_DEFINE(OS_BSD, [], [set OS to bsd]) AC_DEFINE(OS_OPENBSD, [], [set OS to openbsd]) local_os_type="openbsd" dnl get openbsd release number, remove `.' from release number OBSD_REL=`/usr/bin/uname -r | sed 's/\.//g'` AC_DEFINE_UNQUOTED(OS_OPENBSD_REL, ${OBSD_REL}, [set openbsd release number]) dnl our hack for openbsd system CFLAGS="$CFLAGS -I/usr/local/include" LIBS="$LIBS -L/usr/local/lib" ;; *-osf*) AC_DEFINE(OS_OSF, [], [set OS to osf]) local_os_type="osf" ;; *-darwin*) AC_DEFINE(OS_BSD, [], [set OS to bsd]) AC_DEFINE(OS_DARWIN, [], [set OS to darwin]) local_os_type="darwin" ;; *-sco*) AC_DEFINE(OS_SCO, [], [set OS to sco]) AC_DEFINE(OS_SVR4, [], [set OS to svr4]) local_os_type="sco" AC_MSG_ERROR([Mrxvt does not support f*cking SCO's products!]) esac dnl Configuration options support_everything=no support_minimal=no support_debug=no support_ourstrings=no support_frills=yes support_keepscrolling=yes support_selectionscrolling=yes support_mousewheel=yes support_mouseslipwheel=no support_scroll_rxvt=yes support_scroll_next=yes support_scroll_xterm=yes support_scroll_plain=yes support_scroll_sgi=yes support_half_shadow=yes support_utmp=yes support_wtmp=yes support_lastlog=yes support_sessionmgr=yes support_utempter=no support_linespace=yes support_24bits=no support_256colors=yes support_cursor_blink=yes support_pointer_blank=yes support_text_shadow=no support_smart_resize=no support_menubar=no support_background_image=yes support_transparency=yes dnl: support_fading=yes support_tinting=yes support_xrender=yes support_xpm=yes support_jpeg=yes support_png=yes support_xft=no support_xim=no support_greek=no support_cjk=no support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=yes support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no AC_ARG_ENABLE( everything, AC_HELP_STRING([--enable-everything],[enable all options [[no]]]), [support_everything=$enableval], [support_everything=no] ) if test "x$support_everything" = "xyes"; then support_debug=yes support_ourstrings=no support_frills=yes support_keepscrolling=yes support_selectionscrolling=yes support_mousewheel=yes support_mouseslipwheel=yes support_scroll_rxvt=yes support_scroll_next=yes support_scroll_sgi=yes support_scroll_xterm=yes support_scroll_plain=yes support_half_shadow=yes support_utmp=yes support_wtmp=yes support_lastlog=yes support_sessionmgr=yes support_utempter=yes support_linespace=yes support_24bits=yes support_256colors=yes support_cursor_blink=yes support_pointer_blank=yes support_text_shadow=yes support_smart_resize=yes support_menubar=yes support_background_image=yes support_transparency=yes dnl: support_fading=yes support_tinting=yes support_xrender=yes support_xpm=yes support_jpeg=yes support_png=yes support_xft=yes support_xim=yes support_greek=yes support_cjk=yes support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=yes support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no fi AC_ARG_ENABLE( minimal, AC_HELP_STRING([--enable-minimal],[enable minimal options [[no]]]), [support_minimal=$enableval], [support_minimal=no] ) if test "x$support_minimal" = "xyes"; then support_debug=no support_ourstrings=no support_frills=no support_keepscrolling=no support_selectionscrolling=no support_mousewheel=no support_mouseslipwheel=no support_scroll_rxvt=no support_scroll_next=no support_scroll_sgi=no support_scroll_xterm=yes support_scroll_plain=no support_half_shadow=no support_utmp=no support_wtmp=no support_lastlog=no support_sessionmgr=no support_utempter=no support_linespace=no support_24bits=no support_256colors=no support_cursor_blink=no support_pointer_blank=no support_text_shadow=no support_smart_resize=no support_menubar=no support_background_image=no support_transparency=no dnl: support_fading=no support_tinting=no support_xrender=no support_xpm=no support_jpeg=no support_png=no support_xft=no support_xim=no support_greek=no support_cjk=no support_ttygid=yes support_backspace_key=yes support_delete_key=yes use_fifo=no support_resources=yes support_xgetdefault=no support_swapscreen=yes support_old_selection=no fi AC_ARG_ENABLE( debug, AC_HELP_STRING([--enable-debug],[enable debug mode - for developper [[no]]]), [support_debug=$enableval] ) if test "x$support_debug" = "xyes"; then AC_DEFINE(DEBUG, [], [set DEBUG mode]) CFLAGS="$CFLAGS -g" else AC_DEFINE(NDEBUG, [], [unset DEBUG mode]) fi AC_ARG_ENABLE( ourstrings, AC_HELP_STRING([--enable-ourstrings],[enable our strings functions [[no]]]), [support_ourstrings=$enableval] ) if test "x$support_ourstrings" = "xyes"; then AC_DEFINE(OUR_STRINGS, [], [use our own string functions]) fi AC_ARG_ENABLE( frills, AC_HELP_STRING([--enable-frills],[enable internal borders / smart resizing [[yes]]]), [support_frills=$enableval] ) if test "x$support_frills" != "xyes"; then AC_DEFINE(NO_FRILLS, [], [enable internal borders / smart resizing]) fi AC_ARG_ENABLE( keepscrolling, AC_HELP_STRING([--enable-keepscrolling],[enable continual scrolling on scrollbar arrow press [[yes]]]), [support_keepscrolling=$enableval] ) if test "x$support_keepscrolling" != "xyes"; then AC_DEFINE(NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING, [], [enable continual scrolling on scrollbar arrow press]) fi AC_ARG_ENABLE( selectionscrolling, AC_HELP_STRING([--enable-selectionscrolling],[enable continual scrolling on selection [[yes]]]), [support_selectionscrolling=$enableval] ) if test "x$support_selectionscrolling" = "xyes"; then AC_DEFINE(SELECTION_SCROLLING, [], [enable continual scrolling on selection]) fi AC_ARG_ENABLE( mousewheel, AC_HELP_STRING([--enable-mousewheel],[enable scrolling via mouse wheel or buttons 4 & 5 [[yes]]]), [support_mousewheel=$enableval] ) if test "x$support_mousewheel" = "xyes"; then AC_DEFINE(MOUSE_WHEEL, [], [enable scrolling via mouse wheel]) fi AC_ARG_ENABLE( mouseslipwheel, AC_HELP_STRING([--enable-mouseslipwheel],[enable slip scrolling via mouse wheel or buttons 4 & 5 [[no]]]), [support_mouseslipwheel=$enableval] ) if test "x$support_mousewheel x$support_mouseslipwheel" = "xyes xyes"; then AC_DEFINE(MOUSE_SLIP_WHEELING, [], [enable slip scrolling via mouse wheel]) fi AC_ARG_ENABLE( rxvt-scroll, AC_HELP_STRING([--enable-rxvt-scroll],[enable rxvt style scrollbar [[yes]]]), [support_scroll_rxvt=$enableval] ) if test "x$support_scroll_rxvt" = "xyes"; then AC_DEFINE(RXVT_SCROLLBAR, [], [set rxvt style scroll bar]) AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support]) support_scroll="yes" fi AC_ARG_ENABLE( next-scroll, AC_HELP_STRING([--enable-next-scroll],[enable NeXT style scrollbar [[yes]]]), [support_scroll_next=$enableval] ) if test "x$support_scroll_next" = "xyes"; then AC_DEFINE(NEXT_SCROLLBAR, [], [set next style scroll bar]) AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support]) support_scroll="yes" fi AC_ARG_ENABLE( xterm-scroll, AC_HELP_STRING([--enable-xterm-scroll],[enable Xterm style scrollbar [[yes]]]), [support_scroll_xterm=$enableval] ) if test "x$support_scroll_xterm" = "xyes"; then AC_DEFINE(XTERM_SCROLLBAR, [], [set xterm style scroll bar]) AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support]) support_scroll="yes" fi AC_ARG_ENABLE( plain-scroll, AC_HELP_STRING([--enable-plain-scroll],[enable plain style scrollbar [[yes]]]), [support_scroll_plain=$enableval] ) if test "x$support_scroll_plain" = "xyes"; then AC_DEFINE(PLAIN_SCROLLBAR, [], [set plain style scroll bar]) AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support]) support_scroll="yes" fi AC_ARG_ENABLE( sgi-scroll, AC_HELP_STRING([--enable-sgi-scroll],[enable SGI IRIX style scrollbar [[yes]]]), [support_scroll_sgi=$enableval] ) if test "x$support_scroll_sgi" = "xyes"; then AC_DEFINE(SGI_SCROLLBAR, [], [set sgi style scroll bar]) AC_DEFINE(HAVE_SCROLLBARS, [], [set scroll bar support]) support_scroll="yes" fi AM_CONDITIONAL(RXVT_SCROLLBAR, test "x$support_scroll_rxvt" = "xyes") AM_CONDITIONAL(NEXT_SCROLLBAR, test "x$support_scroll_next" = "xyes") AM_CONDITIONAL(XTERM_SCROLLBAR, test "x$support_scroll_xterm" = "xyes") AM_CONDITIONAL(PLAIN_SCROLLBAR, test "x$support_scroll_plain" = "xyes") AM_CONDITIONAL(SGI_SCROLLBAR, test "x$support_scroll_sgi" = "xyes") AC_ARG_ENABLE( half-shadow, AC_HELP_STRING([--enable-half-shadow],[enable half width/height shadow on rxvt scrollbar [[yes]]]), [support_half_shadow=$enableval] ) if test "x$support_scroll_rxvt x$support_half_shadow" = "xyes xyes"; then AC_DEFINE(HALFSHADOW, [], [set half shadow rxvt scrollbar support]) fi AC_ARG_ENABLE( utmp, AC_HELP_STRING([--enable-utmp],[enable utmp/utmpx support [[yes]]]), [support_utmp=$enableval] ) if test "x$support_utmp" = "xyes"; then AC_DEFINE(UTMP_SUPPORT, [], [set utmp support]) fi AC_ARG_ENABLE( wtmp, AC_HELP_STRING([--enable-wtmp],[enable wtmp support (need utmp support) [[yes]]]), [support_wtmp=$enableval] ) dnl depends on utmp support if test "x$support_utmp x$support_wtmp" = "xyes xyes"; then AC_DEFINE(WTMP_SUPPORT, [], [set wtmp support]) fi AC_ARG_ENABLE( lastlog, AC_HELP_STRING([--enable-lastlog],[enable lastlog support [[yes]]]), [support_lastlog=$enableval] ) dnl depends on utmp support if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then AC_DEFINE(LASTLOG_SUPPORT, [], [set lastlog support]) fi AM_CONDITIONAL(UTMP_SUPPORT, test "x$support_utmp" = "xyes") AC_ARG_ENABLE( sessionmgr, AC_HELP_STRING([--enable-sessionmgr],[enable X session manager [[yes]]]), [support_sessionmgr=$enableval], ) AC_ARG_ENABLE( utempter, AC_HELP_STRING([--enable-utempter],[enable utempter library for utmp/wtmp/lastlog [[no]]]), [support_utempter=$enableval], ) AC_ARG_ENABLE( linespace, AC_HELP_STRING([--enable-linespace],[enable linespace support [[yes]]]), [support_linespace=$enableval] ) if test "x$support_linespace" != "xyes"; then AC_DEFINE(NO_LINESPACE, [], [unset linespace support]) fi AC_ARG_ENABLE( 24bits, AC_HELP_STRING([--enable-24bits],[prefer 24 bits color [[no]]]), [support_24bits=$enableval] ) if test "x$support_24bits" = "xyes"; then AC_DEFINE(PREFER_24BIT, [], [set 24 bits color support]) fi AC_ARG_ENABLE( 256colors, AC_HELP_STRING([--enable-256colors],[use 256 color [[yes]]]), [support_256colors=$enableval] ) if test "x$support_256colors" = "xyes"; then AC_DEFINE(TTY_256COLOR, [], [set 256 color support]) fi AC_ARG_ENABLE( cursor-blink, AC_HELP_STRING([--enable-cursor-blink],[enable cursor blinking [[yes]]]), [support_cursor_blink=$enableval] ) if test "x$support_cursor_blink" = "xyes"; then AC_DEFINE(CURSOR_BLINK, [], [set cursor blinking support]) fi AC_ARG_ENABLE( pointer-blank, AC_HELP_STRING([--enable-pointer-blank],[enable blank pointer [[yes]]]), [support_pointer_blank=$enableval] ) if test "x$support_pointer_blank" = "xyes"; then AC_DEFINE(POINTER_BLANK, [], [set blank pointer support]) fi AC_ARG_ENABLE( text-shadow, AC_HELP_STRING([--enable-text-shadow],[enable colors shadow for text [[no]]]), [support_text_shadow=$enableval] ) if test "x$support_text_shadow" = "xyes"; then AC_DEFINE(TEXT_SHADOW, [], [set text shadow support]) fi dnl# Make an option instead of a feature dnl# AC_ARG_ENABLE( dnl# smart-resize, dnl# AC_HELP_STRING([--enable-smart-resize],[enable smart resizing [[no]]]), dnl# [support_smart_resize=$enableval] dnl# ) dnl# if test "x$support_smart_resize" = "xyes"; then dnl# AC_DEFINE(SMART_RESIZE, [], [set smart resizing support]) dnl# fi AC_ARG_ENABLE( menubar, AC_HELP_STRING([--enable-menubar],[enable menu bar [[no]]]), [support_menubar=$enableval] ) if test "x$support_menubar" = "xyes"; then AC_DEFINE(HAVE_MENUBAR, [], [set menu bar]) fi AC_ARG_ENABLE( transparency, AC_HELP_STRING([--enable-transparency],[enable transparent background [[yes]]]), [support_transparency=$enableval] ) if test "x$support_transparency" = "xyes"; then AC_DEFINE(TRANSPARENT, [], [set transparent background]) fi dnl: No longer a compile time option, and OFF_FOCUS_FADING is now always dnl: enabled. 2006-09-14 gi1242. dnl: dnl: AC_ARG_ENABLE( dnl: fading, dnl: AC_HELP_STRING([--enable-fading],[enable colors fading when off focus [[yes]]]), dnl: [support_fading=$enableval] dnl: ) dnl: if test "x$support_fading" = "xyes"; then dnl: AC_DEFINE(OFF_FOCUS_FADING, [], [set fading support]) dnl: fi AC_ARG_ENABLE( tinting, AC_HELP_STRING([--enable-tinting],[enable colors tinting [[yes]]]), [support_tinting=$enableval] ) AC_ARG_ENABLE( xrender, AC_HELP_STRING([--enable-xrender],[tint using XRender (slower but nicer results) [[yes]]]), [support_xrender=$enableval] ) AC_ARG_ENABLE( xpm, AC_HELP_STRING([--enable-xpm],[enable XPM background pixmaps [[yes]]]), [support_xpm=$enableval], ) AC_ARG_ENABLE( jpeg, AC_HELP_STRING([--enable-jpeg],[enable JPEG background pixmaps [[yes]]]), [support_jpeg=$enableval], ) AC_ARG_ENABLE( png, AC_HELP_STRING([--enable-png],[enable PNG background pixmaps [[yes]]]), [support_png=$enableval], ) AC_ARG_ENABLE( xft, AC_HELP_STRING([--enable-xft],[enable freetype font support [[no]]]), [support_xft=$enableval] ) AC_ARG_ENABLE( xim, AC_HELP_STRING([--enable-xim],[enable XIM support [[no]]]), [support_xim=$enableval] ) AC_ARG_ENABLE( greek, AC_HELP_STRING([--enable-greek],[enable Greek keyboard support [[no]]]), [support_greek=$enableval] ) if test "x$support_greek" = "xyes"; then AC_DEFINE(GREEK_SUPPORT, [], [set Greek keyboard support]) fi AM_CONDITIONAL(GREEK, test "x$support_greek" = "xyes") AC_ARG_ENABLE( cjk, AC_HELP_STRING([--enable-cjk],[enable CJK multichar language support [[no]]]), [support_cjk=$enableval] ) AC_ARG_ENABLE( ttygid, AC_HELP_STRING([--enable-ttygid],[enable ttygid to group tty [[yes]]]), [support_ttygid=$enableval] ) if test "x$support_ttygid" = "xyes"; then AC_DEFINE(TTY_GID_SUPPORT, [], [set ttygid support]) fi AC_ARG_ENABLE( backspace-key, AC_HELP_STRING([--enable-backspace-key],[enable handling of the backspace key [[yes]]]), [support_backspace_key=$enableval] ) if test "x$support_backspace_key" != "xyes"; then AC_DEFINE(NO_BACKSPACE_KEY, [], [disable handling of backspace key]) fi AC_ARG_ENABLE( delete-key, AC_HELP_STRING([--enable-delete-key],[enable handling of the delete key [[yes]]]), [support_delete_key=$enableval] ) if test "x$support_delete_key" != "xyes"; then AC_DEFINE(NO_DELETE_KEY, [], [disable handling of the delete key]) fi AC_ARG_ENABLE( use-fifo, AC_HELP_STRING([--enable-use-fifo],[Enable listening for macros on a fifo [[yes]]]), [use_fifo=$enableval] ) if test "x$use_fifo" = "xyes"; then AC_DEFINE(USE_FIFO, [], [Enable listening for macros on a fifo]) fi AC_ARG_ENABLE( resources, AC_HELP_STRING([--enable-resources],[enable all resource checking [[yes]]]), [support_resources=$enableval] ) if test "x$support_resources" != "xyes"; then AC_DEFINE(NO_RESOURCES, [], [disable all resource checking]) fi AC_ARG_ENABLE( swapscreen, AC_HELP_STRING([--enable-swapscreen],[enable swap screen support [[yes]]]), [support_swapscreen=$enableval] ) if test "x$support_swapscreen" != "xyes"; then AC_DEFINE(NO_SECONDARY_SCREEN, [], [disable swap screen support]) fi AC_ARG_ENABLE( old-selection, AC_HELP_STRING([--enable-old-selection],[enable old mouse selection code [[no]]]), [support_old_selection=$enableval] ) if test "x$support_old_selection" = "xyes"; then AC_DEFINE(NO_NEW_SELECTION, [], [enable old mouse selection]) else AC_DEFINE(NO_OLD_SELECTION, [], [disable old mouse selection]) fi AC_ARG_WITH( term, AC_HELP_STRING([--with-term=NAME],[set the terminal to NAME [[rxvt]]]), [term_name_option=$withval], [term_name_option=rxvt] ) AC_DEFINE_UNQUOTED(TERMENV, "$term_name_option", [default TERM name]) AC_ARG_WITH( line-space, AC_HELP_STRING([--with-line-space=NUM],[set the space between lines [[0]]]), [line_space_option=$withval], [line_space_option=0] ) AC_DEFINE_UNQUOTED(LINESPACE, $line_space_option, [the space between lines]) AC_ARG_WITH( int-border, AC_HELP_STRING([--with-int-border=NUM],[set the width of internal border, frills option must be enabled [[0]]]), [int_border_option=$withval], [int_border_option=0] ) AC_DEFINE_UNQUOTED(INTERNALBORDERWIDTH, $int_border_option, [the width of internal border]) AC_ARG_WITH( ext-border, AC_HELP_STRING([--with-ext-border=NUM],[set the width of external border, frills option must be enabled [[0]]]), [ext_border_option=$withval], [ext_border_option=0] ) AC_DEFINE_UNQUOTED(EXTERNALBORDERWIDTH, $ext_border_option, [the width of external border]) AC_ARG_WITH( save-lines, AC_HELP_STRING([--with-save-lines=NUM],[set the lines to save in scroll [[100]]]), [save_lines_option=$withval], [save_lines_option=100] ) AC_DEFINE_UNQUOTED(SAVELINES, $save_lines_option, [the lines to save in scroll]) AC_ARG_WITH( max-profiles, AC_HELP_STRING([--with-max-profiles=NUM],[set the max number of terminal [[5]]]), [max_prof_option=$withval], [max_prof_option=5] ) AC_DEFINE_UNQUOTED(MAX_PROFILES, $max_prof_option, [the max number of profiles]) AC_ARG_WITH( max-term, AC_HELP_STRING([--with-max-term=NUM],[set the max number of terminal [[15]]]), [max_term_option=$withval], [max_term_option=15] ) AC_DEFINE_UNQUOTED(MAX_PAGES, $max_term_option, [the max number of vt that can be open]) AC_ARG_WITH( atab-extra, AC_HELP_STRING( [--with-atab-extra=%], [The extra height (as a % of the font height) active tabs should have] ), [atab_extra_option=$withval], [atab_extra_option=20] ) AC_DEFINE_UNQUOTED( ATAB_EXTRA_PERCENT, $atab_extra_option, [The extra height (as a % of the font height) active tabs should have]) AC_ARG_WITH( tab-radius, AC_HELP_STRING( [--with-tab-radius=%], [The radius (as a % of the font X offset) of tab corners]), [tab_radius_option=$withval], [tab_radius_option=100], ) AC_DEFINE_UNQUOTED( TAB_RADIUS_PERCENT, $tab_radius_option, [The radius (as a % of the font X offset) of tab corners]) withval="" AC_ARG_WITH( terminfo, AC_HELP_STRING([--with-terminfo=PATH],[set the path to the terminfo tree to PATH]), [terminfo_option=$withval], [terminfo_option="/usr/share/terminfo"] ) if test "x$withval" != "x"; then AC_DEFINE_UNQUOTED(RXVT_TERMINFO, "$terminfo_option", [terminfo path]) fi AC_ARG_WITH( encoding, AC_HELP_STRING([--with-encoding=NAME],[set language default encoding (eucj|sjis|big5|gb|gbk|kr|noenc) to NAME (default is noenc)]), [encoding_option=$withval], [encoding_option="noenc"] ) dnl Checks for programs. AC_PROG_CC(gcc cc egcs) dnl AX_CFLAGS_WARN_ALL if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall -fPIC" fi AC_PROG_MAKE_SET AC_PROG_INSTALL #AM_PROG_LIBTOOL dnl Checks for libraries. dnl FreeBSD needs to link libutil for openpty and libxpg4 for dnl setlocale. Why this looks only necessary after FreeBSD dnl 5.2.1?!!! if test "x$local_os_type" = "xfreebsd" -o \ "x$local_os_type" = "xopenbsd" -o \ "x$local_os_type" = "xnetbsd"; then AC_CHECK_LIB(xpg4, setlocale) AC_CHECK_LIB(util, openpty) fi AC_PATH_X if test "x$no_x" = "xyes"; then AC_MSG_ERROR([Mrxvt requires the X Window System libraries and headers.]) fi dnl Warn if the detected path differs from the supplied if test "x$x_includes" != "x" -a \ "x$ac_x_includes" != "x" -a \ "$x_includes" != "$ac_x_includes"; then AC_MSG_WARN([X includes path detected differs from the supplied!]) fi if test "x$x_libraries" != "x" -a \ "x$ac_x_libraries" != "x" -a \ "$x_libraries" != "$ac_x_libraries"; then AC_MSG_WARN([X libraries path detected differs from the supplied!]) fi dnl In case x_includes and x_libraries are not empty test "x$x_includes" = "x" && x_includes="$ac_x_includes" test "x$x_libraries" = "x" && x_libraries="$ac_x_libraries" test "x$x_includes" != "x" && CFLAGS="$CFLAGS -I$x_includes" dnl To pass linking, we must define both LDFLAGS and LIBS test "x$x_libraries" != "x" && LDFLAGS="$LDFLAGS -L$x_libraries" test "x$x_libraries" != "x" && LIBS="$LIBS -L$x_libraries" AC_CHECK_LIB( X11, XOpenDisplay, [], AC_MSG_ERROR([Mrxvt requires the libX11 libraries.]) ) dnl AC_CHECK_LIB( dnl Xext, dnl XextAddDisplay, dnl [], dnl AC_MSG_ERROR([Mrxvt requires the libXext libraries.]) dnl ) if test "x$support_xim" = "xyes"; then AC_CHECK_LIB( X11, XRegisterIMInstantiateCallback, AC_DEFINE(USE_XIM, [], [set XIM support]), [support_xim=no] ) fi if test "x$support_sessionmgr" = "xyes"; then AC_CHECK_LIB( SM, SmcOpenConnection, [], [support_sessionmgr=no] ) AC_CHECK_LIB( ICE, IceConnectionNumber, [], [support_sessionmgr=no] ) fi AM_CONDITIONAL(SESSION_SUPPORT, test "x$support_sessionmgr" = "xyes") if test "x$support_utempter" = "xyes"; then AC_CHECK_LIB( utempter, utempter_add_record, [], [support_utempter=no] ) fi if test "x$support_utempter" = "xyes"; then AC_DEFINE(UTEMPTER_SUPPORT, [], [set utempter library support]) fi if test "x$support_xpm" = "xyes"; then AC_CHECK_LIB( Xpm, XpmCreateImageFromXpmImage, [], [support_xpm=no] ) fi if test "x$support_jpeg" = "xyes"; then AC_CHECK_LIB( jpeg, jpeg_read_header, [], [support_jpeg=no] ) fi if test "x$support_jpeg" = "xyes"; then AC_DEFINE(USE_JPEG, [], [set JPEG background]) fi AM_CONDITIONAL(USE_JPEG, test "x$support_jpeg" = "xyes") if test "x$support_png" = "xyes"; then AC_CHECK_LIB( png, png_check_sig, [], [support_png=no], [-lz -lm] ) fi if test "x$support_png" = "xyes"; then AC_DEFINE(USE_PNG, [], [set PNG background]) LIBS="$LIBS -lz -lm" fi AM_CONDITIONAL(USE_PNG, test "x$support_png" = "xyes") if test "x$support_xpm" != "xyes" -a "x$support_jpeg" != "xyes" -a "x$support_png" != "xyes"; then support_background_image=no if test "x$support_transparency" = "xno"; then dnl Need either background or transparency for tinting. support_tinting=no fi fi if test "x$support_background_image" = "xyes"; then AC_DEFINE(BACKGROUND_IMAGE, [], [set background image]) fi if test "x$support_tinting" = "xyes"; then AC_DEFINE(TINTING_SUPPORT, [], [set tinting support]) fi if test "x$support_xrender" = "xyes" -a "x$support_tinting" = "xyes"; then AC_CHECK_LIB( Xrender, XRenderCreatePicture, ) dnl AC_DEFINE(HAVE_XRENDER, [], [XRender tinting support]) fi if test "x$support_xft" = "xyes"; then dnl Backup variables OLD_LIBS="$LIBS" OLD_CFLAGS="$CFLAGS" OLD_LDFLAGS="$LDFLAGS" dnl Get new variables. if which pkg-config >/dev/null 2>&1 && pkg-config --exists xft; then LIBS="$LIBS `pkg-config --libs xft`" CFLAGS="$CFLAGS `pkg-config --cflags xft`" LDFLAGS="$LDFLAGS `pkg-config --libs xft`" else if which xft-config >/dev/null 2>&1; then dnl If xft-config is not found, try pkg-config instead LIBS="$LIBS `xft-config --libs`" CFLAGS="$CFLAGS `xft-config --cflags`" LDFLAGS="$LDFLAGS `xft-config --libs`" else support_xft="no" fi fi dnl Solaris has wired include directory for freetype.h if test "x$local_os_type" = "xsolaris"; then CFLAGS="$CFLAGS -I/usr/sfw/include -I/usr/sfw/include/freetype2" fi AC_CHECK_HEADERS(fontconfig/fontconfig.h X11/Xft/Xft.h, , [support_xft=no], [[#include #include ]] ) AC_CHECK_LIB( fontconfig, FcPatternAddInteger, [], [support_xft=no] ) AC_CHECK_LIB( Xft, XftDrawString16, [], [support_xft=no] ) if test "x$support_xft x$support_cjk" = "xyes xyes"; then dnl BSD and Cygwin needs libiconv AC_CHECK_LIB(iconv, iconv_open) dnl hack for Mac OS X if test "x$local_os_type" = "xdarwin"; then LIBS="$LIBS -liconv" fi dnl hack for Cygwin if test "x$local_os_type" = "xcygwin"; then LIBS="$LIBS -liconv" fi dnl hack for Cygwin if test "x$local_os_type" = "xopenbsd"; then LIBS="$LIBS -liconv" fi fi if test "x$support_xft" = "xyes"; then AC_DEFINE(XFT_SUPPORT, [], [set XFT support]) else dnl Restore backup copy variables LIBS="$OLD_LIBS" CFLAGS="$OLD_CFLAGS" LDFLAGS="$OLD_LDFLAGS" fi fi AM_CONDITIONAL(XFT_SUPPORT, test "x$support_xft" = "xyes") if test "x$support_cjk" = "xyes"; then AC_DEFINE(MULTICHAR_SET, [], [set CJK multichar set support]) AC_DEFINE_UNQUOTED(MULTICHAR_ENCODING, "$encoding_option", [default encoding]) fi AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([stdlib.h], [], [], [#include ]) AC_CHECK_HEADERS([sys/socket.h], [], [], [#include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif ]) AC_CHECK_HEADERS( \ arpa/inet.h \ assert.h \ fcntl.h \ iconv.h \ lastlog.h \ limits.h \ locale.h \ langinfo.h \ netinet/in.h \ pty.h \ sgtty.h \ stdarg.h \ stdlib.h \ string.h \ sys/byteorder.h \ sys/ioctl.h \ sys/select.h \ sys/sockio.h \ sys/stropts.h \ sys/strredir.h \ sys/stat.h \ sys/time.h \ sys/times.h \ sys/types.h \ sys/wait.h \ time.h \ termios.h \ unistd.h \ utmp.h \ utmpx.h \ wordexp.h \ wchar.h \ ) if test "x$support_sessionmgr" = "xyes"; then AC_CHECK_HEADERS(X11/SM/SMlib.h) fi AC_CHECK_HEADERS([net/if.h], [], [], [#include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #if HAVE_SYS_SOCKET_H # include #endif ]) AC_CHECK_HEADERS([net/if_arp.h], [], [], [#include #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #if HAVE_SYS_SOCKET_H # include #endif ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_MODE_T AC_TYPE_UID_T AC_TYPE_PID_T AC_TYPE_SIGNAL AC_CACHE_CHECK(for working nl_langinfo, rxvt_cv_func_nl_langinfo, [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[nl_langinfo(CODESET);]])],[rxvt_cv_func_nl_langinfo=yes],[rxvt_cv_func_nl_langinfo=no])]) if test "x$rxvt_cv_func_nl_langinfo" = "xyes"; then AC_DEFINE(HAVE_NL_LANGINFO, 1, Define if nl_langinfo(CODESET) works) fi AC_CACHE_CHECK([for XPointer], rxvt_cv_xpointer, [AC_TRY_COMPILE([#include ], [XPointer dummy;], rxvt_cv_xpointer=yes, rxvt_cv_xpointer=no)]) if test "x$rxvt_cv_xpointer" = "xyes"; then AC_DEFINE(HAVE_XPOINTER, 1, Define if you have XPointer typedef) fi if test "x$support_utmp" = "xyes"; then AC_CACHE_CHECK([for struct utmp], rxvt_cv_struct_utmp, [AC_TRY_COMPILE([#include #include ], [struct utmp ut;], rxvt_cv_struct_utmp=yes, rxvt_cv_struct_utmp=no)]) if test "x$rxvt_cv_struct_utmp" = "xyes"; then AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp) fi AC_CACHE_CHECK(for ut_host in utmp struct, rxvt_cv_struct_utmp_host, [AC_TRY_COMPILE([#include #include ], [struct utmp ut; ut.ut_host;], rxvt_cv_struct_utmp_host=yes, rxvt_cv_struct_utmp_host=no)]) if test "x$rxvt_cv_struct_utmp_host" = "xyes"; then AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host) fi AC_CACHE_CHECK(for ut_pid in utmp struct, rxvt_cv_struct_utmp_pid, [AC_TRY_COMPILE([#include #include ], [struct utmp ut; ut.ut_pid;], rxvt_cv_struct_utmp_pid=yes, rxvt_cv_struct_utmp_pid=no)]) if test "x$rxvt_cv_struct_utmp_pid" = "xyes"; then AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid) fi AC_CACHE_CHECK([for struct utmpx], rxvt_cv_struct_utmpx, [AC_TRY_COMPILE([#include #include ], [struct utmpx ut;], rxvt_cv_struct_utmpx=yes, rxvt_cv_struct_utmpx=no)]) if test "x$rxvt_cv_struct_utmpx" = "xyes"; then AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx) fi AC_CACHE_CHECK(for ut_host in utmpx struct, rxvt_cv_struct_utmpx_host, [AC_TRY_COMPILE([#include #include ], [struct utmpx utx; utx.ut_host;], rxvt_cv_struct_utmpx_host=yes, rxvt_cv_struct_utmpx_host=no)]) if test "x$rxvt_cv_struct_utmpx_host" = "xyes"; then AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host) fi AC_CACHE_CHECK(for ut_session in utmpx struct, rxvt_cv_struct_utmpx_session, [AC_TRY_COMPILE([#include #include ], [struct utmpx utx; utx.ut_session;], rxvt_cv_struct_utmpx_session=yes, rxvt_cv_struct_utmpx_session=no)]) if test "x$rxvt_cv_struct_utmpx_session" = "xyes"; then AC_DEFINE(HAVE_UTMPX_SESSION, 1, Define if struct utmpx contains ut_session) fi fi if test "x$support_utmp x$support_lastlog" = "xyes xyes"; then AC_CACHE_CHECK(for struct lastlog, rxvt_cv_struct_lastlog, [AC_TRY_COMPILE([#include #include #ifdef HAVE_LASTLOG_H #include #endif ], [struct lastlog ll;], rxvt_cv_struct_lastlog=yes, rxvt_cv_struct_lastlog=no)]) if test "x$rxvt_cv_struct_lastlog" = "xyes"; then AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog) fi fi AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(int *, 4) if test $ac_cv_sizeof_char -ge 2; then RINT16T=char AC_DEFINE(RINT16T, char,[typedef]) AC_DEFINE(RUINT16T, unsigned char,[typedef]) else if test $ac_cv_sizeof_short -ge 2; then RINT16T=short AC_DEFINE(RINT16T, short,[typedef]) AC_DEFINE(RUINT16T, unsigned short,[typedef]) else if test $ac_cv_sizeof_int -ge 2; then RINT16T=int AC_DEFINE(RINT16T, int,[typedef]) AC_DEFINE(RUINT16T, unsigned int,[typedef]) else dnl What a fantastic system ? RINT16T=long AC_DEFINE(RINT16T, long,[typedef]) AC_DEFINE(RUINT16T, unsigned long,[typedef]) fi fi fi if test $ac_cv_sizeof_char -ge 4; then RINT32T=char AC_DEFINE(RINT32T, char,[typedef]) AC_DEFINE(RUINT32T, unsigned char,[typedef]) else if test $ac_cv_sizeof_short -ge 4; then RINT32T=short AC_DEFINE(RINT32T, short,[typedef]) AC_DEFINE(RUINT32T, unsigned short,[typedef]) else if test $ac_cv_sizeof_int -ge 4; then RINT32T=int AC_DEFINE(RINT32T, int,[typedef]) AC_DEFINE(RUINT32T, unsigned int,[typedef]) else dnl What a fantastic system ? RINT32T=long AC_DEFINE(RINT32T, long,[typedef]) AC_DEFINE(RUINT32T, unsigned long,[typedef]) fi fi fi if test $ac_cv_sizeof_char -eq $ac_cv_sizeof_int_p; then RINTPT=char AC_DEFINE(RINTPT, char,[typedef]) AC_DEFINE(RUINTPT, unsigned char,[typedef]) else if test $ac_cv_sizeof_short -eq $ac_cv_sizeof_int_p; then RINTPT=short AC_DEFINE(RINTPT, short,[typedef]) AC_DEFINE(RUINTPT, unsigned short,[typedef]) else if test $ac_cv_sizeof_int -eq $ac_cv_sizeof_int_p; then RINTPT=int AC_DEFINE(RINTPT, int,[typedef]) AC_DEFINE(RUINTPT, unsigned int,[typedef]) else dnl what next? long long? quad? RINTPT=long AC_DEFINE(RINTPT, long,[typedef]) AC_DEFINE(RUINTPT, unsigned long,[typedef]) fi fi fi dnl Checks for library functions. AC_FUNC_CHOWN AC_FUNC_FORK AC_PROG_GCC_TRADITIONAL AC_FUNC_LSTAT dnl AC_FUNC_MALLOC AC_FUNC_SETPGRP AC_FUNC_VPRINTF dnl Now to check functions AC_CHECK_FUNCS( getcwd \ getpt \ _getpty \ getpwuid \ grantpt \ isastream \ nanosleep \ openpty \ putenv \ revoke \ select \ setlocale \ seteuid \ setpgrp \ setpgid \ setreuid \ setsid \ setutent \ socket \ strcasestr \ strchr \ strdup \ strndup \ strrchr \ ttyslot \ unlockpt \ unsetenv \ updwtmp \ updwtmpx \ xsetlocale \ ) dnl Now to set tty options dnl echo "*** ac_cv_func_getpt = $ac_cv_func_getpt" dnl Check PTY/TTY types if test "x$ac_cv_func_openpty" = "xyes"; then rxvt_cv_ptys=OPENPTY else if test "x$ac_cv_func__getpty" = "xyes"; then rxvt_cv_ptys=SGI4 else if test -c /dev/ttyp20; then rxvt_cv_ptys=SCO else if test -c /dev/ptym/clone; then rxvt_cv_ptys=HPUX else if test "x$ac_cv_func_getpt" = "xyes"; then rxvt_cv_ptys=GLIBC else if test -c /dev/ptc -a -c /dev/pts; then rxvt_cv_ptys=PTC else if test -c /dev/ptc -a -d /dev/pts; then rxvt_cv_ptys=PTC else if test -c /dev/ptmx -a -c /dev/pts/0; then rxvt_cv_ptys=STREAMS else if test "x$ac_cv_func_grantpt x$ac_cv_func_unlockpt" = "xyes xyes"; then rxvt_cv_ptys=STREAMS else rxvt_cv_ptys=BSD fi fi fi fi fi fi fi fi fi dnl echo "*** rxvt_cv_ptys = $rxvt_cv_ptys" if test "x$rxvt_cv_ptys" = "xOPENPTY"; then AC_DEFINE(PTYS_ARE_OPENPTY, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xSCO"; then AC_DEFINE(PTYS_ARE_NUMERIC, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xSTREAMS"; then AC_DEFINE(PTYS_ARE_PTMX, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xPTC"; then AC_DEFINE(PTYS_ARE_PTC, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xSGI4"; then AC_DEFINE(PTYS_ARE__GETPTY, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xCONVEX"; then AC_DEFINE(PTYS_ARE_GETPTY, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xGLIBC"; then AC_DEFINE(PTYS_ARE_GETPT, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xHPUX"; then AC_DEFINE(PTYS_ARE_CLONE, 1, Define for this pty type) fi if test "x$rxvt_cv_ptys" = "xBSD" -o "x$rxvt_cv_ptys" = "xHPUX" -o "x$rxvt_cv_ptys" = "xGLIBC"; then AC_DEFINE(PTYS_ARE_SEARCHED, 1, Define for this pty type) fi AC_CHECKING(for pty ranges) ptys=`echo /dev/pty??` pch1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` pch2=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` if test x$pch1 != x; then AC_DEFINE_UNQUOTED(PTYCHAR1, "$pch1", Define for first char in devptyXX) fi if test x$pch2 != x; then AC_DEFINE_UNQUOTED(PTYCHAR2, "$pch2", Define for second char in devptyXX) fi dnl Now to generate Makefiles AC_SUBST(CC) AC_SUBST(CFLAGS) AC_SUBST(LDFLAGS) AC_SUBST(LIBS) AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile share/Makefile]) AC_OUTPUT dnl Now to dump configuration options dnl echo "CFLAGS: $CFLAGS" dnl echo "LDFLAGS: $LDFLAGS" dnl echo "LIBS: $LIBS" echo echo echo "Configurations:" echo echo echo "Maintenance:" echo "Debug mode : $support_debug" echo "Private string functions : $support_ourstrings" echo "Rarely used features : $support_frills" echo echo "Scroll features:" echo "Keep scroll : $support_keepscrolling" echo "Scroll on selection : $support_selectionscrolling" echo "Mouse wheel scroll : $support_mousewheel" if test "x$support_mousewheel" = "xyes"; then echo "Slip mouse wheel scroll : $support_mouseslipwheel" fi if test "x$support_scroll" = "xyes"; then echo "RXVT style scrollbar : $support_scroll_rxvt" echo "NeXT style scrollbar : $support_scroll_next" echo "Xterm style scrollbar : $support_scroll_xterm" echo "Plain style scrollbar : $support_scroll_plain" echo "SGI IRIX style scrollbar : $support_scroll_sgi" if test "x$support_scroll_rxvt" = "xyes"; then echo "Half shadow scrollbar : $support_half_shadow" fi fi echo echo "Logging features:" echo "Support utmp records : $support_utmp" echo "Support wtmp records : $support_wtmp" echo "Support lastlog records : $support_lastlog" echo "Support X session manager : $support_sessionmgr" echo "Use utempter library : $support_utempter" echo echo "Visual features:" echo "Support line space : $support_linespace" echo "24 bits color mode : $support_24bits" echo "256 color mode : $support_256colors" echo "Blink cursor : $support_cursor_blink" echo "Blank pointer : $support_pointer_blank" echo "Color text shadow : $support_text_shadow" echo "Smart resize : $support_smart_resize" echo "Menu bar : $support_menubar" echo echo "Background features:" echo "Background image : $support_background_image" echo "XPM background image : $support_xpm" echo "JPEG background image : $support_jpeg" echo "PNG background image : $support_png" echo "Transparent background : $support_transparency" dnl: echo "Off focus fading : $support_fading" if test "x$support_tinting" = "xno"; then echo "Background tinting : $support_tinting" else if test "x$support_xrender" = "xyes"; then echo "Background tinting : $support_tinting (XRender)" else echo "Background tinting : $support_tinting (Fast)" fi fi echo echo "Multi-language and font features:" echo "Freetype Font : $support_xft" echo "X Input Method : $support_xim" echo "Greek keyboard : $support_greek" echo "CJK multichar language : $support_cjk" if test "x$support_cjk" = "xyes"; then echo "Default encoding method : $encoding_option" fi echo echo "System features:" echo "TTY/PTY type : $rxvt_cv_ptys" echo "TTY gid : $support_ttygid" echo "Backspace key : $support_backspace_key" echo "Delete key : $support_delete_key" echo "Use fifo : $use_fifo" echo "X resources : $support_resources" echo "X default resources : $support_xgetdefault" echo "Swap screen : $support_swapscreen" echo "Old selection : $support_old_selection" echo echo "Options:" echo "Terminal name : $term_name_option" echo "Maximal profiles : $max_prof_option" echo "Maximal tabs : $max_term_option" echo "Extra height% of active tab : $atab_extra_option" echo "Radius% of tab corners : $tab_radius_option" if test "x$support_linespace" = "xyes"; then echo "Line space : $line_space_option" fi if test "x$support_frills" = "xyes"; then echo "Internal border width : $int_border_option" echo "External border width : $ext_border_option" fi if test "x$support_scroll" = "xyes"; then echo "Saved lines in scroll : $save_lines_option" fi echo mrxvt-0.5.4/config.guess0000755000175000001440000013015510756127630012151 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-07-22' # This file 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown if [ "${UNAME_SYSTEM}" = "Linux" ] ; then eval $set_cc_for_build cat << EOF > $dummy.c #include #ifdef __UCLIBC__ # ifdef __UCLIBC_CONFIG_VERSION__ LIBC=uclibc __UCLIBC_CONFIG_VERSION__ # else LIBC=uclibc # endif #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` fi # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo cris-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo frv-unknown-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-${LIBC} exit ;; xtensa:Linux:*:*) echo xtensa-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" exit ;; esac # This should get integrated into the C code below, but now we hack if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mrxvt-0.5.4/install-sh0000755000175000001440000003160010756127630011630 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mrxvt-0.5.4/config.sub0000755000175000001440000010033610756127630011612 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx | dvp \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ | sh | sh[1234] | sh[24]a | sh[24]a*eb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]a*eb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsEE* | ee | ps2) basic_machine=mips64r5900el-scei case $os in -linux*) ;; *) os=-elf ;; esac ;; iop) basic_machine=mipsel-scei os=-irx ;; dvp) basic_machine=dvp-scei os=-elf ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -irx*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mrxvt-0.5.4/missing0000755000175000001440000002557710756127630011243 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: mrxvt-0.5.4/Makefile.am0000644000175000001440000000177011006650313011651 00000000000000# All portions of code are copyright by their respective author/s. # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. SUBDIRS = doc src share EXTRA_DIST = CREDITS FAQ ChangeLog.old mrxvt-0.5.4/Makefile.in0000644000175000001440000004734711012076343011676 00000000000000# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ # All portions of code are copyright by their respective author/s. # Copyright (c) 2002 Alexis # Copyright (c) 2004 Jingmin Zhou # Copyright (c) 2006 Gautam Iyer # # 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., 675 Mass # Ave, Cambridge, MA 02139, USA. VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ TODO config.guess config.sub install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMKMF = @XMKMF@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = doc src share EXTRA_DIST = CREDITS FAQ ChangeLog.old all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ cd $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_srcdir) && $(AUTOHEADER) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-exec-am: install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-hdr distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ install-html install-html-am install-info install-info-am \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mrxvt-0.5.4/config.h.in0000644000175000001440000003500711012076341011640 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* The extra height (as a % of the font height) active tabs should have */ #undef ATAB_EXTRA_PERCENT /* set background image */ #undef BACKGROUND_IMAGE /* set cursor blinking support */ #undef CURSOR_BLINK /* set DEBUG mode */ #undef DEBUG /* the width of external border */ #undef EXTERNALBORDERWIDTH /* set Greek keyboard support */ #undef GREEK_SUPPORT /* set half shadow rxvt scrollbar support */ #undef HALFSHADOW /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the header file. */ #undef HAVE_ASSERT_H /* Define to 1 if your system has a working `chown' function. */ #undef HAVE_CHOWN /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the header file. */ #undef HAVE_FONTCONFIG_FONTCONFIG_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define to 1 if you have the `getpt' function. */ #undef HAVE_GETPT /* Define to 1 if you have the `getpwuid' function. */ #undef HAVE_GETPWUID /* Define to 1 if you have the `grantpt' function. */ #undef HAVE_GRANTPT /* Define to 1 if you have the header file. */ #undef HAVE_ICONV_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `isastream' function. */ #undef HAVE_ISASTREAM /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_LASTLOG_H /* Define to 1 if you have the `fontconfig' library (-lfontconfig). */ #undef HAVE_LIBFONTCONFIG /* Define to 1 if you have the `ICE' library (-lICE). */ #undef HAVE_LIBICE /* Define to 1 if you have the `iconv' library (-liconv). */ #undef HAVE_LIBICONV /* Define to 1 if you have the `jpeg' library (-ljpeg). */ #undef HAVE_LIBJPEG /* Define to 1 if you have the `png' library (-lpng). */ #undef HAVE_LIBPNG /* Define to 1 if you have the `SM' library (-lSM). */ #undef HAVE_LIBSM /* Define to 1 if you have the `utempter' library (-lutempter). */ #undef HAVE_LIBUTEMPTER /* Define to 1 if you have the `util' library (-lutil). */ #undef HAVE_LIBUTIL /* Define to 1 if you have the `X11' library (-lX11). */ #undef HAVE_LIBX11 /* Define to 1 if you have the `Xft' library (-lXft). */ #undef HAVE_LIBXFT /* Define to 1 if you have the `xpg4' library (-lxpg4). */ #undef HAVE_LIBXPG4 /* Define to 1 if you have the `Xpm' library (-lXpm). */ #undef HAVE_LIBXPM /* Define to 1 if you have the `Xrender' library (-lXrender). */ #undef HAVE_LIBXRENDER /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if `lstat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_LSTAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* set menu bar */ #undef HAVE_MENUBAR /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_ARP_H /* Define to 1 if you have the header file. */ #undef HAVE_NET_IF_H /* Define if nl_langinfo(CODESET) works */ #undef HAVE_NL_LANGINFO /* Define to 1 if you have the `openpty' function. */ #undef HAVE_OPENPTY /* Define to 1 if you have the header file. */ #undef HAVE_PTY_H /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV /* Define to 1 if you have the `revoke' function. */ #undef HAVE_REVOKE /* set scroll bar support */ #undef HAVE_SCROLLBARS /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `seteuid' function. */ #undef HAVE_SETEUID /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the `setpgid' function. */ #undef HAVE_SETPGID /* Define to 1 if you have the `setpgrp' function. */ #undef HAVE_SETPGRP /* Define to 1 if you have the `setreuid' function. */ #undef HAVE_SETREUID /* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID /* Define to 1 if you have the `setutent' function. */ #undef HAVE_SETUTENT /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H /* Define to 1 if you have the `socket' function. */ #undef HAVE_SOCKET /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define if utmp.h or lastlog.h has struct lastlog */ #undef HAVE_STRUCT_LASTLOG /* Define if utmp.h has struct utmp */ #undef HAVE_STRUCT_UTMP /* Define if utmpx.h has struct utmpx */ #undef HAVE_STRUCT_UTMPX /* Define to 1 if you have the header file. */ #undef HAVE_SYS_BYTEORDER_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STROPTS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STRREDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define to 1 if you have the `ttyslot' function. */ #undef HAVE_TTYSLOT /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unlockpt' function. */ #undef HAVE_UNLOCKPT /* Define to 1 if you have the `unsetenv' function. */ #undef HAVE_UNSETENV /* Define to 1 if you have the `updwtmp' function. */ #undef HAVE_UPDWTMP /* Define to 1 if you have the `updwtmpx' function. */ #undef HAVE_UPDWTMPX /* Define to 1 if you have the header file. */ #undef HAVE_UTMPX_H /* Define if struct utmpx contains ut_host */ #undef HAVE_UTMPX_HOST /* Define if struct utmpx contains ut_session */ #undef HAVE_UTMPX_SESSION /* Define to 1 if you have the header file. */ #undef HAVE_UTMP_H /* Define if struct utmp contains ut_host */ #undef HAVE_UTMP_HOST /* Define if struct utmp contains ut_pid */ #undef HAVE_UTMP_PID /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Define to 1 if you have the header file. */ #undef HAVE_WORDEXP_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_X11_SM_SMLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_X11_XFT_XFT_H /* Define if you have XPointer typedef */ #undef HAVE_XPOINTER /* Define to 1 if you have the `xsetlocale' function. */ #undef HAVE_XSETLOCALE /* Define to 1 if you have the `_getpty' function. */ #undef HAVE__GETPTY /* the width of internal border */ #undef INTERNALBORDERWIDTH /* set lastlog support */ #undef LASTLOG_SUPPORT /* the space between lines */ #undef LINESPACE /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* the max number of vt that can be open */ #undef MAX_PAGES /* the max number of profiles */ #undef MAX_PROFILES /* enable slip scrolling via mouse wheel */ #undef MOUSE_SLIP_WHEELING /* enable scrolling via mouse wheel */ #undef MOUSE_WHEEL /* default encoding */ #undef MULTICHAR_ENCODING /* set CJK multichar set support */ #undef MULTICHAR_SET /* unset DEBUG mode */ #undef NDEBUG /* set next style scroll bar */ #undef NEXT_SCROLLBAR /* disable handling of backspace key */ #undef NO_BACKSPACE_KEY /* disable handling of the delete key */ #undef NO_DELETE_KEY /* enable internal borders / smart resizing */ #undef NO_FRILLS /* unset linespace support */ #undef NO_LINESPACE /* enable old mouse selection */ #undef NO_NEW_SELECTION /* disable old mouse selection */ #undef NO_OLD_SELECTION /* disable all resource checking */ #undef NO_RESOURCES /* enable continual scrolling on scrollbar arrow press */ #undef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING /* disable swap screen support */ #undef NO_SECONDARY_SCREEN /* set OS to aix */ #undef OS_AIX /* set OS to bsd */ #undef OS_BSD /* set OS to cygwin */ #undef OS_CYGWIN /* set OS to darwin */ #undef OS_DARWIN /* set OS to freebsd */ #undef OS_FREEBSD /* set OS to hp-ux */ #undef OS_HPUX /* set OS to irix */ #undef OS_IRIX /* set OS to linux */ #undef OS_LINUX /* set OS to netbsd */ #undef OS_NETBSD /* set OS to openbsd */ #undef OS_OPENBSD /* set openbsd release number */ #undef OS_OPENBSD_REL /* set OS to osf */ #undef OS_OSF /* set OS to sco */ #undef OS_SCO /* set OS to solaris */ #undef OS_SOLARIS /* set OS to sunos */ #undef OS_SUNOS /* set OS to svr4 */ #undef OS_SVR4 /* use our own string functions */ #undef OUR_STRINGS /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* set plain style scroll bar */ #undef PLAIN_SCROLLBAR /* set blank pointer support */ #undef POINTER_BLANK /* set 24 bits color support */ #undef PREFER_24BIT /* Define for first char in devptyXX */ #undef PTYCHAR1 /* Define for second char in devptyXX */ #undef PTYCHAR2 /* Define for this pty type */ #undef PTYS_ARE_CLONE /* Define for this pty type */ #undef PTYS_ARE_GETPT /* Define for this pty type */ #undef PTYS_ARE_GETPTY /* Define for this pty type */ #undef PTYS_ARE_NUMERIC /* Define for this pty type */ #undef PTYS_ARE_OPENPTY /* Define for this pty type */ #undef PTYS_ARE_PTC /* Define for this pty type */ #undef PTYS_ARE_PTMX /* Define for this pty type */ #undef PTYS_ARE_SEARCHED /* Define for this pty type */ #undef PTYS_ARE__GETPTY /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* typedef */ #undef RINT16T /* typedef */ #undef RINT32T /* typedef */ #undef RINTPT /* typedef */ #undef RUINT16T /* typedef */ #undef RUINT32T /* typedef */ #undef RUINTPT /* set rxvt style scroll bar */ #undef RXVT_SCROLLBAR /* terminfo path */ #undef RXVT_TERMINFO /* the lines to save in scroll */ #undef SAVELINES /* enable continual scrolling on selection */ #undef SELECTION_SCROLLING /* Define to 1 if the `setpgrp' function takes no argument. */ #undef SETPGRP_VOID /* set sgi style scroll bar */ #undef SGI_SCROLLBAR /* The size of `char', as computed by sizeof. */ #undef SIZEOF_CHAR /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `int *', as computed by sizeof. */ #undef SIZEOF_INT_P /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* The radius (as a % of the font X offset) of tab corners */ #undef TAB_RADIUS_PERCENT /* default TERM name */ #undef TERMENV /* set text shadow support */ #undef TEXT_SHADOW /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* set tinting support */ #undef TINTING_SUPPORT /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* set transparent background */ #undef TRANSPARENT /* set 256 color support */ #undef TTY_256COLOR /* set ttygid support */ #undef TTY_GID_SUPPORT /* Enable listening for macros on a fifo */ #undef USE_FIFO /* set JPEG background */ #undef USE_JPEG /* set PNG background */ #undef USE_PNG /* set XIM support */ #undef USE_XIM /* set utempter library support */ #undef UTEMPTER_SUPPORT /* set utmp support */ #undef UTMP_SUPPORT /* Version number of package */ #undef VERSION /* set wtmp support */ #undef WTMP_SUPPORT /* set XFT support */ #undef XFT_SUPPORT /* set xterm style scroll bar */ #undef XTERM_SCROLLBAR /* set GNU source flag for linux */ #undef _GNU_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef mode_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define as `fork' if `vfork' does not work. */ #undef vfork mrxvt-0.5.4/AUTHORS0000644000175000001440000000624010756127603010676 00000000000000Current maintainer Terminator Gautam Iyer RedHat RPM package maintainer Neil Zanella SuSE RPM package maintainer Pascal Bleser Mandrake RPM package maintainer Qi Guo Debian package maintainer Qingning Huo Copyright holders Copyright (c) 1992 John Bovey Copyright (c) 1993 Brian Stempien Copyright (c) 1993 lipka Copyright (c) 1994 Robert Nation Copyright (c) 1994,1995 Angelo Haritsis Copyright (c) 1995 Garrett D'Amore Copyright (c) 1995 Jakub Jelinek Copyright (c) 1995 Piet W. Plomp Copyright (c) 1995 Raul Garcia Garcia Copyright (c) 1995 Steven Hirsch Copyright (c) 1996 Chuck Blake Copyright (c) 1996 mj olesen Copyright (c) 1997 Carsten Haitzler Copyright (c) 1997 Raul Garcia Garcia Copyright (c) 1997,1998 Oezguer Kesim Copyright (c) 1997,1998 mj olesen Copyright (c) 1997-2001 Geoff Wing Copyright (c) 1998 Alfredo K. Kojima Copyright (c) 1998 Sasha Vasko Copyright (c) 1999 Felix Bellaby Copyright (c) 1999 D J Hawkey Jr Copyright (c) 1999-2002 Toshikaz Hirabayashi Copyright (c) 2000 Frank Everdij Copyright (c) 2000 Xianping Ge Copyright (c) 2000,2001 Teepanis Chachiyo Copyright (c) 2001 Tomohiro KUBOTA Copyright (c) 2001 Marius Gedminas Copyright (c) 2002 Alexis Copyright (c) 2003 David Hull Copyright (c) 2003 Mamoru Komachi Copyright (c) 2003 Rob McMullen Copyright (c) 2003 Yamanobe Kiichiro Copyright (c) 2003 marcus at #fluxbox on freenode.net Copyright (c) 2003-2004 Marc Lehmann Copyright (c) 2004 Sergey Popov Copyright (c) 2004 Terry Griffin Copyright (c) 2004 Mr. Dobalina Copyright (c) 2004-2005 Jingmin Zhou Copyright (c) 2005 Grant McDorman Copyright (c) 2005 William P. Y. Hadisoeseno Copyright (c) 2005 Teun Burgers Copyright (c) 2005 Jingyu Zhou Copyright (c) 2005 Gautam Iyer Copyright (c) 2005 Mark Olesen Copyright (c) 2006 Yoshihiko Kashio Copyright (c) 2006 Frederik Deweerdt mrxvt-0.5.4/INSTALL0000644000175000001440000000576410756127603010671 00000000000000-------------------------------------------------------------------------------- Using GNU auto tools -------------------------------------------------------------------------------- 1. If script `configure' does not exist, execute `bootstrap.sh' to generate it. To do so, you will need GNU automake, autoconf, and libtool. Notice on Solaris, automake and autoconf require perl to be installed in /usr/local/bin, but by default perl is installed in /usr/bin. You can make a symbol link of perl in /usr/local/bin. 2. Run ./configure to generate config.h and the various Makefiles. ./configure --help gives a list of possible options with slightly longer descriptions in README.configure. A quick way to enable all features while disable debug is like this: ./configure --enable-everything --disable-debug 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 Or if you're using a non Bourne-compatible shell, you can do: sh -c 'CFLAGS="-O2 -g" ./configure' 3. Set any other main preferences: Edit "src/feature.h" Edit "config.h" (Only if you didn't use ./configure) If you're cross-compiling, edit the following in "config.h" NO_XLOCALE SIZEOF_* # sizeof some types R*INT*T # types which are the same size # as 16bit/32bit/pointer 4. Build it (repeat step 2 as desired): make 5. Install mrxvt : make install You may also want to install share/etc/mrxvt.terminfo and share/etc/rxvt.termcap 6 a. If compiled with UTMP_SUPPORT but without utempter library support, you may need to install mrxvt with setuid root or setuid/setgid to match the file ownership and permissions on /etc/utmp (or /var/run/utmp). 6 b. You may need to install setuid root anyway for some systems so that they can give you ownership of the tty devices. =================================== NB: SunOS (with/without gcc?) gets reported by configure as #undef STDC_HEADERS #define HAVE_SYS_IOCTL_H 1 but the ioctl() defines aren't protected against multiple inclusion, in this case by so use a hack in "feature.h" to avoid the problem. Gave up checking for `STDC_HEADERS', since they really should be there and I don't want to deal with the problems when they don't exist. SunOS users might complain to the right places and get their system headers fixed so that one day the rest of us won't have to keep compensating :( SVR4 users (that aren't using gcc) will have to add -DSVR4 to CPPFLAGS for configure. mrxvt-0.5.4/ChangeLog0000644000175000001440000002677611045531314011406 000000000000002007-08-23 08:28 Gautam Iyer * configure.ac: Version bump to 0.5.4 2007-08-27 18:54 Gautam Iyer * doc/mrxvt.1, src/rxvtlib.h, src/screen.c, src/xdefaults.c: Removed (obsolete) scrollWithBuffer option. It caused problems if combined with ttyInhibitScroll. Thanks to Krzysiek Pawlik for pointing it out. 2007-08-29 18:43 Gautam Iyer * configure.ac, src/main.c, src/xdefaults.c: Added missing new lines after some error messages 2007-08-31 19:04 Gautam Iyer * src/rxvt.h: Fix typo (thanks to Bill White ) 2007-08-31 19:33 Gautam Iyer * doc/mrxvt.1, src/macros.c: Made ToggleBroadcast accept an option so that input broadcasting can be enabled / disabled (not just toggled). 2007-09-09 00:42 Jimmy Zhou * src/rxvt.h: eliminate warning on mac os x 2007-09-23 01:12 Gautam Iyer * configure.ac, src/macros.c: Added NetBSD portability patches by Tobias Nygren 2007-09-28 01:23 Gautam Iyer * src/feature.h, src/init.c: Defined ACS_ASCII by default, and fixed compile failure 2007-12-11 20:28 Jehan * configure.ac, src/encoding.c: Fix codeset guess from name with modifier '@' + preferred guess method if defined HAVE_NL_LANGINFO 2007-12-11 23:47 Jehan * configure.ac, doc/guessing_codeset.txt.bz2, src/encoding.c: forgot add my name + the mail about guessing codeset + some traces 2007-12-22 12:26 Jehan * src/screen.c: No functional change: only variables def out of a loop but still in limited scope 2008-02-17 22:19 Gautam Iyer * src/feature.h: Reduced the default minimum Xft size to 5. With high resolution displays of today (e.g. my new laptop), this is still quite readable. 2008-02-17 22:44 Gautam Iyer * src/feature.h: On second thought, set the minimum font size to be 1. This way, a user can just set the font sizes to be 1, and get a reasonable (live) "iconified" mrxvt. 2008-03-20 15:28 Frederik Deweerdt * src/command.c: Enhance mouse highlighting the problem was nicely explained by Brice Figureau here: http://www.nabble.com/Really-slow-mouse-highlighting.-to15756056.html The fix is to immediatly process X events if there is only a small (25) number of them to handle. 2008-04-05 19:46 Gautam Iyer * doc/mrxvt.1, src/command.c, src/init.c, src/rxvt.h, src/rxvtlib.h, src/screen.c, src/xdefaults.c: 1. Added options --currentTabVBell to ring a visual bell only on the active tab of a focused window. 2. Added option --vBellDuration for the amount of time to flash the screen. 3. (untested) Compile fixes with #define NO_BELL (I am blessed with a laptop where the PC speaker doesn't work when my sound card is enabled. The above makes my life a lot better...) 2008-04-20 05:39 Gautam Iyer * doc/mrxvt.1, share/default.menu, share/mrxvtrc, src/macros.c, src/protos.h, src/screen.c: Added patch by Marc Schoechlin allowing the paste of clipboard / second selection into mrxvt. 2008-04-20 22:16 Gautam Iyer * src/macros.c, src/protos.h, src/rxvtlib.h, src/xdefaults.c: Bug fix: When a chained macro is defined (say in system mrxvtrc), overriding it via command line or ~/.mrxvtrc with a non-chained macro caused the tail of the system mrxvtrc macro definition to be added to the user macro definition. 2008-04-20 22:28 Gautam Iyer * src/command.c, src/macros.c: Removed debugging info 2008-04-20 22:39 Gautam Iyer * doc/mrxvt.1, share/mrxvtrc: Changed default macros: 1. Removed Ctrl+Shift+x (Paste SECONDARY), since it was previously defined as save config. 2. Changed mrxvt console from Ctrl+Shift+c to Ctrl+Shift+z 3. Bound Ctrl+shift+c to paste the clipboard. Most other keys look like they are used already. If you find a reasonable one that is unused, we can bind it to Paste SECONDARY by default. Otherwise, you can just bind that in ~/.mrxvtrc 2008-04-29 20:42 Gautam Iyer * src/init.c: Display security issue (Gentoo Bug 291750). Only affects LOCAL_X_IS_UNIX users 2008-04-30 20:43 Gautam Iyer * doc/mrxvt.1, share/default.menu, share/mrxvtrc, src/macros.c, src/protos.h, src/rxvtlib.h, src/screen.c: Patch from Marc Schoechlin : paste the contents of a file to the currently active tab (documentation included). 2008-04-30 21:22 Gautam Iyer * ChangeLog, ChangeLog.old, svn-authors.xml, svn-to-changelog.sh: Added scripts to make the ChangeLog file directly from the SVN logs. 2008-05-03 18:11 Gautam Iyer * src/macros.c, src/screen.c: Fixed indent in Marc's patches 2008-05-03 18:35 Gautam Iyer * src/tabbar.c: Used wordexp() to expand workingDirectory 2008-05-03 18:50 Gautam Iyer * src/screen.c: Avoid ambiguous expansions in pasteFile 2008-05-03 18:52 Gautam Iyer * Makefile.am: Put ChangeLog.old in distributed files 2008-05-05 17:59 Marc Schoechlin * TODO: hint for brace/tab style in vim 2008-05-05 18:00 Marc Schoechlin * src/tabbar.c: fixed broken compile 2008-05-12 17:11 Gautam Iyer * bootstrap.sh: Generate dummy ChangeLog if it's not present. 2008-05-12 20:45 Gautam Iyer * configure.ac, src/screen.c, src/tabbar.c: #ifdef all code using wordexp 2008-05-14 18:56 Marc Schoechlin * bootstrap.sh: fixed syntax error 2008-05-14 19:04 Marc Schoechlin * share/mrxvtrc.sample, src/menubar.c: fix: enabled debug-mode deactivated menu funcionality, menu is now activated as default 2008-05-19 17:37 Gautam Iyer * src/macros.c, src/menubar.c: Accept profile numbers greater than 10. 2008-05-19 17:51 Gautam Iyer * TODO, svn-authors.xml: Add Marc's name/email to svn-authors. 2008-05-19 18:30 Marc Schoechlin * src/debug.c: rxvt_msg: automatic adding of newline if fmt does not end with a newline 2008-05-19 18:52 Gautam Iyer * src/debug.c: Avoid strrchr when checking for trailing newlines. (No search beyond the last char is required). 2008-05-19 19:09 Gautam Iyer * share/mrxvtrc.sample: Made comment match example for autoHideTabbar 2008-05-20 17:51 Marc Schoechlin * TODO: corrected typo in funtionname, unsure if the bug still exists 2008-05-26 18:50 Marc Schoechlin * src/command.c, src/macros.c: beautify code, very simple changes 2008-06-02 17:38 Marc Schoechlin * src/encoding.c, src/init.c: cleanup for proper build, rxvt_dbgmsg: wrong number of arguments, end: unused variable 2008-06-02 17:44 Marc Schoechlin * src/command.c: trivial reformatting 2008-06-02 18:47 Gautam Iyer * src/encoding.c: The variable "end" is used if HAVE_NL_LANGINFO is not defined. Add back the variable "end" in this case. 2008-06-10 21:28 Gautam Iyer * src/command.c, src/xdefaults.c: Fix compile warnings on Solaris (Ethan Mallove, Cyril Romain) 2008-06-11 02:19 Gautam Iyer * src/screen.c: Made inline functions static (Avoids warnings on Solaris -- Ethan Mallove) 2008-06-13 19:09 Gautam Iyer * src/init.c: s/NAME_MAX/FILENAME_MAX/ (Solaris fix, Ethan Mallove) 2008-06-13 20:31 Gautam Iyer * src/command.c, src/xdefaults.c: Oops. Revision 289 assumed "a ?: b" was equivalent to "a ? NULL : b". This is FALSE. It is in fact equivalent to "a ? a : b". 2008-06-16 20:37 Gautam Iyer * src/command.c: Bugfix -- Sometimes when the mrxvt window is completely obscured, mrxvt starts "polling", causing lots of wake-ups and bad battery sucking behaviour. This patch fixes this. (While the fix is small, it took a long time to hunt down.) 2008-06-23 17:59 Marc Schoechlin * src/tabbar.c: wondered why background filling of active tab does not work and discovered that this is inactive if transparentTabbar is enabled, for clarification in future i added debug output 2008-06-26 18:16 Marc Schoechlin * share/mrxvtrc: Beautified default configuration, mrxvt looks now a bit more appealing in default configuration. The menu is visible as default 2008-06-29 19:39 Marc Schoechlin * TODO, doc/mrxvt.1, share/mrxvtrc, share/mrxvtrc.sample, share/submenus.menu, src/command.c, src/macros.c, src/rxvt.h, src/rxvtlib.h, src/tabbar.c, src/xdefaults.c: - first release of new tabmonitoring feature (inactivity, activity or automatic detection) - new configuration directives - new macro 'MonitorTab' - monitorTimeout, specifies the timeout for detecting the type of monitoring and the timeout for detecting inactivity - monitorCommand, specifies a command which will be executed in background if a monitor event occurs - new feature is configured as a hotkey and in the menu - documentation included - feature removed from the TODO file - the "i don't care about soccer" release :-) 2008-06-29 21:49 Gautam Iyer * share/mrxvtrc, share/mrxvtrc.sample: Ctrl-Shift-W is already used, so don't rebind it by default. 2008-06-29 22:07 Gautam Iyer * share/mrxvtrc: Added 80% background shading as default. (But did not enable transparency by default). THis way someone who toggles transparency at run time will see a transparent background. 2008-06-30 05:14 Marc Schoechlin * TODO: modified vim-modeline in coding guidlines to a tabwidth of 80 characters 2008-06-30 05:14 Marc Schoechlin * src/command.c, src/rxvtlib.h, src/tabbar.c: modified vim-modeline in coding guidlines to a tabwidth of 80 characters 2008-06-30 06:28 Gautam Iyer * TODO: Added an expanded description of the coding style, as pointed out by Marc 2008-07-08 18:24 Marc Schoechlin * src/rxvtmem.h: fixed headline 2008-07-08 18:35 Marc Schoechlin * src/command.c: trivial ident cleanup 2008-07-09 19:34 Marc Schoechlin * doc/mrxvt.1, share/mrxvtrc, share/mrxvtrc.sample, src/command.c: - added escape and percent interpolation for the 'MonitorCommand' configuration option - mapped the "MonitorTab AUTO" macro to the currently unused "Ctrl+Shift+g" combination - minor ident fixes in src/command.c 2008-07-09 21:34 Gautam Iyer * src/command.c: Fix indent 2008-07-24 22:09 Jehan * src/rxvt.h: Just removed HAVE_LIBX11 everywhere in the code: mandatory lib mrxvt-0.5.4/COPYING0000644000175000001440000004311010756127603010656 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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. , 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. mrxvt-0.5.4/CREDITS0000644000175000001440000000272110756127603010646 00000000000000This is at least a partial credits-file of people that have contributed to the Mrxvt project and their contributions. There are many other people who reported bugs, submitted patches, and contributed documentations. Their names should appear in other places, like the source code and documentations. Team contributors: . Xterm team for the xterm . Rxvt team for the rxvt . Aterm team for the aterm . Eterm team for the eterm . Multi-aterm team for the multi-aterm . Rxvt-unicode team for the rxvt-unicode . Sourceforge for hosting the project Individual contributors: . Bartosz Fenski for pushing mrxvt into Debian project. . Shen Chuan-Hsing for the FreeBSD porting effort. . Qingning Huo for all the suggestions, discussions and testing, and his efforts in maintaining Debian packages. . Avi Yagodnick for contributing the perl script to manipulate mrxvt through escape sequence. . Scognito for contributing the beautiful icons for mrxvt. . David Yeske for creating the initial freebsd port. . Jingyu Zhou for contributing the Fedora Core 3 binary. . Matthew Melendy for creating the VB script to launch mrxvt directly through a Windows shortcut for Cygwin platform. . Eric Moors for building the redhat 9 binary for i386 platform. . Xiong Jiang for building the debian binaries for i386 platform. . All the nice people involved in testing, reported bugs and sent me suggestions. :-) . Yaping Liang for providing Solaris 9 access . Weiwei Gu for providing IRIX 6.5 and Mac OS X access mrxvt-0.5.4/ChangeLog.old0000644000175000001440000040524111006157132012146 000000000000000.5.2 to 0.5.3 \----------------------------------- Gautam Iyer * Bug Fixes: 1. Handle EIO errors (got when tcsh / fish exit) properly. Patch by Zoltan Szalontai. 2. Disabled Shift+Enter shortcut by default, since it may confuse new users. 3. Make Alt+Enter behave like Xterm. 4. Added %T,%G,%P flags for percent interpolation (useful for dtach). 5. Bold colored text is rendered in BOTH bold font, and bright color. Use only bold font. 6. r->num_fds is properly reduced when tabs are closed 7. Ignore focus events of type NotifyGrab and NotifyUngrab. This caused an annoying blinking when focussing other windows via the keyboard. (Thanks to Roman Po??zka for pointing this out). 8. Removed the --focusDelay option (no longer necessary with above bugfix). * Enhancements: 1. Added --titleFormat and --winTitleFormat options to control display of tab and window titles. 2. Added options --veryBright and --boldColors to control how bold primary colors are rendered. 3. Added --useFifo option, to make mrxvt listen for macros on a fifo. Code based on patch by Jozef Vesely. 4. Added Raise macro to "raise" the mrxvt window. Thanks to Jozef Vesely for the patch. 5. Added a UseFifo macro to enable / disable --useFifo at runtime. Defined a macro that opens a "mrxvt console" in a new tab (bound to Ctrl+Shift+c by default). Added --enable-use-fifo compile time option for people paranoid about security. 6. Added BOLD_BRIGHTENS_256_COLORS option in feature.h which attempts to brighten even non-primary colors instead of drawing them in bold. (Respects boldColors and veryBright). 7. Made winTitleFormat a profile option. 8. Added -ic option to set the application icon. (Adapted from patch #1656294 by Stanislav Mekhanoshin) Jimmy Zhou * Enhancements: 1. Check locale for encoding method if it is not specified by -km option or multichar_encoding resource. 2. Add new debugging facility such that a user can specify the message type and verbose level by command line options. Run `mrxvt -dmask whatever -dlevel something' for details. 3. Fix compile error when use Sun Studio 10. Thanks to Quintin Beukes for the patch. 0.5.1 to 0.5.2 \----------------------------------- Gautam Iyer * Bug Fixes: 0. Did a HUGE REWRITE of the multi-tab code base. Incomplete escape sequences longer cause lockups. Really busy tabs no longer starve everything else! 1. Fixed detecting xft support if xft-config is missing. 2. Fixed segfault obtained when the last macro in r->macros is executed 4. Convert sources from ts=8 to ts=4. Yes ts=8 was a bug :). Added a script ts4to8.pl to do this. 3. Make text under cursor visible if cursorcolor2 is not defined. 5. Added "Exec" macro to execute external programs 6. Added % expansion to macros. %s=selection, %t=tab title, %n=tab#. 7. Added a menu option to open the selection in a new tab in mutt / w3m, or in firefox. 8. Implemented a "-into" option to embed mrxvt into. Thanks to Bruno Deferrari for the patch. 9. Fix buffer overflow. Thanks to Frederik Deweerdt for the patch. 10. Made -ufbg and -fade options work under Xft ;). 11. Font specified with --boldFont is correctly handled (even if it's of a different dimension). 12. Exited tabs are now correctly held. Output from them is not lost even if they exit very quickly. 13. Rewrote the -ufbg and focus fading code completely. Now works correctly if tabs are switched on on unfocussed window, or if the bg is changed (via an escape sequence) from an inactive tab / unfocussed window. 14. Removed round trip to server when allocing Xft colors. (Reduces protocol requests by about 750 on startup, which should speed things up on a slow connection). 15. Defined CURSOR_COLOR_IS_RENDITION_COLOR by default in src/feature.h. This makes the cursor better visible when the cursor color is not defined, and makes the behaviour similar to the default behaviour of Xterm. 16. BugFix: Str and Esc macros caused a beep on execution. 17. Updated examples / menus to use new word splitting. 18. When user closes the mrxvt window, don't forcefully exit. Instead send SIGHUP to all child processes, and wait for childs to exit. Previous behaviour caused problems if the child produced some output on SIGHUP, or took a few seconds to exit. * Enhancements: 0. Really busy tabs (even with Xft+anti aliasing) no longer starves anything else! 1. Reduced memory footprint by roughly 5kb. 2. Converted all source files to use the standard ts=8 for easier diffing / online viewing. 3. Added a --focusDelay option to collect focus changes events over an interval. This is mainly to work around a bug in some window managers. 4. Xft bold fonts now actually use the bold font, instead of over striking. 5. Added a --xftBoldWeight option to control the weight of the Xft bold font. 6. Made --holdExit a string option, so that tabs can be held based on the exit status of the child. 7. Added --holdExitTitle and --holdExitText options to specify the title of an exited tab, and the text printed in the tab of an exited child process. 8. Removed the "jumpScroll" option, and replaced it with --refreshLimit and --skipPages (see man page). 9. Changed word splitting of commands executed via NewTab and exec macros. Now words are split only at spaces or tabs (unless backslashed). If command starts with "!", it is passed to /bin/sh -c, which does all the word splitting / executing. For the old behaviour define INERNAL_WORD_SPLIT in src/feature.h. Jimmy Zhou * Bug Fixes: 1. Fix mrxvtset.pl as pointed by Avi Yagodnick. 2. Fix mouse button 4/5 behavior. Make it the same as firefox as pointed out by Yoshihiko Kashio. 3. Fix reverse video when foreground/background colors are not defined. Thanks to Yoshihiko Kashio. 4. Disable slave macros in the macro chains if the first (master) macro is defined as dummy. 5. Fix off-focus fading. Thanks to Ken Zalewski for the report. 6. Add macros to check and set options. Extend the number of options. 7. Add macros to check and unset X resources. 8. Add macros to check and set NULL pointers. 9. Fix some freeing NULL pointer issues. 10.Fix black and white icons. Thanks to William Poetra Yoga Hadisoeseno for the patch! 11.Lots of code cleanup in command.c:rxvt_cmd_getc. Previously it is lengthy and nearly unmaintenanble. 12.Fix round-robin algorithm of command.c:rxvt_find_cmd_child. 13.Fix crash if click on empty space of menubar. Thanks to Zhu Qunying for the patch. 14.Fix severl compile error - we must call DBG_MSG after variable declaration in functions as we are using C, not C++. Thanks to lzl@mitbbs.com for bringing this issue to me and provide patch. 15.Fix unclosed file descriptors in child process. 16.Fix session support. We actually did not listen on it because the number of open file descriptor is small - we did not count it! * Enhancements: 1. Add --with-max-profiles to configure script as suggested by Avi Yagodnick. 2. Add experimental fast (hopefully) memory management code. It is disabled by default. 0.5.0 to 0.5.1 \----------------------------------- Jimmy Zhou * Bug Fixes: 1. Compile error at rxvt_free_clipping (screen.c) when XFT support is not enabled. 2. Fix typo in acute acent. Thanks to Benedikt Magnusson for the bug report. 3. Fix file descriptor leakage - we should close /dev/ptmx after forking. Thanks to Edgar Toernig for the report and patch. 4. Always show cursor while mrxvt loses focus. Thanks to Edgar Toernig for the patch. 5. Adjust several limits, e.g., max border width and min blink time according to Edgar Toernig's patch. 6. Fix rpmbuild (Sourceforge Bug #1482311) 7. Fix crash on OpenBSD 3.9 when MULTI_CHAR is enabled - the variable morecur (defined as char) in screen.c is treated as unsigned (WtF!). 8. Fix compile error on OpenBSD 3.9 when MULTI_CHAR is enabled (OpenBSD keeps playing game with us!). 9. Saving session behavior now conforms to profile support. 10. Apply patches from FreeBSD ports. 11. Fix crash on Solaris when calling XLookupString. Xlib manual states that a portable program should pass NULL to the last (compose) parameter. 12. Add mrxvt 0.4.x compatible keyboard combinations to mrxvtrc. They are disabled by default though. Thanks to Mihail Zenkov for the report and Dimitri AT sun.com for the solution. * Enhancements: 1. Enable multiple bold fonts. Thanks to Edgar Toernig for the patch. 2. Add Fink package build. Thanks to Jeremy Anthony for the submission. Gautam Iyer * Bug Fixes: 1. Macros now ignore the state of caps lock (as they should). 2. The highlight flag is now set even if the tabbar is hidden (so showing the tabbar will show which tab produced the beep). 3. Macros without modifiers did not work. Fixed this. 4. Ignore SIGHUP (caused exit when parent shell is killed). 5. Ignore SIGPIPE (caused exit when print command crashes). 6. Some Xft fonts, e.g., aquafont, report double the actual width. This cause some text being clustered together while the cursor and user input have double size. Test, and correct for this. Notice that this fix will work for fontconfig 2.3.2 (as we have tested) or later version, and you must run ``fc-cache -f'' after upgrading fontconfig. It will not work for fontconfig 2.2.3 and earlier versions due to the bug of fontconfig. 7. Also dump initial tab titles when the --cmdInitTabs options are given (this used to cause incorrect behaviour when the user closes tab 0, and opens a new tab). 8. Fixed bug #1473987. (Jagged edges of screen fonts) 9. Fixed bug #1357219. (Made bg changes via escape sequences sticky) 10. Saved configuration file is now profile compliant. 11. Setting the tab title via \e]0 behaves like \e]2 (i.e. honors the macros SET_TAB_TITLE_ON_XTERM_SEQUENCE & SET_TAB_TITLE_NOT_WIN_TITLE defined in feature.h). Previously only \e]2 would honor these macros. To only set the window title, the new escape sequence \e]60 has been added. * Code cleanup: 1. Made coding & comment style similar to that of Vim (works well with Vim7's syntax folding). 2. Removed --confFileSave option. It's no longer needed as the SaveConfig macro accepts an argument. * Enhancements: 1. Warn if closing mrxvt with multiple tabs (and the tabbar is hidden). 2. Code cleanup (OK. That's not really an enhancement for users) 3. Update documentation. * New features: 1. Changed the behaviour of the --vt%d.xx resources. The settings are now tied to profile %d (as opposed to the %d'th tab). A new tab with profile %d can be opened on demand, or on startup. 2. Added option --initProfileList to replace -tnum. (Marked -tnum as obsolete). 3. Removed option --cmdInitTabs as it is no longer meaningful with profiles. 4. When the command specified via the --profile%d.command option is prefixed with an '!', run the shell first and then execute the command. Removed the --tabShell option (as the prefix with '!' is more flexible). 5. Macros can now be chained (i.e. you can execute upto 16 actions in sequence with any macro). 6. Made the print screen macro take a command argument. You can use this to define a macro to open the scroll back buffer in less (for instance) in a new tab, and search regexp's to your heart's content :). 7. Made the extra height of active tabs, and radius of tab corners compile time options. 8. Added a --workingDirectory (profile) option to set the working directory of new tabs. Set to "." to use the cwd of the active tab. 9. Added a ToggleFullscreen macro. (Use with --smoothResize enabled). 0.4.2 to 0.5.0 \----------------------------------- Gautam Iyer * Bug Fixes: 1. Bug #1301269: Make ACS graphics / line drawing characters work under Xft. 2. Bug #1337635: Made ColorBD/HL work under Xft. 3. Fixed pseudo-transparency when the root background is tiled on the desktop. 4. Numerous fixes to options to match the documentation (see CVS logs). 5. Partially fixed "transparentForce" option (see man page). 6. Enabled pointer blank under Xft. 7. Fixed text shadow. 8. Enabled Xft with menus. 9. If we're unable to exec the shell (or command specified), print an error message and exit gracefully. (Thanks to Eygene Ryabinkin). 10. Fix crash after XIM quits. (Thanks to Gary Zhang for pointing it to us, and attach the patch). 11. Fix XIM preedit problems (Thanks to Yoshihiko Kashio for the patch), including: - wrong calculation of the preedit area size with hide/show bars - updating the size of the preedit area with resizing window - updating the fontset of the preedit area with changing font size - the linespace of the preedit area is not configured - the preedit character is not drawn on the font baseline - clean up codes related to XIM 13. Fix compile on cygwin by implementing strcasestr. 14. Added a macro XTERM_KEYS to feature.h. If defined, then modified function keys will send the same escape sequences as Xterm. 15. Fixed DEC sequences sent by the numeric keypad. * Enhancements (Performance): 1. Reduced memory (xresource) usage under pseudo-transparency. 2. Made performance improvement to expose events (especially under Xft). Dragging some other window over mrxvt no longer causes any flicker :). 3. Decreased CPU usage when not focused. 4. Rewrote tabbar drawing routines to eliminate flicker on expose. 5. Optimized screen drawing routine with "caching": Causes notable performance improvement under Xft. * Enhancements (Appearance / Features): 1. Updated documentation! (Includes shiny new almost complete man page). 2. Make tabbar apearence more intuitive: Use itabBackground instead of tabBackground for the background of the tabBar so that the active tab stands out better. 3. Make highlighted tabs stay highlighted until activated. 4. Fixed borderless windows (thanks to Jonathan Black for the patch). 5. Added popup menus. Ctrl left/right click pops up menus. 6. Right click on tabbar now pops a menu listing all tabs. 7. Rewrote tabbar drawing routines. Tabs now have rounded tops. Also made the active tab bigger than the others (like Konsole). 8. When clearing the primary screen, we move the text into the scrollback buffer (instead of discarding the information completely). Thanks to Sabit Sayeed for the suggestion. * New features: 1. Added option -htb (--highlightTabOnBell) to highlight inactive tabs only when a bell sounds. 2. Added option -mtw (--maxTabWidth) to set the maximum displayed with of each tab. 3. Added option --smoothResize to resize the window in pixel increments instead of by char. Useful for fullscreen / maximizing. Requires frills. 4. Added option --fullScreen to make window fullscreen. 5. Made feature --enable-smartresize into option --smartResize. Make smart resize aware of window manager decorations. Requires frills. 6. Added option -aht (--autohideTabbar) to automatically hide the tabbar if there is only one tab, and show it if there are more than one tabs open. 7. Added a "hard reset" hotkey. Thanks to Pavel Gorshkov for the patch. 8. Added --enable-xrender compile time option to use XRender alpha blending to tint the background under pseudo transparency. 9. Enabling tinting transparent tabbar / menubar with their background colors. Requires XRender. 10. Added --bgRefreshInterval option specifying how long we should wait before refreshing our background. This avoids laggy delays while dragging the window. 11. Added hotkeys ScrollHome and ScrollEnd to scroll to the beginning and end of the scrollback buffer. Bound these by default to Shift+Home and Shift+End. 12. Added option -xftpfn and -xftpsz to specify the name and size of a propotionally spaced font for the tabbar / menubar. 13. Added support for Firefox like tabs: All tabs have the same width, and they shrink as tabs are added. Requires xftpfn 14. Added option -mvt to determine the minimum number of tabs to keep visible. 15. Added CloseWindow hotkey and escape sequence. 16. New tabs now open in the current working directory of the active tab. 17. The "hotkey" feature from mrxvt-0.4.2 has now been replaced with a "macro" feature. This reduces the code size slightly, and provides added functionality. 18. Implemented a "ToggleMacros" function to toggle using keyboard macros. Renamed options "-dh" and "-ddh" to "-dm" and "-nsc" respectively. 19. Added feature to move tabs by dragging. * Code cleanup: 1. Removed the SCROLL_ON_* features. These can all now be implemented using hotkeys. 2. Cleaned up menubar code. 3. With -xftpfn the menus now look good :). And you have your precious Control right click menu from Xterm. 4. Changed default scroll bindings to only work on the primary screen. 5. Fixed code indent (and added lots of comments) in lots of places. 6. Removed compiled in keyboard shortcuts (e.g. Ctrl-+ font resizing). This can be done with macros, and the macros method provides added flexibility. 7. Removed support for getting resources using the X resource database. Now resources are only read using ~/.mrxvtrc. * Incompatible Changes: 1. Tinting works differently with XRender. See -tint in the man page. 2. The default terminal is now "rxvt" instead of "xterm". This causes trouble on some systems where the "rxvt" termcap / terminfo entries are not correctly setup. 3. The old "hotkey" feature has been removed. Use the "macro" feature instead. 4. Mrxvt menus are now incompatible with rxvt. Mainly because the menu-action works similar to the macro actions, which extends the functionality of the old rxvt menus. 5. Quite a few escape sequences controling tabs have been disabled for security concerns (e.g. creating, closing and moving tabs). All these functions can be accessed through macros, and menus. (The idea is that only interactive users should have access to these functions. 'cat'ing a text file with these escape sequences should not produce such effects. 6. A few default bindings were changed for consistency (and might be changed again). Jimmy Zhou fix bug under XFT that ColorBD/ColorHL are ignored (Sourceforge Bug ID# 1337635). Thanks Gautam Iyer for the patch. fix screen flicker behavior when pseudo-transparency is enabled and mrxvt is off-screen. Also fix a BadMatch error. Thanks a lot to Gautam Iyer for the clear explanation of the problem and his nice patch. fix code of highlighting inactive tabs when they receive some output. Add an compile option HIGHLIGHT_TAB_ON_BELL into feature.h (disabled by default) so that inactive tabs are only highlighted when they receive bell. Also make highlight bold. Thanks Joshua Wise for the suggestion and patch. fix hot key parsing. Primary flag should not be checked like ctrl/meta/shift flag. fix button click action on tabbar based on Mark Olesen's patch. Now scroll-up and scroll-down clicks (Button4 and Button5) will active the previous/next tab. In addition, only clicks of Button1 will activate the button functions. fix hotkey handler to kill a tab according to Mark Olesen's suggestion. That says, if there is only one tab left, we shall not kill it to quite the entire terminal. This behavior is the same as gnome-terminal. 0.4.1 to 0.4.2 \----------------------------------- Jimmy Zhou add question of emacs hotkey and answer in FAQ. add option to load application icon, not implemented yet. fix display problem when both bottomTabbar and hideTabbar are enabled (Sourceforge Bug ID 1299309). fix signal sent to child process when quit a page. We now send SIGHUP instead of SIGKILL to be more graceful. fix compile error on OpenBSD 3.7. fix missing iconv library on OpenBSD 3.7. fix prematurely stop of tab title sequences on ^C. Thanks to Johann 'Myrrkraverk' for the report and patch [Sourceforge Bug ID 1211691]. If any of you dislike the patch, please blame Johann instead of me. ;-) fix default 256 colors. When XTERM_COLORS is defined, we use the same colors as xterm. Thanks to Gautam Iyer for the patch. fix trailing space in selection by porting Marius Gedminas's patch for rxvt - we will not copy trailing space in mouse selection. Thanks to Mun Johl for pointing me the patch. fix 64-bit bugs reported on debian fix default maximal number of tabs to 15. fix configure.ac. Revert back the LINUX_KEYS check (disable it) since it causes lots of complaints. :p I think LINUX_KEYS mean to use Home/End keys as Linux console. But X terminals like mrxvt are different. add a new configurable X resource for Linux console style Home/End keys instead of fixing it in the source code. fix rxvt_process_hotkey interface, simplify it by eliminating the three mask variables. fix escape sequence of F1 - F4. Now we introduce a *magic* check to determine the terminal type at run-time and send correct escape sequence accordingly. To support this feature, we also introduce a new escape sequence to let user tell mrxvt that terminal type has changed at run-time. To be clear, normally user changes the TERM environment variable in shell. However, this change is not visible to mrxvt! So the user must tell mrxvt that the TERM environment variable has been changed using this new escape sequence. Thanks to Johann Oskarsson for the report and patch. 0.4.0 to 0.4.1 \----------------------------------- Jimmy Zhou add mrxvt.spec file based on Jingyu Zhou's work. This file is used to build RPM packages. fix Korea encoding according to rxvt sourceforge bug id 1181825. fix tinting on Window Manager other than WindowMaker. fix dead key support. Add a hack to enable dead key manually. User must press dead key twice or press dead key and space to input the characters of dead keys themselves. This is a temporary solution. It may be changed in future release. To enable this feature, define USE_DEADKEY in feature.h. Thanks to wwp for all the help on this issue. fix infinite loop on Solaris when a child exists. Thanks to Sunil for the patch. fix cursor color is rendition color by applying William P. Y. Hadisoeseno's patch. But disable it in feature.h by default. fix FAQ of Home/End key question. fix malloc function check in configure.ac, and apply a patch to rxvt_malloc when the size is 0. On Tru64/OSF, malloc(0) returns NULL pointer. We want to avoid this behavior. Thanks to Teun Burger. fix crash when saveLines exceeds 65535, hopefully. fix help message. Print it to stdout instead of stderr. fix lots of compile warnings, thanks to Teun Burger for the report. fix compile problems on Tru64/OSF based on Teun Burger's patch. fix manpage of hotkey inhibit options. fix manpage of special hotkey symbols. fix freezing with mc in bash when viewing a file in tar files. This is because the read syscall blocks when trying to read more data from the child process. Strange problem since it seems good in tcsh. [Sourceforge Bug ID: 1103548] 0.3.13 to 0.4.0 \----------------------------------- Jimmy Zhou add option tabShell in order to execute shell before running tab command in the tab. Thus the tab will not quit if the tab command exits. fix definition of macro LINUX_KEYS based on luohui's suggestion. We define the LINUX_KEYS macro if the OS probed by the configure script is Linux. Thus, we can use Home/End key to reach the beginning/end of a command line. (But it seems not effective on my system :-() fix option and resources for tab sessions. Now we change them to tab commands to avoid confusion with X session. Notice that all resource names and command line options related to each tab have been changed! In particular, follow these: mrxvt*vt%d.session -> mrxvt*vt%d.command mrxvt*cmdAllSession -> mrxvt*cmdAllTabs mrxvt*initSession -> mrxvt*cmdInitTabs -vt%d.ss -> -vt%d.e -cs -> -at -is -> -it fix question about synchronizing tab title to current directory for C shell in FAQ based on Nicholas Carrasco's solution. fix default terminal type in configure script. Change it from rxvt to xterm to avoid wired bash behavior for very long command line. Thanks to Luohui for the report and digging out the solution. fix core dump if the child process quits too fast. In this case, read syscall returns -1, but we didn't handle it carefully and moved cmdbuf_endp backward! fix typo and man page for key bindings according to Elan Ruusamae's suggestion. fix off-by-one byte buffer overflow when parsing the X resources using XrmGetResource [Sourceforge Bug ID: 1117722]. 0.3.12 to 0.3.13 \----------------------------------- Jimmy Zhou add configure option --enable-minimal to only enable minimal number of configuration options. So people who want a slim mrxvt can simply their configuration command line. add escape sequence to change bgfade degree at runtime. fix xdefaults.c. Merge Grant McDorman's patch that correctly handles the vt%d.BlahBlah resources. Many thanks to Grant! fix input buffer filling case. It means that there is space in the beginning of the input buffer, but no space at the end of the input buffer. In this case, we can move the content of the input buffer forward to free space. fix input buffer overrun in rxvt_cmd_getc. The input buffer size should be (BUFSIZ-1 - (cmdbuf_endp - cmdbuf_base)) instead of BUFSIZ!!! Thanks to Carsten Menke for reporting the bug. fix the missing -sm option in session management restart command. fix compile error of xfticonv if iconv.h is not found. This seems to be a common problem on Cygwin for some Chinese users. So if your mrxvt can display CJK text using X11 fonts, but not XFT fonts, check whether HAVE_ICONV_H is defined in config.h when you compile mrxvt! fix tab number when saving terminal status in session management. Ooooops, we miss the first tab whose index is zero!!! fix leakage of the highest file descriptor to child process. In the past, this can be considered as a potential security bug. But, only in theory... :p fix tab moving behavior when move first tab to left or last tab to right. Disable the moving in these two cases because they are too complicated to code correctly. :p [Sourceforge bug id 1107773] fix behavior of xterm escape sequence of setting terminal window title. We also set the current tab's title so that if the user "set titlestring=%f" in ~/.vimrc, the current tab's title is set to the opened file as well. I have found it very useful to browse among multiple tabs that have different files opened. If you do not like this behavior, uncomment the macro SET_TAB_TITLE_ON_XTERM_SEQUENCE in feature.h. fix behavior of xterm escape sequence of setting terminal window title. We introduce a new macro SET_TAB_TITLE_NOT_WIN_TITLE to avoid setting window title at all. This is used to help vim since vim restores the window title using old window title when it exits. This can be annoying - try it and you know the reason. If you do not like it, uncomment the macro in feature.h. fix poor response speed of the active tab if there are busy activities in the inactive tabs. Now in rxvt_cmd_getc, we first try to return the active tab if it contains input data. If there is no input data in the active tab, we process the X events to see if they can push input data into the active tab. If still not, we return other tab that contain input data. If all tabs have no input data, we select on all tabs and then pick a tab to return. This is a major fix that delays our 0.4.0 release. But hey, we want a stable 0.4.0, right?! fix tab lockup. It happenes when a tab is particular busy, thus the tabs on the right side of this tab are locked up. fix configure script: fix check of the utempter, xpm, jpeg and png options, fix default option of mouse slip wheel and ttygid. fix pseudo-transparency when opacity is not enabled. fix compile error when utmp is disabled. fix manpage for the description of %d. 0.3.11 to 0.3.12 \----------------------------------- Jimmy Zhou add option to enable/disable X session management, compatible to Xterm. add hotkey function CopySel and PasteSel to copy and paste selection. The CopySel function is used to copy the selection in current terminal to the X clipboard, but it is not yet implemented. The PasteSel function is used to past the selection in current terminal or the X clipboard into the terminal. It is working now. But be careful that define it as Ctrl_v may break something! For example, in vi, you might want to replace the character ^M, which requires you to type in Ctrl_v and Ctrl_m. add meta key Primary so that a hotkey can be disabled when the terminal is using the secondary screen. This is useful for the above problem (Ctrl_v). fix X properties, merge them into global Atom array r->h->xa[]. fix setting terminal window title. Now we support UTF-8 terminal titles, which makes it work when we use multichar strings as terminal title. fix half shadow configuration option, show its value only when rxvt scrollbar is enabled. fix help message for modes, make them consistent. fix resource name in man page. Replace XTerm.ResourceName with mrxvt.resourceName to avoid confusion. fix resource name of backspace key, delete key, selection style, and print pipe. Standardize them as other resource names. This will break old rxvt style resource names, but cause less confusion. fix random bold text under XFT. We disable the bold XFT font in order to fix it. This should be a temporary solution. fix rxvt_clean_exit. Kill all child processes there since zsh puts them into background if we do not do so. Thanks to Rob Eberts for the patch. fix slow scrolling when XFT antialiasing is enabled. We just disable screen refresh at all on scrolling. Now scrolling is super fast, e.g., takes about one second to `ls -l /usr/bin'. I guess it probably is the fastest in the world. But there is no visual effect of scrolling any more. There is not a perfect world, right? :p fix poor performance of mouse wheel scrolling when XFT antialiasing is enabled. Basically, we just disable screen refresh on scrolling. Thanks to Jacques Bouchard for the report. fix missing mouse wheel scrolling macros in feature.h. fix compile error when mouse wheel is defined. fix meta8 and mouseWheelScrollPage option. Now they can be enabled by command line options. fix cutChars resource and its man page option. Thanks to Ashish for the report. fix scrollTtyOutputInhibit man page option. Thanks to Ashish for the bug report. fix missing parameter when calling rxvt_scr_move_to under SCROLL_ON_HOMEEND_KEYS feature. Thanks to Ashish for the report. fix rxvt_get_pty. Avoid potential compile error for C compilers. fix mrxvtset.pl. Replace the control character (^[) with its digital forms to avoid the side effect if a user accidently cats the script in shell. fix configure.ac. Non-GNU C compilers like SUN's cannot accept -Wall and -fPIC options. fix rxvt_init_hotkeys. Use ANSI_C compliant function instead of GCC extension. Thanks to Grant McDorman for the patch. fix Cqual qualifiers, non-gcc compilers do not support it. Thanks to Grant McDorman for reporting this issue. fix possible integer overflow in throttle bell. Also comment out this feature in the feature.h. fix crash on XftPatternDestroy if we change the font size in reverse order, e.g., increase the font size then decrease it. It seems that we should not destroy the pattern returned by XftFontMatch. But there is no documentation to explain it clearly! :-( fix rxvt_save_options. Do not save undocumented features :p fix keyboard deadlock when Shift_Home (increasing font) is pressed, and XIM is enabled, but XIM is not successfully opened. This is because the same keyboard events are filtered away by rxvt_cmd_getc. fix button pixmaps. Narrow the width of the pixmaps so that it is the same as the height. fix iso8859 fonts. We will only use iso8859-1 fonts as default fonts. fix multichar encoding routine. Since we set the default encoding method (MULTICHAR_ENCODING) in config.h anyway, there is no need to *guess* the encoding method from locale if user has not supplied it in command line option or X resources. Now the encoding routine should be much more clear and simple. fix multichar encoding list. fix session restart style, pw init value and callback functions. fix session restart parameters. fix man page for the mfont resource case problem. fix compile error because the const definition of ttydev. fix configure script for the missing check of limits.h. It is required on cygwin. fix xdefaults-sample.txt, giving example to disable tricky hotkeys that are used by emacs. fix drawing button frame. Now the buttons should seem more pretty. fix shortcut key bindings of Shift_Home and Shift_End. fix rxvt_hotkey_save_config. If HOME environment variable is not defined, do not call rxvt_save_config. fix rxvt_Exit_signal, call rxvt_clean_exit directly instead of sending the signal again to the default signal handler. They should have the same effect, but the fix may avoid hanging the terminal. 0.3.10 to 0.3.11 \----------------------------------- Jimmy Zhou add Avi Yagodnick's perl script to print escape sequence for manipulating mrxvt runtime behavior. So users need not to compile the sample settitle.c any more if they have a perl interpreter. add command line option -ddh to avoid loading default hotkeys. add escape sequence to toggle hotkeys. add option disableHotkeys to disable hotkeys. add option confFileSave and hotkey to save the configuration of current running mrxvt process. fix default jumpScroll threshold. Increase it to 4 in order to get better scrolling performance. fix veryBold font option. Use veryBold font by default because of the panic screams from the users. ;-) fix plain scrollbar residual pixels under transparency. Thanks to Matthieu Serrano for the bug report! fix off-focus fading wired behavior. It is because the foreground and background color of GC is not updated in the function rxvt_set_bg_focused. Therefore, the following text is drawn using the old color till a color change happens later. fix X session management crash. fix file descriptors leak to the child processes. fix mrxvt hangs on zsh if session management is enabled: we need to prevent the file descriptor opened by session manager from being leaked to the child processes. And there is a race condition when we handle the ICE file descriptor while the terminal exits. fix broken configure options (oooops! nobody has reported these problems ;-). fix compile error when tinting is disabled but fading is enabled. fix scrollTtyOutputInhibit. fix hotkey routines. We optimize it by using function pointers and merge three individual flags into one integer. Thanks to Qingning Huo for the suggestions. fix compile error on rxvt_init_font_fixed if xft is disabled. fix the name of icon files and description file in mrxvt.SlackBuild script. fix documents. 0.3.9 to 0.3.10 \----------------------------------- Jimmy Zhou add Scognito's beautiful icons for mrxvt. Now mrxvt has official icons! :-) add Pascal Bleser as SuSE package maintainer. add a new option to synchronize icon name with active tab, based on Terry Griffin's patch. add hotkey and escape sequence to toggle background transparency. This feature is experimental, though. It may not work well with tinting and other transparency related features. add .mrxvtrc as the default resource file, so that .Xdefaults is not filled by mrxvt settings any more. ;-) Update all the documentations according to this change. add xftmSize option to specify the size of freetype multichar fonts. When it is difficult for mrxvt to find the best match of normal font and multichar font size, the user can adjust it manually. add xftSlowOutput option to fix display problem of some CJK fonts, like YZYuanTi. These fonts claims to have certain width, but the actual width is smaller. It makes the CJK characters clustered together with big space between non-CJK characters, which looks ugly. add -menu option. Now we can use -menu command line option besides of the X resource name to load menu. add hotkeys (Ctrl+Shift+<|>) to reorder active tab. Thanks to Sergey Popov for the suggestion and patch. add escape sequence to reorder active tab. add an option (-vbf) to display color text with bold font. Add freetype bold font support as well. add hotkey and escape sequence to toggle very bold font display. fix hotkey routines. Now we define a set of functionality that can be done by hotkeys and let the users to define the hotkeys by themselves. We also have a set of default hotkeys. Thanks to Qingning Huo for all the hints and suggestions. remove windowSwitch option since it is not necessary any more. fix transparent screen refresh after the pixmap of root window has changed. fix default encoding method, change it to noenc to avoid troubles for non-multichar users. fix rxvt_font_init_xft. Only load the fixed font if xft is used. This avoid the abort when multichar is enabled, but fallback X11 fonts are not installed. fix rxvt_cmd_getc. Previously hack of race condition is incorrect, so it does not work at all! It is actually not a race condition, but a signal loss problem if multiple children are killed simultaneously. This time it should be fixed. fix configure.ac script. Replace AC_PATH_XTRA with AC_PATH_X. The latter does not add libXt, libICE automatically. Add libX11 check. Fix fontconfig and xft check, especially for Solaris. And many thanks to Qingning Huo for testing and pointing out the problems in configure.ac. fix MONO_BOLD definition in thai.c. fix tabbar multichar string display error, especially when normal text and multichar text are mixed together. fix scrollTtyOutput inhibit. Instead of using the previous reverse definition, change it to scrollTtyOutputInhibit. fix menubar dispatch. If menubar is shown or hidden in dispatcher, resize the terminal window accordingly. fix CJK configuration options. Merge them into a single option: --enable-cjk. fix session restart style. Previously it is SmRestartImmediately, which cause gnome session manager to restart it immediately after an mrxvt terminal quits. fix FAQ. Update the PS1 tab title synchronization question according to Jacques Bouchard's suggestion. fix background pixmap command line option for menubar and tabbar, make them consistent to the option of scrollbar. fix tabbar event dispatcher when tabbar buttons are hidden. fix resource name of scrollbar options. Stuart Midgley pointed out this issue to me in the man page. Now the resource name of all scrollbar options are changed to `scrollbarBlahBlah'. Notice that here `scrollbar' is in lower case. However, I leave the option scrollBar unchanged, where `B' is in upper case. fix Ctrl_1..9 switch. If the current tab is in the second screen, like running vim, Ctrl_1..9 switch is disabled since it may be used by the application. fix primary screen check in tabbar.c, explicitly use PRIMARY. Do NOT assume it is 0, just like None/NULL check since it is more safe and portable. fix configure.ac, xgetdefault option is disabled by default. (Thanks to Terry Griffin for pointing it out to me) fix configure.ac, enable SM.h check only if session management is supported. Otherwise, we may get linking error if libSM is not presented while SM.h is there (is it possible?). fix configure.ac, enable libICE check for session management and libiconv on cygwin, simplify check of libxpg4 and libutil. fix freetype font size, set scale number to be 1.0 so that the size/pixel_size = 1.0. fix freetype multichar font size, optimize for simsun font. fix debian files according to Qingning Huo's diff file. fix compile error in pixmap.c when tinting support is disabled fix Makefile.am, comment out setuid install hook such that mrxvt will not be installed as setuid by default in the future for security concern. fix SlackBuild stript, we will use .tar.gz as source tarball name instead of .tgz. It seems all the world use it. update FAQ, CREDITS, README and NEWS. 0.3.8 to 0.3.9 \----------------------------------- Jimmy Zhou add a VB script (doc/mrxvt.vbs) to launch mrxvt directly from a Windows shortcut without a command prompt window for Cygwin users. This script is contributed by Matthew Melendy add option to hide/show tabbar buttons. apparently some people hate the buttons, as some others hate the tabbar ;-) add hotkey and escape sequence to hide/show tabbar buttons add further explanation of --enable-everything option in README add option of user supplied X resource file add option to avoid loading mfont when using freetype font, this can avoid large line space add escape sequence to change tab colors in runtime add support of X session management, still experimental add a short tutorial in doc/ directory on how to hack mrxvt and add new features add inactive tab highlighting when an inactive tab displays some new stuff. Remember that is not 100% persistent: it will be cleared if an tab expose event happens, e.g., creating a new tab or removing an old tab. But I guess it is enough by now. If people really concern about it, we can add a flag to each tab and use that flag to control the highlighting. But that might be overkill. fix printing of hold exit string on the screen after a child has died but is held fix borderless option, now support GNOME/KDE style hints fix bug in loading short command line option while long resource option is set to NULL, like -d fix freetype font size, turn back to point size instead of pixel size fix freetype multichar font loading. If the multichar font is the same as the normal font, e.g., when encoding method is NOENC, we use the normal font as multichar font. This eliminate the problem that the two fonts have different sizes. But this problem remains when the two fonts are different. This is because XFT function does not honor the font size we provide. Is there any way to fix this? fix internal border, which should be the internal border of the VT windows, not the mrxvt terminal window! fix computing of first visible tab and last visible tab. Now use a function to do it so that we can call this function outside of tabbar.c, especially when we hide/show tabbar buttons fix tab title width. Extend it to 507 maximal, but only display 27 characters maximal in tab. Therefore, if we synchronize the terminal title with tab title, we can display the long tab title as terminal title without truncation. fix debian files (thanks to qingning huo) fix xft font opening routine, print warning message when actually opened font differs from the font wish to open fix pty/tty type check on BSD system - they require openpty that is in libutil. Why it seems unnecessary to fix it on FreeBSD 5.2.1? fix error logic on updating previous active tab when we create tabs in sequence and remove them from the right to the left fix tabbar updating error if the last tab is removed fix include and library path on BSD systems fix compile error on macro PARENT_NUMBER if transparent is disabled fix compile error if scrollbar is not used fix int-border and ext-border option comments fix copyright information about rxvt-2.7.10-rk.patch fix missing lastlog file path on Solaris fix missing lastlog.h check fix tainted/untainted macros, use Cqual's notation so that we may use Cqual to check the source code in the future. It seems gcc compiler is happy with them. But I am not sure if other compilers feel happy too. :-) fix missing fontconfig macros on Mac OS X fix crashes on Mac OS X when calling times with NULL parameter fix iconv library check on Mac OS X fix xft tab title mixed chinese and english fix default gbk bitmap font fix terminal window and icon title if user supplies them fix assert macro (NDEBUG) on non-debug mode. Now if NDEBUG is defined, we will not have any assertions nor debug messages. If DEBUG is defined, assertions will always be built in the program, and we can use DEBUG_VERBOSE to control the debug message. By default, DEBUG_VERBOSE is not defined. So now it is clean to build mrxvt with debug support. fix SlackBuild script fix man page, add X resource name for each command line option if applicable delete unused rxvtRef-frame.html and rxvtRef-toc.html update LSM.in, FAQ, CREDITS, README and NEWS 0.3.7 to 0.3.8 \----------------------------------- Jimmy Zhou add option windowsSwitch to control behavior of Ctrl_Tab. If it is set, Ctrl_Tab switches to next tab like Windows. Otherwise, it activates the previous active tab. add xftfnmono flag if non-CJK font is mono-space add holdExit option and holdExitText resource on terminal exit add support of broadcasting input to all terminals add hot keys to toggle holding exit and broadcasting add desktop option for gnome compatible window manager add text shadow mode add option of transluscent window (true transparent). It requires translucent support of the X server, like Xorg 6.8. It will override the pseudo-transparency. Note: without hardware support to the X server, translucent window can cause significant performance penalty. You have been warned!!! add debian control files to build .deb package. Thanks to Xiong Jiang for help me figure it out. add checksum field to each terminal for checking rxvt_cmd_getc fix debug option, disable it by default since we are preparing a stable branch fix global command input and output buffer, move them to individual terminals. This may break something, so let us test it for a relatively long time. fix children exiting and clean code, so we can handle the case that multiple children terminals exit simultaneously. But a race condition still exists and this code is not robust enough. Is there any way to handle this? fix sigchld handling, enable reentrance of this signal handler fix configure check of iconv.h and libiconv for freetype font support fix compile error when background image is disabled while xpm is enabled fix scrollbar style so that user can use command line option to specify it fix rxvt_set_window_color to restore and switch colors when input color is actually an index to our color list. fix shade value if it is changed by escape sequence fix xftmono flag if the width of freetype CJK font is not even fix xft font height when mfont and font have different height fix xft string drawing length after convert it to UTF-8 fix compile error when there is no xft support fix an assertion failure on possible integer overflow fix tinting shade performance: if shade is 0, do not shade image at all fix global rvideo, rstyle, chstat, lost_multi and multi_byte, move them to individual terminals fix the bug that the background color of current VT is tranferred to the new VT window fix scrollbar mapping after scrollbar window is created fix free clip rectangle of tabbar string fix crash when trying to free session resource strings fix xterm style reverse video fix compile errors on openbsd 0.3.6 to 0.3.7 \----------------------------------- Jimmy Zhou add experimental support to display Chinese/Japanese when use freetype font. add experimental support to display non-monospace freetype font. Basically, if the font is non-monospace (or normal freetype font width is not 1/2 of Chinese/Japanese freetype font), we will output the string one character by one character, not the entire string. This is a bit slow, but much safe. add option of multichar freetype font add option of cursor blinking interval time add option of borderless window (from gentoo) add option of override redirect (from gentoo) add option of bell command (from gentoo) add option to show tabbar at the bottom of terminal window add configure script and related files. We are preparing for a stable release soon add support of text shadow for tab title add hotkey to hide/show menubar/scrollbar add ctrl_tab as hotkey to activate next page (like Windows) add escape sequence to hide/show menubar/scrollbar change text shadow command line option fix desktop option/resource for WindowMaker fix color residual problem when switch to a new tab fix buffer overflow in rxvt_tt_printf (from gentoo) fix sprintf in xdefaults.c fix EUCJ/SJIS encoding (http://gentoo.nedlinux.nl/distfiles/ rxvt-2.7.10-rk.patch) fix Next/SGI style scrollbar width (too fat before) fix selection on 64bit systems (from suse) fix utmpx check for Interix (from netbsd) fix bsd os check (from netbsd) fix window properties, use X11R4 (and later) functions fix window resizing code fix compile dependency on Xt header fix reverse video on individual terminal foreground/background fix tabbar button vertical position fix cursor blinking fix pointer blank fix possible integer overflow when calling rxvt_malloc fix focus/off-focus color code fix fade/shade values, previously they are reversed fix SlackBuild script update README and FAQ 0.3.5 to 0.3.6 \----------------------------------- Jimmy Zhou add xft antialias, hinting, autohint, globaladvance, weight, width, size, slant and rgba options add option syncTabTitle to synchronize terminal title with tab title add support to set foreground and background for individual terminal. It does not work well with off-focus fading now add option hideTabbar to hide tabbar on initialization add hotkey and escape sequence to hide/show tabbar add option to fade transparent background or background image since many people have requested this feature :-) add support to run user's default shell in the /etc/passwd file if the SHELL environment variable is not defined fix mouse report mode (hopefully) by moving PrivateModes and SavedModes from global to individual terminal fix default PrivateModes by removing PrivMode_aplKP. It seems that vim clears this flag anyway. However, if anything goes wrong, we will restore it fix configure.ac, use xft-config instead of pkg-config to find xft since some systems do not have pkg-config fix configure.ac for xft-config's complaint about rejection by preprocessor. fix xft font resource name fix xft font display residual and wipe problems fix tab title when use xft fix text shadow when use xft fix resizing when use xft. But apprently there is something wrong if we want to destroy the old font pattern. So now we do not destroy it, which wastes some system resources. fix active tab title color fix compile error if background image is disabled fix document install directory. Hope it is correct now! 0.3.4 to 0.3.5 \----------------------------------- Jimmy Zhou add saveLines/pixmap/tabtitle option for all tabs add support of utempter library for utmp/wtmp add support of xft, finally! but not support multichar set yet. add hotkey to switch between tabs 1..9 add hotkey to switch between tabs visited previously add escape sequence to change tint color and shade value add support of user supplied foreground color for inactive tab add middle button click on tabbar as shortcut to change tab title add SlackBuild script for slackware add xft code (still not ready yet) fix tab width when resize font fix display problem when enable text shadow (unset clip mask!) fix output of usage fix background color of inactive tab fix display of multichars in tab title fix setuid root permission, give it up immediately after program starts fix compile error when jpeg/png is chosen but not xpm fix sgi style scrollbar fix next style scrollbar buttons fix session init, simplify the logic to choose session fix big5 encoding and default fonts fix korea encoding fix configure.ac to compile mrxvt using -fPIC option by default so that mrxvt can enjoy the benefit of PIE (position independent execution). In plaintext, it means mrxvt can be loaded into random memory location if the system supports it. It may reduce performance a little bit, e.g., 1% on x86, but can improve security. 0.3.3 to 0.3.4 \----------------------------------- Jimmy Zhou add support of user supplied scrollbar background image add support of user supplied menubar background image add support of plain style scrollbar add support of gnome-terminal/konsole's default hotkeys add clean exit routines for debugging purpose add new escape sequence to create a new tab with user supplied tab title (settitle.c, -c option) add new escape sequence to switch tabs (settitle.c, -n -p options) add simple session support add protectSecondary resource to control close of tab add cmdAllSession resource to control session command add initSession option to load session only on initialization add secondary option bitmap to extend options to 60 add MRXVT_TABTITLE environment variable (thanks to wwp) fix close button so that a tab in secondary screen is not closable fix inactive tab background resources name fix font resources loading error (reported by afo@zlug.org) fix 64 bits Atom (rxvt screen.c rev 1.268) fix updwtmpx on Interix (rxvt loggin.c 1.42) fix compile warning of logging.c on Mac OS X fix terminal exit problem on Mac OS X and cygwin fix default scrollbar, do not use SGI scrollbar by default fix command line options fix command line option for individual terminals fix screen refresh problem (thanks to wwp) fix XIM invoking problem in terminal window fix menubar macro fix doc installation directory fix background image and transparent support fix broken transparent background on scrollbar/tabbar/menubar fix off-focus fading (thanks to wwp) update man page update FAQ update README update TIPS update README.configure update sample .Xdefaults file 0.3.2 to 0.3.3 \----------------------------------- Jimmy Zhou fix CHOOSE_GC_FG, using XSetForeground instead of XChangeGC add support of user supplied inactive tab color add support of SGI IRIX style scrollbar (not complete yet!) add support of color text shadow add support of Chinese GBK font add support of Thai (not complete yet!) add rxvt_clean_exit as normal exit routine add xft configure option (not implemented yet!) add doc of XIM specification fix tabbar button transparent background issue fix configure script help message of linespace, int/ext border fix configure script of --enable-everything option fix configure script of multi-language option fix configure script of encoding and terminfo options fix crash on rxvt_scr_poweron when use escape sequence "\033c" fix XIM support (always call setlocale in encoding.c) fix user specified encoding method clean up font code update README and README.configure 0.3.1 to 0.3.2 \----------------------------------- Jimmy Zhou add support of user supplied tabbar foreground/background colors add support of user supplied tabbar background image add option to turn on/off background image on tabs add support for multiple tab's own title, saveLines and bg image add tinting for background image use server side pixmap to improve tabbar buttons performance add sample settitle.c in doc/ add major feature list in README add option to show/hide menubar fix bug in initial window position (thanks to wwp) fix crash on resizing window (thanks to wwp) fix internal/external border, line space and blankdelay features fix mfont for non-multichar charsets fix background image/transparent support fix comments of no_frills configure option fix missing jpeg/png option in the output of feature list fix compile problems on solaris fix lastlog support fix the copyright information fix menubar loading crash fix xresource names cleanup code in rxvtlib.h 0.3.0 to 0.3.1 \----------------------------------- Jimmy Zhou add bell throttle support based on David Hull's patch for rxvt add support for transparent scrollbar/tabbar/menubar add support for off-focus fading add support for background tinting reduce X resource usage (GC) and improve update speed for tabbar reduce X resource usage (GC) for xterm-style scrollbar reduce X resource usage (GC) for rxvt-style scrollbar reduce X resource usage (GC) for next-style scrollbar reduce X resource usage (GC) for menubar fix conflict of non-transparent parent and transparent scrollbar fix conflict of non-transparent parent and transparent tabbar fix conflict of non-transparent parent and transparent menubar fix scrolling problem introduce vterm structure to improve performance of destroying vt fix num_fds adjustment code, move it into tabbar.c fix crash on loading background image rxvt 2.7.11 CVS to mrxvt 0.3.0 \----------------------------------- Jimmy Zhou fix the *horrible* indent of source code, but still not all add jpeg/png background support rewrite configure.ac, add bootstrap script add multi-tab support, and reorganize code add hotkeys for multi-tab support rewrite code on window layout split window resizing code to three parts split font initialization and resizing code reorganize code of x event processing rewrite multi-char encoding and default fonts modify scrollbar code merge external function prototypes into protos.h, remove AWK scripts merge headers into rxvt.h move GC of menubar and scrollbar from rxvt_hidden to scrollBar_t and menuBar_t update documents remove graphics and W11 support remove rclock 2.7.10 to 2.7.11 CVS \----------------------------------- Geoff Wing et al. fixed handling of cursor colour when reverse colour is displayed fixed utmp writing if we have ttyslot fixed compile when --with-encoding=kr added hiding of mouse pointer while the user is typing or from mouse inactivity, with configure --enable-pointer-blank, resource pointerBlank (default: false) and resource pointerBlankDelay (default: 2 seconds) added "-bc" blinking cursor, configure --enable-cursor-blink added 256 colour support for Cygwin Glyn Kennington (glyn_k@sourceforge) added feature ACS_ASCII which converts ACS line drawing characters to similar ASCII characters, resource acsChars Rob McMullen added selection scrolling - scrolling viewpoint when making a selection and going past top/bottom of window, with configure --enable-selectionscrolling Chris Wareham added rconf utility for rclock appointment configuration Lauri Leukkunen (lleukkun@sourceforge) added "-ufbg/--ufbackground colour" to have the background change to this colour when the window is unfocused 2.7.9 to 2.7.10 \----------------------------------- Geoff Wing et al. removed screen dump feature as it can aid as a security hole removed menubar escape sequence access as it can aid a security hole removed reporting of title and icon settings as they can aid a security hole Mikko Leppnen fixed clearing problem when internalBorder is zero Steve O added Cygwin port Rob McMullen fixed handling of control characters inside escape sequences added resource "mouseWheelScrollPage" to allow the mouse wheel scroll a page full added support for VT52 commands 2.7.8 to 2.7.9 \----------------------------------- Geoff Wing et al. added -sbt/--thickness to allow user-supplied scrollbar width (not yet available with NeXT style scrollbars) Matthew W. Roberts fixed rclock -iconic option added rclock day of month on clockface (define DATE_ON_CLOCK_FACE in feature.h) added rclock "-mailspawn cmd" if MAIL_SPAWN is not hard coded in feature.h Kazutoshi Kubota added 256 colour mode (instead of the base 16 colour mode) with configure --enable-256-color 2.7.7 to 2.7.8 \----------------------------------- Geoff Wing et al. fixed determination of NumLock key, noticed by Matthew Gabeler-Lee fixed continual and slipwheel scrolling, noticed by Joshua Swink fixed connecting with IM whenever it is started, partly from Tung-Han Hsieh fixed Ultrix acquiring useful pty/tty pair, noticed by Bert De Knuydt fixed CSI sequence parser overriding a 0 parameter with default value changed -ip to not clear ancestor windows when using inherit pixmap transparency type added -ipf/--inheritPixmapforce to clear ancestor windows when -ip and inherit pixmap transparency is used added "-hc colour" (define OPTION_HC in feature.h) to provide background highlighting of selection, partly from Christian W. Zuckschwerdt added -j/--jumpScroll to provide jump or smooth scrolling, defaults to jump scrolling as per previous behaviour Stephen Isard fixed DECSTBM sequence default when only one parameter is given Rudolf Jaksa added basic support for $XAPPLRESDIR/Rxvt resources T. Alexander Popiel added --scrollBar_align (top|bottom|...) for alignment of scrollbar thumb with middle button. Defaults to centre as per prior state. Supercedes FUNKY_SCROLL_BEHAVIOUR 2.7.6 to 2.7.7 \----------------------------------- Geoff Wing et al. fixed check for GLIBC and STREAMS pty/tty types, noticed by Venkatesh Krishnamurthi fixed check for PTC pty/tty type, noticed by Andreas Bierfert fixed to not automatically clear selection on screen size change, noticed by Dominik Vogt fixed a possible buffer overflow problem, noticed by Samuel Dralet fixed to reallow parallel builds fixed builds for some SYSV utmp/utmpx systems fixed INCR transfers fixed resource "greektoggle_key" as per doc/README.greek, noticed by Martin Husemann fixed STREAMS again, hopefully the last time changed overstrike pixel dropping avoidance to speed/size optimise changed define WTMP_ONLY_ON_LOGIN in feature.h to be the default added CSI s & CSI u as alternative save & restore cursor sequences added pasting-only support for SECONDARY and CLIPBOARD selections, automatically tried if internal selection and PRIMARY selections are not present. CUT_BUFFER0 is tried last Kazutoshi Kubota added "-lsp " option ("--lineSpace ") to give specified spacing between rows with configure --enable-linespace Tomohiro KUBOTA fixed some font default calculations to match previous behaviour Ali Rahimi added slip wheel support providing continual scrolling with the control key depressed and using the mouse wheel as an accelerator. Control key release stops scrolling Mark Schreiber added -sw/--scrollWithBuffer to try to make views into the scrollback buffer stay unmoving upon new lines (needs -si) 2.7.5 to 2.7.6 \----------------------------------- Geoff Wing et al. fixed build with XTERM_COLOR_CHANGE undefined, noticed by John Waggenspack fixed build for Solaris/SunOS (maybe others) using STREAMS fixed default icon name, noticed by Jeremy C. Reed fixed setting of icon name with -e argument, noticed by John Waggenspack fixed problems with selection by changing some types and type casting fixed some parallel build problems fixed text placement in graphics mode fixed some build problems with graphics/qplot fixed reverse video mode to act like the invocation option fixed query of locale ("Setting locale failed.") when locale is set fixed autowrap bug when restoring cursor from last column, noticed by witek@mat.uni.torun.pl fixed build & run when PREFER_24BIT is undefined fixed loading of fonts with noenc multichar encoding, noticed by Mark White fixed an abort on sending some selections, from Xianping Ge fixed tty opening for systems with openpty(), e.g. OSF1 fixed build for utmpx/wtmpx platforms fixed a bug in memmove() if --enable-strings is given, noticed by Larry W. Virden fixed some termcap/terminfo entries fixed some division operations to use the same integer type changed configure detection method for pty/ttys changed handling of ConfigureNotify events for fast event streams changed internal handling of window size calculation changed internal handling of window size and placement manipulation changed define PREFER_24BIT in feature.h to be set via configure --enable-24bit (default is now off) changed screen refresh to optimise X calls more, noticeable with slower machines or over network displays changed pty/tty code to be able to be built separately for testing changed selection sending to send the original raw form if locale conversion fails updated libtool for configure added DEC private modes 1047 / 1048 (no ti/te handling yet) added SCROLL_ON_HOMEEND_KEYS in feature.h a la SCROLL_ON_UPDOWN_KEYS from Marius Gedminas added "tests" target in main directory to build and run basic tests added (frills) -tcw (--tripleclickwords) alternative triple click selection which selects words to the end of possibly-wrapped lines with trailing blanks and blank lines removed Chuan-kai Lin and Brian Mays added -mcc option (--multibyte_cursor) for multibyte cursor movement in legacy programs Maxime Froment fixed placement with OverTheSpot input method fixed characters sent through IM being truncated to 4 bytes fixed encoding method being overridden by default encoding method added loading of locale specific app-defaults from directory /usr/X11R6/lib/X11/$LC_CTYPE/app-defaults/Rxvt (see XAPPLOADDIRLOCALE is feature.h) Tomohiro KUBOTA added method to provide base font sets based on user's locale added more flexible font allocation, specifying a maximum number of fonts in feature.h instead of a set number Marius Gedminas added --enable-smart-resize which may reposition the window on resizing so that we try to stay within the screen boundaries 2.7.3 to 2.7.5 \----------------------------------- Geoff Wing et al. fixed scrollTtyKeypress not active for all keypresses, noticed by Reuben Thomas added -xrm option to accept dummy invocation arguments, from Christian W. Zuckschwerdt & Chris Green fixed documentation for options: -tr, -ic, -pt, -im, -mod, -xrm; and resources: scrollBar_right, scrollBar_floating, scrollTtyOutput, scrollTtyKeypress, preeditType, inputMethod, modifier. fixed OSC sequences to accept 7 and 8 bit ST as well as BEL added MAX_COLS & MAX_ROWS in feature.h to limit columns/rows on resize added copy root pixmap variant of transparency - make this the default with previous method as fallback fixed allocation of new lines to not set base attributes, including underline or reverse video information, noticed by Brian Mays added ability for different scrollbars to be compiled in, determined by --scrollstyle fixed Meta key detection - has priority over Alt, noticed by Paul D. Smith fixed configure check for mawk/gawk/nawk/awk added use of libtool in build procedure added SCROLL_ON_NO_SECONDARY to feature.h to scroll the screen when no swap is compiled in and a change screen request is made removed slightly buggy ConfigureNotify queue/ignore from our resizes fixed use of extended character classes, from Samoylov Olleg fixed timeout in select() call when unmapped, noticed by Tore Bjorkeli changed feature.h NO_BOLDUNDERLINE to NO_BOLD_UNDERLINE_REVERSE added support for XCopyArea() on screen display - good for slower links fixed CSI parameter parsing, including omitted parameters fixed allocation of new lines when in reverse video mode added answerbackString resource which sets the reply to ENQ (CTRL-E) fixed InheritPixmap interaction with fvwm2 by delaying a bit to allow the WM to do its stuff before we meddle with its windows Thomas Woerner added colorRV resource for reverse video colour (dependent on NO_BOLD_UNDERLINE_REVERSE in feature.h) Jun Morimoto fixed argument checking in rclock - ignore bad arguments Matthew W. Roberts added -mailfile option to rclock Christian W. Zuckschwerdt added OSC sequences to change base colours; also cursor, highlight, bold, pointer and underline colours. See rxvtRef Paul Sheer added initial INCR (incremental pasting) support 2.7.2 to 2.7.3 \----------------------------------- Geoff Wing fixed clean up (utmp/wtmp/etc.) on fatal signal, noticed by Jim Diamond added use of configure options --program-prefix, --program-suffix & --program-transform-name, allowing, say, Kanji users to do --program-transform-name='s,rxvt,kxvt,;' for installing changed configure --with-encoding value "euckr" to "kr" to match multichar_encoding option and resource values added configure --with-encoding value "noenc" (and multichar_encoding option and resource values) to disable encoding allowing normal eight bit characters in multichar compile fixed -si/+si option, noticed by Thomas Lofgren fixed detection of struct utmpx, noticed by Paul 'TBBle' Hampson added basic support for openpty() which should help with people on Alpha platform using Tru64/ Jun Morimoto added basic argument checking for rclock to detect missing arguments Tung-Han Hsieh fixed configure notify bypass checking for self window configurations fixed fontset creation to match sizes properly and recreate fontset on size change Chih-Wei Huang added fontset (locale dependent) menubars added example Big5 menu Hans de Goede added colour determination for low colour (4 to 8 bit) displays 2.7.1 to 2.7.2 \----------------------------------- Geoff Wing fixed screen refresh output to handle more cases changed resource storage to a struct rather than a char* arrary, to aid debugging changed how ptys/ttys are opened (again) fixed processing of some resources to strip double-quotes when using XGetDefaults() and also for backspace_key/delete_key fixed large paste problem, noticed by Dominik Vogt fixed utmp removal problem for SYSV style utmps changed BORDERWIDTH in feature.h to EXTERNALBORDERWIDTH to clarify its usage. added (frills) resources "internalBorder" (-b) and "externalBorder" (-w)(-bw)(-borderwidth) added NO_BELL to feature.h to allow disabling all bell indications D J Hawkey Jr added QNX support added logging into lastlog in login shells (-ls option) Oskar Liljeblad added SCROLL_ON_UPDOWN_KEYS to feature.h to allow scrolling via (shift|meta|ctrl) modifier and up/down keys, default off for backward (2.6.x) compatibility 2.7.0 to 2.7.1 \----------------------------------- Geoff Wing cleaned up CSI processing slightly fixed clearing of pixel droppings on right side of cell added clearing of pixel droppings for fonts which exceed the left side of their cells, noticed by J Scott Berg changed --disable-memset to --enable-strings and not enable by default added LOCAL_X_IS_UNIX to feature.h to work-around Irix problem, opens unix:0.0 instead of :0 or :0.0 fixed some configure errors changed how ptys/ttys are opened and which is opened by parent or child added delay to screen refresh when receiving a fast stream of X events Jim Knoble fixed scrollbar slider jitter added named constants for scrollbar calculations MANTANI Nobutaka changed interaction with XIM server to fix several problems 2.6.? to 2.7.0 \----------------------------------- Geoff Wing added OSC escape sequence #55 to dump scrollback/screen to a file SEO Young-Jin fixed XGetDefaults() to use standard files (and then some) 2.6.0 to 2.6.1 \----------------------------------- Geoff Wing fixed setting of tty permission/ownership with grantpt(). ie. don't fixed configuration for some systems changed a timeout to previous setting giving smoother scrolling. fixed reversed --scrollTtyOutput (noticed (this time) by Thomas Lofgren ) fixed offset for writing into BSD utmp file added seperate cursor save/restore information for secondary screen fixed CSI cursor movement fixed typos causing compile failure - reported by various fixed UNSHIFTED_SCROLLKEYS Mike Hopkirk (Hops) fixed SB_BORDER scrollbar delineator 2.6.PRE3 to 2.6.0 \----------------------------------- Geoff Wing et al. fixed configuration for many systems Ha Shao added support for ZH_CN (GB2312) fonts and encoding. 2.6.PRE2 to 2.6.PRE3 \----------------------------------- Geoff Wing fixed several OOB memory accesses and leaks (mostly found by Rob Somerville ) added shift up/down arrows a la shift prior/next added SCROLL_ON_SHIFT, SCROLL_ON_META, SCROLL_ON_CTRL to feature.h Vaughn Cato fixed jerky selection for some people (esp. Linux) Peter H. Chou fixed floating scrollbar (trough) to not affect NeXT scrollbar MANTANI Nobutaka fixed two problems on X Input Method: 1) Can't display preedit area in "OverTheSpot" input style with some input methods. 2) The location of preedit area in "OffTheSpot" input style is wrong. Yasuda Tsutomu <_tom_@sf.airnet.ne.jp> fixed some multichar set (Kanji) selection added better selection request type conversion 2.6.PRE1 to 2.6.PRE2 \----------------------------------- Geoff Wing fixed declaration position for COLORFGBG env var - really fixed this time (noticed by Rob Somerville ) fixed transparent term reparenting/configure issues fixed some documentation (noticed by Richard Browne ) MANTANI Nobutaka added XIM (X Input Method) enhancements added input of multibyte characters with XIM (X Input Method) enhancements via input styles "OverTheSpot", "OffTheSpot" and "Root" added configure option --enable-xim added resources "inputMethod" (-im), "preeditType" (-pt) changed configure to search for libxpg4, needed for FreeBSD's setlocale() 2.4.10 to 2.6.PRE1 \----------------------------------- Geoff Wing fixed scrollbar slider drawing to have a minimum size (noticed by Brian Korver ) fixed backward #ifdef's on JUMP_MOUSE_WHEEL fixed coredump on paste after terminal reset fixed bad marking on selection with old selection (noticed by Paul Slootman ) fixed bad cursor colour setting (noticed by Louis-David Mitterrand ) fixed octal recognition from strings (hopefully no-one noticed) fixed proto generation awk script (noticed by Paul D. Smith ) changed distribution to include protos, for bad systems added configure check for XPointer (needed for SunOS; comments by Moritz Barsnick ) fixed export of COLORFGBG (noticed by Moritz Barsnick ) Alfredo K. Kojima changed NEXT_SCROLLBAR code to produce real NEXTSTEP scrollers added inheritPixmap support - terminal window uses parent pixmap Sasha Vasko fixed handling of background change via property _XROOTPMAP_ID 2.4.9 to 2.4.10 \----------------------------------- Geoff Wing fixed screen refreshing - significant reduction of XDrawString() et al calls in many cases leading to large speed increase, especially for remote X clients fixed source code const stuff fixed DISPLAY_IS_IP feature changed window creation, menubar reading, etc. order and removed one of my earlier hacks changed configure to be less extreme about X libs 2.4.8 to 2.4.9 \----------------------------------- Geoff Wing changed screen allocation to be safer added several xterm style window operations and reports DEC style escape sequences fixed handling of some DEC style escape sequences fixed menubar display fixed outline cursor removal fixed clear selection when writing within a selection added resources to handle backspace and delete changed source code organisation again - also be nicer when making in a different directory added probe of ModifierMapping for Meta/Alt and NumLock keys removed resource to set Meta/Alt key added support to allow compilation of both old and new selection styles changed internals - allocate rs_* as rs[Rs_*] Stanislav Meduna fixed checking of Xsetlocale(), setlocale() in configure 2.4.7 to 2.4.8 \----------------------------------- Geoff Wing fixed XPM handling of position in geometry changed XPM tiling to have the X server tile in the basic case moved several configuration options from feature.h to configure fixed introduced pixel dropping bug when RS_DIRTY was removed added `troughColor' resource - the original patch written by Reid D Rivenburgh (noted below) was lost and never added fixed border pixel colour - if not set, use foreground not background fixed handling of cursorColor/cursorColor/colorBD/colorUL to always use the _current_ fg/bg colours appropriately if unset changed source code organisation - moved some things into screen.h - to allow other add-ons to access screen structures without including all of rxvt.h changed internals - ripped out RS_Cursor/RS_Select to make basic multichar sets (not Kanji/Big5) always enabled - thus handle selection and cursor display differently fixed bug on scroll lines affecting selection changed rmemset to use a type which is the same size as an (int *) - based on comments by Paul Slootman fixed pointer colour change on default fg colour change changed handling of backspace/delete keys - if not disabled during ./configure then settable via resources - defaults similar to previous 2.4.6 to 2.4.7 \----------------------------------- Geoff Wing moved several configuration options from feature.h to configure added configure option to use system memset() added support for no multichar sets to allow 2 byte rendition type changed rmemset for slightly more optimised execution changed source code organisation slightly Guillaume Laurent added Meta modifier selectable via resource ``modifier'' John E. Davis added print mode to accept ESC sequence variation 2.4.5 to 2.4.6 \----------------------------------- Geoff Wing merged support for Big5 & Kanji. changed short option: fk --> fm changed long options: kfont/cfont --> mfont changed long option: kanji_encoding --> multichar_encoding changed font list in feature.h - user define list of fonts fixed configure check for Xlocale() added configure option --enable-dmalloc (Gray Watson's malloc) added configure option --enable-dlmalloc (Doug Lea's malloc) added support for Cygnus Solution's GNU-Win32 extensions (b18 tested) fixed utmp/wtmp handling on machines with updwtmpx() added support for old rxvt style selection - OLD_SELECTION changed define of struct screen_t to rxvt.h changed internal handling of bold overstrike pixel dropping - prescan line changed internal handling of selection mechanism to properly support multiple methods - and optimized changed internal handling of selection sync'ing - and optimized added assert()s via DEBUG_STRICT define to catch some possible bugs fixed scrollbar colour on mono displays changed privilege revocation to before we do anything fixed selection clearing when across the screen boundary and we swap screens fixed resize / screen refresh order when changing scrollbar display fixed font handling when we're given per_char of NULL changed internal handling of row width - maximum line length is now bound by a short - not enforced changed rxvt.1 and refer.html to yodl source Bruce Stephens added support for buttons 4 and 5 (eg. on a mouse with wheel) to scroll screen Frank Chen Hsiung Chan fixed clash of use of BIG5 as define and enum. Also typo fix. John Eikenberry added window_group use to window manager properties added NeXT scrollbar style - group up and down buttons together Denis N. Antonioli fixed setting of application icon name and title Adam Spiers fixed enumeration of *.keysym.* in resources 2.4.4 to 2.4.5 *_Official Release_* \----------------------------------- Geoff Wing changed the approach at the Boldoverstrike-Pixeldroppings front temporarily fixed a bug in the exposure handling added the --enable-ttygid Oezguer Kesim switched rxvt licence to GPL changed copyrights of the modules fixed the terminfo/termcap entries Mark Olesen FINALLY added Double-Click mouse reporting. Uses the upper bits of the Button character for X11 reporting so should cause no compatibility problems. * State = ( - SPACE) & 60 4 = Shift 8 = Meta 16 = Control 32 = Double Click (Rxvt extension) NOTE: no Release is reported after a double-click and the Release for the first click of a double-click is not reported. This also means the Release event of a very fast click/release won't be reported. 2.4.3 to 2.4.4 \----------------------------------- Geoff Wing fixed a bug in the selection mechanism Oezguer Kesim fixed the fontchange-windowresize-racecondition-bug (thanks Geoff!) fixed the broken console-support under solaris added a new terminfo entry for rxvt, based on the one which comes with ncurses (thanks Larry!) some changes on aclocal.m4 and configure removed the XTERM_COLOR_TERM option from feature.h - use --with-term=NAME instead updated the man-page Kikutani Makoto fixed a bug when copy&paste with kanji Paul D. Smith fixed a bug which prevented rxvt to compile when configured with --enable-xterm-scroll 2.4.2 to 2.4.3 \----------------------------------- Geoff Wing fixed a bug in scrolling lots of text more work on avoiding the pixel droppings further cleanups Oezguer Kesim some changes on the configure script Frank Chen Hsiung Chan added experimental big5 support Reid D Rivenburgh added the "troughColor" resource Mike Hopkirk (Hops) added support of SCO OSr5 pty naming (also UW SysVr5) correction of pty hang with large paste buffer (happens on on all tested platforms) fixed Weird default scroll thumb behaviour fixed incorrect setting of WM_COMMAND if specified with -e switch fixed # of lines of context between screen pages (Shift-Prior/Next) Visual delineation of Scrollbar and vt wdw with dark internal border 2.4.1 to 2.4.2 \----------------------------------- Geoff Wing new anti-bold-overstrike-pixel-dropping (plan 3) Oezguer Kesim fixed a bug which caused rxvt to dump core after resizing and selecting 2.4.0 to 2.4.1 \----------------------------------- Geoff Wing added --with-xpm-{include,library} to autoconf/a4local.m4 added VERYBOLD feature fixed some misspelling in autoconf/configure.in added `DEC private modes' 1010 and 1011 for scroll-to-bottom on TTY output inhibit and scroll-to-bottom on keypress together with resources and switches fixed Bold Overstrike Pixel Dropping (Yes Sir!) fixed a bug in scr_E() fixed ^[[*J behaviour - clear to end, clear to beginning, clear whole screen was broken Oezguer Kesim removed DONT_GUESS_BACKSPACE. Instead, you may define either FORCE_BACKSPACE or FORCE_DELETE or leave both undefined in order to get ^H, ^? or the current stty settings for 'erase' fixed positioning of text in the top menubar. fixed some missing #define's fixed conditions for MONO_BOLD in scr_refresh() to make VERYBOLD work. Christoph L. Spiel fixed usage of KEYSYM_RESOURCE only when NO_RESOURCES is *not* defined Paul Slootman added a few XK_KP_* ifdef's in order to get rxvt work with X11R4 Major changes from 2.21b* to 2.4.0 \----------------------------------- Geoff Wing screen.c rewritten with changes including: internal management of screen lines changed rmemset() used as a fast memset() replacement selection now the same as XTerm selection several Kanji display fixes Kanji properly selectable for EUC JP encoding added continuous scrolling with scrollbar buttons fixed colours when using XPM background pixmaps smaller than the window added resources -sr/+sr, -st/+st fixed application Cursor Keys added many configure enhancements added delimiting line between XTerm scrollbars as per XTerm fixed utmp support added minimal support for proportional fonts added integrated use for Gray Watson's dmalloc package added automatic prototype generation via src/makeprotos-sed Grant McDorman added PREFER_24BIT: if the screen is 24 bit, then use 24 bit windows even if default is 8 bit fixed utmpx support added handling for Keypad left/right/up/down, etc. added META8_OPTION for all function keys added RXVT_TERMINFO for setting TERMINFO fixed some bugs in menubar added expanded keysym support Paul D. Smith fixed title setting fixed for building in other directories added pointerColor for changing pointer colour added borderColor for changing border line colour in XTerm scrollbar 2.21a3 to 2.21b* \--------------- 1. From: Conrad Link Fixed a bug in the OffiX Drag and Drop support. rxvt inserted two instances of directories or links when they were dropped onto rxvt. 2. From: Fixed a bug that makes rxvt getting constantly "NoExpose" events which it is not handling. 3. From: Mark Olesen Fixed a bug that caused rxvt to hang indefinitly waiting for a terminating ^G on an XTerm `ESC]' sequence. 4. From: Bernard PERROT Mark Olesen Fixed a bug that prevented to handle DEC VT2xx's ApLineDel correctly 5. From: Mark Olesen Now the Shift/Ctrl cursor key mappings are enabled regardless of App-Cursor settings 6. From: Kai Petzke Fixed a bug with respect to cursor movement. rxvt now handles the 'G' and 'd' sequences correctly 7. From: Geoff Wing Fixed a couple of things in utmp.c 8. From: Denis N. Antonioli Added the "-tn" option and corresponding Xresource variable "termcap". This option specifies the name of the terminal type to be set in the TERM environment variable. 2.20 to 2.21a* \------------- 1. Oops, forgot to include time headers in menubar.c 2. Finally got the correct DEC sequence to toggling the behaviour of the backspace key and removed the other non-standard ones. If anyone has a listing of DEC escape sequences they'd like to donate ... 3. Fixed a bug that prevented an XPM file from being found if it were specified with an absolute path and a geometry string. Made the default scaling zero (tiled) since this is by far the most popular use. 4. The Motif-style scrollbar is back as a compile-time option. 5. Added BUGS file and (thankfully) moved coordination of the project to Oezguer Kesim who also has a mailing list for rxvt development Rxvt Workers To subscribe to the list send email to with the body: subscribe 6. Semi-retirement and finish my thesis ... bye for now - /mark --- Oezguer started working on rxvt 7. Fixed a bug in the new menubar-feature. There were several unchecked strings strcpy'ed which caused rxvt immediately to dump core. 8. From: Robert Bihlmeyer Fixed a bug in rclock.c which prevented it to compile correctly. 9. From: Mark Olesen Overstrike boldfonts and pixmaps now work together without pixel droppings on the screen (at least under Linux). 10. From: Mark Olesen Modified autoconf support: memmove() replacement function supplied for those systems that need it, libXpm should now be correctly found (set in src/Makefile *not* in config.h) 11. From: Mark Olesen Converted doc/rxvt.ref to HTML format. doc/html/refer.html = master copy doc/refer.txt = text version saved using Netscape. All HTML documents are put in here, to ease installation elsewhere. 12. From: Mark Olesen Moved some file search function from main.c and some string functions from xdefaults.c to misc.c. Changed the implementation details so that `keysym' resource is also available as a command-line long option ... even if you have compiled with USE_XGETDEFAULT. 13. From: Mark Olesen When a new pixmap is loaded, revert to the default scaling. 14. From: Mark Olesen Reworked the menubar to permit multiple menubars in a circular linked list (and all the management functions that entains) and new functions including the following: * reading from files * dumping all the menubars * clearing a menu (without removing it) * setting a backgroudPixmap * and many other features. The menu syntax has changed very slightly from the last version, but now provides greater flexibility ... see refer.html for details. Added the `menu' resource/long-option so a startup menu can be specified. eg, rxvt -menu my.menu -e rlogin machine -l user 2.19 to 2.20 \----------- 1. You can now add snazzy looking menus to any plain (non-X) text application. At the moment, the menuing system is simple but functional. The syntax for controlling the menubar is documented in doc/rxvt.doc, but note that an XTerm sequence `ESC ] 10; Pt BEL' is used so menus created for rxvt will be ignored by an ordinary XTerm. It provides sub-menus, click-and-drag, and even some user definable `quick' arrows keys. However menu manipulation could use refinement to permit multiple menus to be defined -- and the menu refreshing could also use some improvement, but it can be extended and refined later as required/desired. The files doc/menu.sh and doc/jedmenu.sl show sample implementations of menus. --> It compiles and runs on my machine (AIX 3.2.5) but THIS IS CONSIDERED BETA (or even ALPHA) CODE! 2. DEC private modes: Bug fix for 's'ave and 'r'estore parameters, added a 't'oggle parameter to DEC private modes. 3. Made Backspace key selectable with DEC private mode ESC [ ? 36 h/l/s/r/t (high/low/save/restore/toggle) 4. Changed the way the scrollBar is realized to permit on-the-fly toggling of the scrollBar display and added a DEC private mode escape sequence for that. Smoother redraw of scrollBar. Better proportions for the arrows allows a slightly narrower scrollBar. 5. Added support for XTerm font changing sequence: `ESC ] 50; Pt BEL', with (as usual) a few extras. See doc/rxvt.ref 6. Adapted experimental XPM buffering from that supplied by Carsten Haitzler . 7. Replaced `wait' with `waitpid' in src/command.c::Child_signal to avoid a race condition and permit use of pclose() on SunOS. Patch provided by , Thanks John! 8. For easier XPM handling, added `path' resource/long-option and substantially enhanced pixmap scaling to provide very exact control over scaling and positioning of the XPM background image. The XPM XTerm escape sequence has been extended to provide a convenient facility for on-the-fly rescaling. Export COLORTERM="rxvt-xpm" instead of COLORTERM="rxvt" 9. Added export COLORFGBG to give hints to color applications. Typically one of these values is exported, in which `fg' and `bg' are numbers 00-15: COLORFGBG="default;default" -fg -bg colors don't match any of color 0-15 COLORFGBG="fg;default" -fg color matches color 0-15, but -bg color doesn't COLORFGBG="default;bg" -bg color matches color 0-15, but -fg color doesn't COLORFGBG="fg;bg" -fg -bg colors match color 0-15 When compiled with XPM support, the last two values are rendered as follows: COLORFGBG="default;default;bg" -bg color matches color 0-15, but -fg color doesn't COLORFGBG="fg;default;bg" -fg -bg colors match color 0-15 10. Disable Shift+Prior/Next and scrollBar if saveLines == 0. Slight change to key-processing so `shift+meta+key' and `shift+ctrl+key' gets processed as `shift+key'. This provides a way to avoid interpretating `Shift+Prior', `Shift+Next', and `Shift+Insert'. Also, added DEC private mode sequence `ESC [ ? 35 h/l/s/r/t' to disable Shift+key interpretation. Provide for Ctrl+Shift+ combinations for function keys. See doc/rxvt.ref 11. Always match long-option names, even when only preceded by a single -/+. 2.18 to 2.19 \----------- 1. Minor alteration to input mode for Kanji processing. 2. rclock: -adjust option, support for exec on startup syntax, date format may now also include the century 3. Made mouse double-click respect autowrap lines. 4. Added marks for folded editing. 5. Added Offix DND (Drag 'n' Drop) protocol. Added support for XA_TARGETS. 6. added Carsten Haitzler XPM patches to load an XPM file for the background of the terminal window. Uses resource `Rxvt.backgroundPixmap' or long-option `--backgroundPixmap' 7. Use these (XTerm) keybindings exclusively and remove the old equivalent bindings: Shift-Prior = scroll up Shift-Next = scroll down Shift-Insert = paste mouse selection Shift-KP_Add = bigger font Shift-KP_Subtract = smaller font 2.17 to 2.18 \----------- 1. Check for NULL pointers in command-line processing (oops) Also fixed processing of `hidden' arguments such as -d, -g, -T 2. Fixed terminfo hpa/vpa: was `\E..' instead of `\E[..' added invisible cursor (ESC[?25h / ESC[?25l) 3. Fixed broken kanji characters (?? and disappeared cursor box ??) thanks to 4. In privileges(), changed setuid/setgid to seteuid/seteguid so that it's possible to switch back to root later. Perhaps fixed svr4 problems (reports no tty, no job control) in get_tty() ... need to detect these SVR4 features in the configure script. 5. Restored scrollColor, topShadowColor, bottomShadowColor resources that somehow got lost between the beta and release versions. For monochrome displays, fixed scrollbar so it will be visible and suppress color changes. 6. Final? iteration on selection. Store selection text with LF line-endings but paste into rxvt with CR endings. Selection now preserves the newline when trailing space is stripped from non-autowrap lines. Compile-time support for using a keystroke to paste from the cut-buffer. 7. Fixed utmp.c to handle both sysv and bsd pty names. More changes in the works to improve documentation and eliminate race conditions ... this, thankfully, is being done by someone else. 8. Added European language support (X11R6) - let me know of problems and fixes since I only have X11R5. 9. Changed names of color10-color17 to color8-color15 to match with those used by color_xterm ... sorry for the inconvenience, but I didn't have an X11R6 xterm manpage until now and long-term compatibility is quite important. Added a real bold font (define USE_BOLDFONT). I still think it's too much work to avoid pixel droppings for overstrike fonts. Added support for specifying colors for bold/underline (colorBD/colorUL) but it's only done when the foreground = the default foreground ... see the manpage. Compile-time selection of TERM="xterm-color". Reduced the number of rarely-used command-line options since they are accessible on the command-line via their resource names as long options. More rigid differentiation between long and short options: long options are --/++ prefixed; short options -/+ prefixed. Added long-option help to give the resource names. Removed run-time selection of right-hand scrollbar and arrows. Removed run-time selection of (pageup_key/pagedown_key/alert_key). 10. Changed Ctrl-Up,Down,Left,Right to emit "\EOa,b,c,d" instead of the previous "\E[^A,^B,^C,^D" to avoid problems associated with having an embedded "^C" in a key-sequence. Disallow 80/132 column switching as the default (same as xterm). 11. Check for seteuid(). Add "ttcompat" module for SVR4. 12. A few people suggested removing the keystroke for toggling MapAlert and so I have. I agree that it was pointless and/or annoying since there was no way of determining the current toggled state anyhow. 13. Fixed missing `ttydev' for _sgi. Fixes for BSD utmp support. Exported WINDOWID before the window was created (oops). 14. Mouse cut&paste of autowrapped lines should be improved, fixed bug in screen.c::scroll_text(). 15. As was pointed by a user -->> in keeping with X conventions, only an application that starts with 'x' should capitalize the first two letters of the resource file, so the rxvt resource file (and class name) should be named Rxvt not RXvt, this is a minor point. 16. rclock: As well as message reminders, rclock can launch programs and (if no message text is given) act as a cron-type of program. Made default font `7x14'. Fixed graphics context when mail is waiting and a reminder is issued - so the message is actually visible! 17. As suggested by a user, changed the bolding algorithm to be slightly more intuitive: 1. colorBD (if specified) 2. color0-7 -> color8-15 (if possible) 3. boldFont (if specified and found) 4. overstrike (last resort) This takes advantage of the color capability and is the most consistent when toggling font sizes on-the-fly. If you never want overstrike (looks ugly and leaves pixel droppings) or boldFont (you like to switch font sizes on-the-fly), you can remove them at compile-time. The other elements are similarly compile-time selectable. 18. Another user suggestion: scrollbar made more distinct by having the `trough' a different color from the slider -- I opted for making it the same as the default background color so that the slider and arrows appear to `float' on the window. Also removed topShadowColor, bottomShadowColor resources as unnecessary. 19. Dropped distribution of vttest since Tom Dickey is working on an improved version. 2.16 to 2.17 \----------- 1. Fixed problem in scr_refesh_region() that was introduced in v2.16 The problem of `pixel droppings' continues when bold is simulated using overstrike. Using XCopyArea() sometimes helps, but the preferred and simplest solution is item 4 below. 2. Removed 7bit mode. Changed definition of meta so that the ESCAPE is the default and using meta to set the 8bit on an option that can be made run-time configurable (assuming people still use this). Added -/+rv command-line option, resource reverseVideo. NB: it works slightly differently from xterm's in that foreground/background are swapped even if they have been explicitly set. Removed NO_COLOR option -- no more monochrome rxvt (one too #ifdef's). Inherit existing stty settings (at least for control characters) and set value of BackSpace appropriately. Added defines DONT_GUESS_BACKSPACE and NO_DELETE_KEY 3. Added 3D style scrollbar and removed all the old bitmapped scrollbars and arrows with the only exception being the xterm lookalike XTERM_SCROLLBAR which is available in a single width. With arrows, scrollbar behaviour somewhat resembles Motif behaviour. Without arrows, it's the standard xterm behaviour. The default scrollbar (defined at compile-time or set by using scrollBar: True) is to have a scrollbar with arrows arranged on the right-hand side. The scrollBar resource is now exclusively a boolean value scrollbar resources: scrollColor topShadowColor bottomShadowColor NB: if topShadowColor/bottomShadowColor are unset, their values are calculated from scrollColor using an algorithm adapted from fvwm so it shouldn't be too hard to find scrollbar colours that look good with your window manager and don't consume an entire colormap. 4. Added smarter handling of bold/blink when applied to the default fg/bg colours: If the pixel value of fg/bg matches the pixel value of colour COLOR0 through COLOR7, then applying bold/blink to the default fg/bg will select the appropriate colour from BOLD0 through BOLD7 instead of using the overstrike bold. This seems to be the best way to handle bold/blink attributes when the foreground/background match and ANSI colour anyhow. For convenience, it is possible to use colour aliases (next item) for the foreground/background colours instead. My preference is a dull Canadian look: RXvt*foreground: 7 RXvt*background: 10 5. Changed colour aliases (item 7 of last change) and dropped the `#' prefix. This avoids confusion with the regular #rrggbb format of specifying colours and is unambiguous since there are no X11 colours starting with a digit. This also avoids the need to quote the `#' to protect against shell interpretation. 6. Added colour cursor support. -cr (cursorColor), as per XTerm -> the (rectangle) cursor colour -cr2 (cursorColor2), only RXvt -> the text colour. The cursorColor2 maintains contrast in a colour environment and is optional. Thanks Raul Garcia Garcia for the idea. Cleaned up scr_refresh (again ) to avoid some unnecessary colour changes and removed the reverse video graphics context and just swap foreground/background colours instead. 7. Typo in command.c: had seteuid() instead of seteguid() Use cfsetospeed()/cfsetispeed() for POSIX termios handling. 8. Ignore the loginShell option/resource for programs that DON'T end with "sh". A hack but it keeps `rxvt -ls -e rlogin machine' from failing and I don't know of (m)any shells that don't end in "sh". 9. Hard-code dependencies in Makefiles to avoid using X11 makedepend. Added check for atexit() to catch the problem that exists on SunOS but not on Solaris. 10. Collected command-line option parsing and X11 resources into a single file (xdefaults.c), and introduced a monolithic structure (with bit-flags for logical options) to eliminate the massive if-else-if parsing and to reduce possible overlaps/oversights Short help provided for an incorrect argument. For more consistency, more flexibility, and fewer switches, made -grk4/-grk9 options obsolete, and replaced with `-grk mode'. Added the resource `greek_keyboard' while I was there. It is also possible to use a `--' or `++' prefix to get so-called `long options' that correspond to the resource name. For example, rxvt +ls -bg Blue rxvt +loginShell -background Blue rxvt ++loginShell --background Blue rxvt ++ls --bg Blue Error! 11. Changed REFRESH_PERIOD to 1 in command.c, the old idea of providing for fast and furious scrolling needs to be reconsidered so that `cat' works. Still needs some investigation. 12. Changed scr_poweron(), which corresponds to `ESC c', to also reset the scrollback buffer. 13. Changed scr_change_screen() (when compiled with NO_SECONDARY_SCREEN) so that switching from the secondary to primary screen will push the old secondary screen into the scrollback buffer. This is fairly useful if your terminfo has have rmcup=\E[?47l\E8, smcup=\E7\E[?47h. It is NOT particularly useful if rmcup includes \E[2J, like some do. Running with NO_SECONDARY_SCREEN provides faster switching than with a real secondary screen and saves memory too. 14. Now that key values have mostly stabilized, moved the compile-time key choices to "feature.h" ("keys.h" now obsolete). 2.15 to 2.16 \----------- 1. Misc cleanup, rxvt once again passes the vttest (and reverse video works again). Kanji support tested and seems to be okay. Finally, an okay set of regular/bold colours. Compile-time option for a right-side scrollbar. 2. Ctrl-minus now (correctly) generates ^_ [0x1F]. Changed termcap/terminfo to use normal cursor keys instead of application cursor keys (rmkx/smkx, ke/ks) -- otherwise subsequent rxvt/xterm starts with the application cursor keys active. 3. Fixed scr_reset() so that resizing is a lot more sensible. Implemented the equivalent SouthWest resizeGravity (xterm X11R5) so the bottom line of text on the screen stays fixed. If the window is made taller, additional saved lines will be scrolled down onto the screen; if the window is made shorter, lines will be scrolled off the top of the screen, and the top saved lines will be dropped. The old resizing code is available with -DOLD_UGLY_RESIZE. 4. Altered code so all man-page documented command-line options will not trigger errors even if the feature wasn't compiled into rxvt. Added old, backward compatibility command-line options, but they're simply ignored. Eventually they can be removed -- perhaps Jan'97? `-8': use `+7' `-fat': use `-sb' `-thin': use `-arrows' `-meta8thbit' use `-meta8' `-metaescape' use `-meta' `-font_list' use `-font1', `-font2', etc. These ones are just too weird to support: `-ls-': use `+ls' `-ma-': use `+ma' 5. Removed secure-keyboard option, too problematic and obscure. 6. First attempt at GNU autoconfig. Still needs some work, but it's mostly okay. 7. Added minor aliases for foreground/background colours. This permits colour specifications like -fg "#13" -bg "#10", which would set the foreground to colour 13 (bright yellow) and the background to colour 10 (bright black). It's not terribly useful yet, but might eventually be a nice way to have bold/blink colour work even on with the standard fg/bg colours. 2.14 to 2.15 \----------- 1. Small bug: initial width incorrect when there was no scrollBar. 2. Close the gaping security hole. Renounce setuid/setgid privileges immediately and only take them up as needed -- chown() or writing into /etc/utmp. 3. Reverted to using `<' and '>' to toggle smaller/bigger fonts. It seems that many didn't like KP_Subtract/XK_KP_Add -- conflicts with some editors, and not all terminals have a Keypad anyhow. 4. Man page reformatted by Piercarlo Grandi so that it "now is done in the most delightful [sic] elegant 'roff style :-)" 5. Started to integrate the Kanji support based on old patches from the Linux-JE (Japanese Extensions) project. Consider it alpha until one of the JE authors gives it a thorough check. 6. Added compile-time selection of a few different scrollbar widths. 7. When reading X resources, rxvt now recognizes two class names: "XTerm" and "RXvt". The reason for two distinct names is that there are many options common between rxvt and xterm -- to which the class name "XTerm" permits easy access and configuration -- but there are also several options, notably colours and key-handling, unique to rxvt but which are useful to share between different rxvt configurations; the class name "RXvt" permits this. NB: The "RXvt" class takes precedence (in the event of a clash) and is the only one ever used for the application defaults file. 8. The initial value used for the Backspace key (^H or ^?) is now determined from the value of CERASE used to set the termios structures. This removes the need for the BACKSPACE_AS_DELETE compile-time option. 2.13 to 2.14 \----------- 1. Default HOTKEY prefix can now be choosen as `meta', `ctrl' or `shift'. Moved font toggle to KP_Add/KP_Subtract to resemble resolution toggling of the XFree86 server (Linux) and so that Alt-< can generate ESC-< for Emacs usage. Man page and usage() reflect the changes. Note that if you choose the hotkey to be `shift', to mimic the Linux console scrollback, you'll probably want different keybindings for mapAlert and Secure. The choice of the HOTKEY (ctrl or meta) prefix and some of the key-strings can be compile-time defined in "rxvtkeys.h", although probably the only changes desired will be in the string value associated with XK_Delete and in the choice of a HOTKEY (ctrl or meta) prefix. Use shift or ctrl to temporarily toggle Backspace from ^H to ^?. Use shift to temporarily toggle the application keypad. 2. Patch so that setting bold or blink works before or after changing the colour (it used to only work before changing the colour). Also added the option of having DOS VGA colours. Thanks Avery Pennarun 3. Extensive reworking of pseudo-tty handling and addition of BSD sgtty terminal handling and new utmpx (Solaris 2.x) support. MANY thanks to Raul Garcia Garcia (rgg@tid.es). POSIX wtmp support added by Piet W. Plomp (piet@icce.rug.nl) Added -/+ut option (resource: utmpInhibit) so you can sometimes be harder to find :) 4. Finally? cleaned-up selection so that it works properly -- clears a previously selected region without causing a core dump -- define NEW_SELECTION. I believe that this should fix a long-standing problem with the selection mechanism -- probably back from when selection of the scrollback was added -- whereby all accounting was done in terms of screen row values [0 .. RxvtWin.rows-1] plus the current offset value. The anchor and end points were scrolled with the screen, but the beginning point wasn't and extending a region that had its anchor scrolled-off would give complete garbage. The new selection scheme has lots of bounds-checking (too much?) to prevent these problems. If PRINT_PIPE is not defined, then you can use PrintScreen to dump some of the current selection state -- this should help debugging. Thanks to John Davis (davis@space.mit.edu) and Piet W. Plomp (piet@icce.rug.nl) for helping to diagnose the problem. 5. Use information request `ESC [ 8 n' to change the window title to the current rxvt version so you can find out what version you have. 6. Added simple code to permit run-time definition of the keysyms 0xFF00 - 0xFFFF if KEYSYM_RESOURCE (for FAKE_RESOURCES only) is defined. It's not as pretty as that used by xterm since it only works with keysym values rather that key names, but the impact on code size is quite minimal. I use it in conjunction with `-name vm' to remap arrow and function keys for tn3270 ... quite handy. At the moment the string length is only limited by the line length (currently 256) used in "resources.c" The syntax (at the moment) is rxvt*keysym.0xFFnn: "a string value" where `nn' is a 2 digit hex value 00 to FF. Of course if there were an easy and small means of converting key names to keysym values, then that would be better. The enclosing quotes are required to start/end with whitespace. Most of the usual escape values can be used: \b - backspace \e - escape \n - newline \r - carriage return \t - tab \000 - octal number Anyhow, here's a brief example of what it looks like in ~/.Xdefaults: ! F11 key - mimic the output of F1 rxvt*keysym.0xFFC8: \e[11~ ! F12 key - whatever rxvt*keysym.0xFFC9: Hello World!\n"\"String\" ends with whitespace " ! Delete key - remap rxvt*keysym.0xFFFF: "Delete :)" !Scroll_Lock as flow-control (^S) rxvt*keysym.0xFF14: \023 7. Oops -- fixed resource name from scrollbar to scrollBar. Fixed cursor colours to black on white (like xterm) for the scrollbar cursors, but I've left the xterm (`I'-bar) cursor as foreground on background because it looks so nice. Allocate all colours when creating the window so that we don't have to worry about it later and so that we can avoid potential hassles with colour-hungry applications like Netscape. 8. Added a way to distinguish an rxvt from an xterm via the obsolete ESC Z sending the vt100 answer string with 'c' -> 'C'. Added support for resolving the actual IP number of the host for remote DISPLAYs. Changed the answer back for ESC[7n to add a trailing newline to support easier input into the shell. When the display is local (i.e. :0), we add support for sending the first non-loopback interface IP number as the DISPLAY instead of just sending the incorrect ":0". This way telnet/rlogin shells can actually get the correct information into DISPLAY for xclients. Courtesy of Chuck Blake [Note: I've not had a chance to thoroughly test this -- mjo] 2.12 to 2.13 \----------- 1. Shift and Control now only work for non-application mode cursor keys and with function keys. 2. Override XTerm mouse reporting with either Mod1 or Shift. X11 mouse reporting now properly includes modifier keys (see rxvt.ref). Although this effectively degenerates to the Control modifier alone since both Shift and Meta are used to temporarily disable mouse reporting -- I don't know an easy way around this but that's what XTerm does, although since it uses Control to pop-up menus, that doesn't get transmitted either. 3. Moved a few more configuration items from Imakefile to configure.h 4. Added XAPPLOADDIR define to the Imakefile to allow use of the application defaults file XAPPLOADDIR/RXvt when rxvt has been compiled with FAKE_RESOURCES. Now, the following files are checked: XAPPLOADDIR/RXvt (compile-time defined) $HOME/.Xdefaults or $HOME/.Xresources suggested by John Gotts 5. Applied patches by Edward D.H. Liu to fix the speed of pasting rxvt's selection to motif, xew or tk. Finally! reasonable pasting speed to these applications. 6. patches by Gregory Margo for xterm-style proportional scrollbar behaviour: If pointer is near top, scroll one line. If pointer is near bottom, scroll full page. refreshPeriod resource and -refresh option ... still wishing for faster screen refreshing. 7. Bug fix for partial matches (FAKE_RESOURCES). In addition to resources for resource name `rxvt', also get resources for class name `XTerm' as well. Remove checking for `command' resource since it's not found in xterm nor was there any code in place to parse the command arguments ... better just to use the command-line -e option. Replace `fontList' with font1, font2, ... etc. for better xterm compatibility and for ease of configuration. Changed processing of string resources and command-line string options to avoid allocating redundant memory. 8. Previously selected region is now properly cleared when Button1 is pressed. Still have problems with click-and-drag when Mod1 or Shift is used to override mouse reporting -- argh! Until someone gets this properly patched, use Button1 followed by Button3 (to extend region) in these instances. 9. Understands ANSI set default fg/bg colour (\E[39m / \E[49m) 10. In the screen accounting used in screen.c, use a '\n' to terminate wrapped lines instead of '\0'. This should avoid mouse selection of wrapped lines from including a bogus newline. No known side-effects, but changes isolated by #define NEW_WRAPTYPE. 2.11 to 2.12 \----------- 1. Extra functionality for XTerm mouse report mode. If mouse reporting is enabled (the application will handle mouse events) the normal scrollbar operation is disabled -- instead rxvt sends UP/DOWN for the arrow buttons and PageUp/PageDown when Button1 or Button3 are clicked on the scrollbar. Use Mod1 (Alt) key to get the normal scrollbar/arrow button actions and also to get the normal selection functions -- so that you can still cut/paste between X applications. 2. New colour possibilities -- 16 colours. Instead of using fatter characters, a bold attribute now uses a brighter foreground colour. Similarly, a blink attribute will use a brighter background colour. It is also possible to choose these colours through the resources (color0 -- color7) permit specification of the ANSI colours (black, red, green, yellow, blue, magenta, cyan, white), the resources (color10 -- color17) are the brighter bold/blink equivalents. Define USE_FAKE_BOLD to disable. 3. Extensive clean-up of source and headers to separate interdependencies, remove unused variables. Introduced static variables wherever possible to limit scoping and reduced the number of external variables. 4. Allow NumLock to toggle on/off the application keypad. Backspace sends '\b', Ctrl-Backspace sends '\177'. Define BACKSPACE_AS_DELETE to reverse these values or use the escape sequence: ESC [ 36 h Backspace key sends BS ESC [ 36 l Backspace key sends DEL XK_End used to send "\033Ow", which is identical to XK_KP_7 and confuses EDT-type editors. Now, Home = "\033[7~" End = "\033[8~" Changed Alert & Secure keys from Alt-i & Alt-s to Alt-I & Alt-S so they aren't so easily toggled. 5. Extra keystroke info. Pass Control and Shift indicators for function keys (similar to the XJed editor) eg, F1 = ESC [11~ C-F1 = ESC [11^ S-F1 = ESC [11$ also, pass indication of shift status for arrow-keys eg, Up, Down, Right, Left = ESC [A, ESC [B, ESC [C, ESC [D S-Up, S-Down, S-Right, S-Left = ESC [a, ESC [b, ESC [c, ESC [d You wouldn't be able to use these keys for termcap/terminfo applications, but the key sequences are available for remapping within an application. 6. Added configure.h which is included by each source file and by the Imakefile. Common compilation defines are now all contained in configure.h with minor system defines remaining in Imakefile -- makes it much easier to configure. Used XCOMM macro in Imakefile so that it actually works. Also added defaults.h for defining user-specific startup defaults. 7. Added rxvt.ref to provide documentation of the various terminal sequences that are processed. Updated man page to reflect changes. 8. Use xterm-style -/+ to turn on/off options, rationalized resource names to more closely resemble xterm. Option Resource -help - -display displayname - -geometry geom geometry: -bg color background: -fg color foreground: -color color color: where = [0-7], 1[0-7] -fn fontname font: -fontList names fontList: ... -name string - -/+ls loginShell: True/False -/+ma mapAlert: True/False -/+vb visualBell: True/False -/+sb scrollbar: True/False -/+arrows scrollbar: Arrows/True/False -ic - -meta8 meta: 8bit -/+meta meta: True/False -sl number saveLines: -grk4 - -grk9 - -print-pipe name pipe-pipe: -e command arg ... command: -T string title: -n string iconName: -C - -/+7 bits: 7/8 -secure keysym secure_key: -pageup keysym pageup_key: -pagedown keysym pagedown_key: -bigfont keysym bigfont_key: -smallfont keysym smallfont_key: -prkey keysym printscreen_key: greektoggle_key: cutchars: 9. Fixed Button actions for XTerm-style scrollbar so that Button1 and Button3 do different things as they are supposed to. Replace -/+fat with -/+sb and -/+arrows for more consistency with XTerm. Decreased width of `fat' scrollbar (make closer to xterm) and increased width of `thin' scrollbar (arrows too small) -- they are now the same width. Also made it possible to remove the scrollbar altogether. Added a visual bell. Added many more defines to further reduce code size for various cases, see "configure.h". It is also possible to alter settings in "defaults.h" for configuration options that will only affect screen.c and xsetup.c, this should help with compile-time customization for those who don't want to use Xdefaults. Added the define REPLACE_SELECTION_NEWLINE to make the substitution of newlines with carriage returns for selection pasting a compile-time option. 10. Fixed the graphics samples so that if you want to it's actually possible to compile them. Added -name command-line option so that it's possible to select different sets of resources. 11. Integrated initial support for X11 mouse reporting and added Shift + Function Keys support. 2.10 to 2.11 1. If NEW_COLOR_MODEL is defined in screen.c, the new model I described in an earlier email is used. (apparantly there are two, slightly differnt models for using color extensions in a vt-compatible terminal. This flag lets you switch. 2. If XTERM_MOUSE_REPORT is defined in command.c, mouse reporting is turned on/off via the appropriate escape sequences. XTerm already provides this support. 3. If .Xdefaults does not exist, .Xresources is searched for. It seems that many here use .Xresources. 2.09 to 2.10 1. Really fixed the color problem (?) Got color-ls, and it works now. 2. Added patch to allow run-time selection of font list. 2.07 to 2.09 1. Fixed some color-usage errors. 2. Added double and triple-click support compliments of ah@doc.ic.ac.uk (Angelo Haritsis) 3. Added Print Screen capability, as in most vt-100's 2.06 to 2.07 1. Fixed problems with rxvt screwing up tty permisssions (?) 2.03 to 2.06 1. Fixed a limit which imposed a maximum width for the terminal window of 255 characters. There is no limit now. 2. Made provision for applications to get mouse-click feedback when user clicks in a graphics window. See graphics_sample 2.02 to 2.03 1. Fixed memory management just a little. 2.0 to 2.02 1. Bug fixes for color and graphics. 1.97 to 2.0 1. Added ANSI color support. Compile with -DCOLOR 2. Added a graphics mode. Compile with -DGRAPHICS 1.96 to 1.97 1. Bug in refresh() which was causing slow refreshes after clear-screens was fixed. Showed up during emacs start-up. 1.95 to 1.96 1. rxvt did bad things if it received mouse - Motion events without a preceeding button-press. Fixed. 1.94 to 1.95 1. Created a substitute for XGetDefaults, which seemed to account for 1/2 to 2/3 of the memory used by rxvt (according to the SIZE field of ps output). My substitute only reads the .Xdefaults file. Compile with -DFAKE_RESOURCES to get my mini- XDefaults handling, -DREAL_RESOURCES to keep XGetDefault. 1.93 to 1.94 1. Fixed some minor long-standing errors in the vt100 emulation. 2. Fixed ALT- handling in command.c 3. Fixed minor bug with start-of-selection location. 4. Added xterm-type "extend selection" feature using mouse button 3. Button 1 always starts a new selection. Button3 tries to extend the current selection if possible. 5. Fixed problem with bold-face fonts overflowing into the next character for some fonts. 1.92 to 1.93 1. ran gprof to find bottle-necks in the code. Halved user time, but had little effect on total time required to update the display. Seems worth keeping for the more efficient user-time, though. At this point, I think that most of the elapsed time is spent waiting for input or waiting for the X buffers to flush. 2. Used to refresh the screen every 2.2 screen-fulls during flat-out scrolling. Really cuts down on scroll-time. Now, refresh every screen-full (or when there's a pause in activity), but when flat-out scrolling starts, decrease the refresh period, so that its every 10th screenful after a little while. This has no noticeable visible effect, since the scrolling text is absolutely unintelligible anyway, but will improve the scroll "feel" when doing just one or two screenfulls, ie in an ls -l. 3. Surrounded the code which uses XCopyArea with #ifdef's I have never seen this help performance, but I think that there may be some video-systems which benefit from this, particularly in a full-screen editor or slow scrolling type of setting. 4. Performance in flat out scrolling, text only, on a sparc-10, displaying rxvt on an HDS x-terminal: nation@snoopy>/usr/bin/time rxvt -e cat k 6.1 real 3.1 user 2.5 sys nation@snoopy>/usr/bin/time xterm -e cat k 40.8 real 4.6 user 3.4 sys 1.91 to 1.92 1. Added greek-keyboard support patches. 1.85 to 1.91 1. assorted minor patches 1.82 to 1.85 1. Fixed ESC c handling. 2. Fixed minor selection handling bug. 1.81 to 1.82 1. Fixed slow refresh during selection process 2. Fixed problem of not correctly clearing selections of 1 character. 1.80 to 1.81 1. Fixed some scrolling problems, problems with partially obscured windows. 2. Added some neat debugging capability in debug.c 3. Patched up rclock. 1.74 to 1.80 1. Fixed core dump from selecting past the bottom of the screen 2. Fixed a few escape sequences, per the vttest program 3. Broke and fixed handling of moved/resize/new-font handling. 4. Still can't change tab stops correctly. 5. Ran vt-100 test suite. Added capability to change tab stops and enter reverse video, and to switch from 80 to 132 columns and back. Fixed a seg-fault in scroll(). 1.70 to 1.74 1. Fixed cursor drawing errors. 2. Improved smoothness of scroll-back operations. 3. Applied some SVR4 patches. 4. Applied HPUX patches, and a few cursor display patches 5. Fixed up font-changing routines a bit. 6. Fixed a scrolling problem for windows taller than the scroll-back buffer. 1.6 to 1.7 1. Fixed the problem with random rendition flags in the scroll back buffer 2. Fiddled with re-drawing on the scroll-bar, and with how often refreshing occurs. 3. Incorporated some AIX patches. 4. Included #ifdef'd changes to support vt100 printer. 5. Fixed send_string routine, so that it doesn't loose data. 6. Complete re-write of screen.c 1.5 to 1.6 1. Removed all use of a seperate bold font. Now uses over-striking exclusively. 2. Added some more optimizations for drawing speed when the window is re-sized or moved. 3. Implemented speed ups in screen.c 1.47 to 1.48 1. Cleaned up re-drawing on expose events, so rxvt only re-draws the newly exposed parts of the screen. 2. Fixed backspace, which must have broken in 1.45. 3. Added command line option of iconic startup. from 1.45 to 1.47 1. Incorporated improved bsd utmp handling from dperry@ringer.cs.utsa.edu (David Perry) 2. Fixed a very minor bug where the solid-cursor can leave a a bit of a ghost when you resize the window. Its stupid, but it always bothered me. from 1.4 to 1.45 1. Fixed scrolling error when switching to larger fonts 2. Fixed utmp-entry removal for SYSV type systems. 3. Icorportated patches for FreeBSD and svr4