ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.362 by sf-exg, Tue Dec 6 11:29:52 2011 UTC vs.
Revision 1.369 by sf-exg, Thu Jan 19 13:33:43 2012 UTC

36#include "keyboard.h" 36#include "keyboard.h"
37#include "rxvtperl.h" 37#include "rxvtperl.h"
38 38
39#include <limits> 39#include <limits>
40 40
41#include <cassert> 41#include <assert.h>
42#include <csignal> 42#include <signal.h>
43#include <cstring> 43#include <string.h>
44 44
45#include <termios.h> 45#include <termios.h>
46 46
47#ifdef HAVE_XSETLOCALE 47#ifdef HAVE_XSETLOCALE
48# define X_LOCALE 48# define X_LOCALE
49# include <X11/Xlocale.h> 49# include <X11/Xlocale.h>
50#else 50#else
51# ifdef HAVE_SETLOCALE 51# ifdef HAVE_SETLOCALE
52# include <clocale> 52# include <locale.h>
53# endif 53# endif
54#endif 54#endif
55 55
56struct termios rxvt_term::def_tio; 56struct termios rxvt_term::def_tio;
57vector<rxvt_term *> rxvt_term::termlist; 57vector<rxvt_term *> rxvt_term::termlist;
197 termlist.push_back (this); 197 termlist.push_back (this);
198 198
199#ifdef KEYSYM_RESOURCE 199#ifdef KEYSYM_RESOURCE
200 keyboard = new keyboard_manager; 200 keyboard = new keyboard_manager;
201#endif 201#endif
202
203 // this->envv = 0;
204} 202}
205 203
206// clean up the most important stuff, do *not* call x or free mem etc. 204// clean up the most important stuff, do *not* call x or free mem etc.
207// for use before an emergency exit 205// for use before an emergency exit
208void 206void
269 for (int i = 0; i < allocated.size (); i++) 267 for (int i = 0; i < allocated.size (); i++)
270 free (allocated [i]); 268 free (allocated [i]);
271 269
272 free (selection.text); 270 free (selection.text);
273 free (selection.clip_text); 271 free (selection.clip_text);
274 // TODO: manage env vars in child only(!)
275 free (env_display);
276 free (env_term);
277 free (locale); 272 free (locale);
278 free (v_buffer); 273 free (v_buffer);
279 274
280 delete selection_req; 275 delete selection_req;
281 276
355 350
356 delete this; 351 delete this;
357} 352}
358 353
359void 354void
360rxvt_term::set_option (uint8_t opt, bool set) 355rxvt_term::set_option (uint8_t opt, bool set) NOTHROW
361{ 356{
362 if (!opt) 357 if (!opt)
363 return; 358 return;
364 359
365 uint8_t mask = 1 << (opt & 7); 360 uint8_t mask = 1 << (opt & 7);
715 // size, i.e., when the wm does not honour our size hints, there are 710 // size, i.e., when the wm does not honour our size hints, there are
716 // extra areas not covered by the terminal screen. Such gaps, when a 711 // extra areas not covered by the terminal screen. Such gaps, when a
717 // bg pixmap is set, would have to be cleared manually to properly 712 // bg pixmap is set, would have to be cleared manually to properly
718 // refresh the background. We take the simpler route and shrink the 713 // refresh the background. We take the simpler route and shrink the
719 // vt window so as to avoid creating gaps. 714 // vt window so as to avoid creating gaps.
720 width = ncol * fwidth; 715 vt_width = ncol * fwidth;
721 height = nrow * fheight; 716 vt_height = nrow * fheight;
722} 717}
723 718
724/*----------------------------------------------------------------------*/ 719/*----------------------------------------------------------------------*/
725/* 720/*
726 * Tell the teletype handler what size the window is. 721 * Tell the teletype handler what size the window is.
734 729
735 struct winsize ws; 730 struct winsize ws;
736 731
737 ws.ws_col = ncol; 732 ws.ws_col = ncol;
738 ws.ws_row = nrow; 733 ws.ws_row = nrow;
739 ws.ws_xpixel = width; 734 ws.ws_xpixel = vt_width;
740 ws.ws_ypixel = height; 735 ws.ws_ypixel = vt_height;
741 ioctl (pty->pty, TIOCSWINSZ, &ws); 736 ioctl (pty->pty, TIOCSWINSZ, &ws);
742 737
743#if 0 738#if 0
744 // TIOCSWINSZ is supposed to do this automatically and correctly 739 // TIOCSWINSZ is supposed to do this automatically and correctly
745 if (cmd_pid) /* force through to the command */ 740 if (cmd_pid) /* force through to the command */
949 944
950/*----------------------------------------------------------------------*/ 945/*----------------------------------------------------------------------*/
951/* 946/*
952 * find if fg/bg matches any of the normal (low-intensity) colors 947 * find if fg/bg matches any of the normal (low-intensity) colors
953 */ 948 */
954void 949char *
955rxvt_term::set_colorfgbg () 950rxvt_term::get_colorfgbg ()
956{ 951{
957 unsigned int i; 952 unsigned int i;
958 const char *xpmb = ""; 953 const char *xpmb = "";
959 char fstr[] = "default"; 954 char fstr[] = "default";
960 char bstr[] = "default"; 955 char bstr[] = "default";
956 char *env_colorfgbg;
961 957
962 for (i = Color_Black; i <= Color_White; i++) 958 for (i = Color_Black; i <= Color_White; i++)
963 if (pix_colors[Color_fg] == pix_colors[i]) 959 if (pix_colors[Color_fg] == pix_colors[i])
964 { 960 {
965 sprintf (fstr, "%d", i - Color_Black); 961 sprintf (fstr, "%d", i - Color_Black);
974 xpmb = "default;"; 970 xpmb = "default;";
975#endif 971#endif
976 break; 972 break;
977 } 973 }
978 974
975 env_colorfgbg = (char *)rxvt_malloc (sizeof ("COLORFGBG=default;default;bg"));
979 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr); 976 sprintf (env_colorfgbg, "COLORFGBG=%s;%s%s", fstr, xpmb, bstr);
977 return env_colorfgbg;
980} 978}
981 979
982/*----------------------------------------------------------------------*/ 980/*----------------------------------------------------------------------*/
983 981
984bool 982bool
1077 if (scrollBar.state) 1075 if (scrollBar.state)
1078 scrollBar.resize (); 1076 scrollBar.resize ();
1079 1077
1080 XMoveResizeWindow (dpy, vt, 1078 XMoveResizeWindow (dpy, vt,
1081 window_vt_x, window_vt_y, 1079 window_vt_x, window_vt_y,
1082 width, height); 1080 vt_width, vt_height);
1083 1081
1084#ifdef HAVE_BG_PIXMAP 1082#ifdef HAVE_BG_PIXMAP
1085 if (bg_window_size_sensitive ()) 1083 if (bg_window_size_sensitive ())
1086 update_background (); 1084 update_background ();
1087#endif 1085#endif
1112 newwidth = wattr.width - szHint.base_width; 1110 newwidth = wattr.width - szHint.base_width;
1113 if (newheight == 0) 1111 if (newheight == 0)
1114 newheight = wattr.height - szHint.base_height; 1112 newheight = wattr.height - szHint.base_height;
1115 } 1113 }
1116 1114
1117 if (newwidth != width || newheight != height) 1115 if (newwidth != vt_width || newheight != vt_height)
1118 { 1116 {
1119 newwidth += szHint.base_width; 1117 newwidth += szHint.base_width;
1120 newheight += szHint.base_height; 1118 newheight += szHint.base_height;
1121 resize_all_windows (newwidth, newheight, 0); 1119 resize_all_windows (newwidth, newheight, 0);
1122 } 1120 }
1570 1568
1571 /* try with no modifiers base IF the user didn't specify an IM */ 1569 /* try with no modifiers base IF the user didn't specify an IM */
1572 if (im_get_ic ("@im=none")) 1570 if (im_get_ic ("@im=none"))
1573 goto done; 1571 goto done;
1574 1572
1575done: 1573done: ;
1576#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1574#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1577 if (rs[Rs_imLocale]) 1575 if (rs[Rs_imLocale])
1578 SET_LOCALE (locale); 1576 SET_LOCALE (locale);
1579#endif 1577#endif
1580} 1578}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines