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.33 by pcg, Fri Feb 13 13:28:17 2004 UTC vs.
Revision 1.44 by pcg, Tue Feb 24 16:25:44 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*;
2 * File: main.c 2 * File: main.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA> 11 * Copyright (c) 1997 mj olesen <olesen@me.QueensU.CA>
12 * - extensive modifications 12 * - extensive modifications
13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> 13 * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de>
14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 14 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
15 * - extensive modifications 15 * - extensive modifications
16 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
16 * 17 *
17 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or 20 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version. 21 * (at your option) any later version.
79 vt_ev (this, &rxvt_term::x_cb), 80 vt_ev (this, &rxvt_term::x_cb),
80#ifdef HAVE_SCROLLBARS 81#ifdef HAVE_SCROLLBARS
81 scrollbar_ev (this, &rxvt_term::x_cb), 82 scrollbar_ev (this, &rxvt_term::x_cb),
82#endif 83#endif
83#ifdef MENUBAR 84#ifdef MENUBAR
84 menubar_ev (this, &rxvt_term::x_cb), fixme 85 menubar_ev (this, &rxvt_term::x_cb),
85#endif 86#endif
86#ifdef CURSOR_BLINK 87#ifdef CURSOR_BLINK
87 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 88 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
88#endif 89#endif
89#ifdef TEXT_BLINK 90#ifdef TEXT_BLINK
90 text_blink_ev (this, &rxvt_term::text_blink_cb), 91 text_blink_ev (this, &rxvt_term::text_blink_cb),
91#endif 92#endif
92#ifdef POINTER_BLANK 93#ifdef POINTER_BLANK
93 pointer_ev (this, &rxvt_term::pointer_cb), 94 pointer_ev (this, &rxvt_term::pointer_cb),
95#endif
96#ifdef USE_XIM
97 im_ev (this, &rxvt_term::im_cb),
94#endif 98#endif
95 check_ev (this, &rxvt_term::check_cb), 99 check_ev (this, &rxvt_term::check_cb),
96 destroy_ev (this, &rxvt_term::destroy_cb), 100 destroy_ev (this, &rxvt_term::destroy_cb),
97 pty_ev (this, &rxvt_term::pty_cb), 101 pty_ev (this, &rxvt_term::pty_cb),
98 incr_ev (this, &rxvt_term::incr_cb), 102 incr_ev (this, &rxvt_term::incr_cb)
99#ifdef USE_XIM
100 im_ev (this, &rxvt_term::im_cb)
101#endif
102{ 103{
103 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 104 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
104} 105}
105 106
106rxvt_term::~rxvt_term () 107rxvt_term::~rxvt_term ()
107{ 108{
108 if (cmd_fd >= 0) 109 if (cmd_fd >= 0)
109 close (cmd_fd); 110 close (cmd_fd);
111
112#ifndef NO_SETOWNER_TTYDEV
113 privileged_ttydev (RESTORE);
114#endif
115#ifdef UTMP_SUPPORT
116 privileged_utmp (RESTORE);
117#endif
118
119 delete TermWin.fontset;
120
121 if (display)
122 {
123 if (TermWin.parent[0])
124 XDestroyWindow (display->display, TermWin.parent[0]);
125#if defined(MENUBAR) && (MENUBAR_MAX > 1)
126 if (menuBar.win)
127 XDestroyWindow (display->display, menuBar.win);
128 delete menuBar.drawable;
129#endif
130 }
131
132 // TODO: free pixcolours, colours should become part of rxvt_display
133
134 delete PixColors;
135
136 displays.put (display);
110 137
111 scr_release (); 138 scr_release ();
112 139
113 free (env_windowid); 140 free (env_windowid);
114 free (env_display); 141 free (env_display);
115 free (env_term); 142 free (env_term);
116 free (env_colorfgbg); 143 free (env_colorfgbg);
117 free (locale); 144 free (locale);
118 free (codeset); 145 free (codeset);
119 146
120#ifndef NO_SETOWNER_TTYDEV
121 privileged_ttydev (RESTORE);
122#endif
123#ifdef UTMP_SUPPORT
124 privileged_utmp (RESTORE);
125#endif
126
127 // TODO: free pixcolours, colours should become part of rxvt_display
128
129 delete PixColors;
130 delete TermWin.fontset;
131
132 displays.put (display);
133
134 delete envv; 147 delete envv;
135 delete argv; 148 delete argv;
136} 149}
137 150
138void 151void
139rxvt_term::destroy () 152rxvt_term::destroy ()
140{ 153{
141 if (display) 154 if (display)
142 { 155 {
143 if (TermWin.parent[0])
144 XDestroyWindow (display->display, TermWin.parent[0]);
145
146 rootwin_ev.stop (display); 156 rootwin_ev.stop (display);
147 termwin_ev.stop (display); 157 termwin_ev.stop (display);
148 vt_ev.stop (display); 158 vt_ev.stop (display);
149
150#ifdef USE_XIM 159#ifdef USE_XIM
151 im_destroy (); 160 im_destroy ();
152 im_ev.stop (display); 161 im_ev.stop (display);
153#endif 162#endif
154#ifdef HAVE_SCROLLBARS 163#ifdef HAVE_SCROLLBARS
247 256
248 const char **cmd_argv = init_resources (argc, argv); 257 const char **cmd_argv = init_resources (argc, argv);
249 258
250 set_locale (""); 259 set_locale ("");
251 260
252#if (MENUBAR_MAX) 261#if MENUBAR_MAX
253 menubar_read (rs[Rs_menu]); 262 menubar_read (rs[Rs_menu]);
254#endif 263#endif
255#ifdef HAVE_SCROLLBARS 264#ifdef HAVE_SCROLLBARS
256 if (Options & Opt_scrollBar) 265 if (Options & Opt_scrollBar)
257 scrollBar.setIdle (); /* set existence for size calculations */ 266 scrollBar.setIdle (); /* set existence for size calculations */
260 create_windows (argc, argv); 269 create_windows (argc, argv);
261 270
262 init_xlocale (); 271 init_xlocale ();
263 272
264 scr_reset (); /* initialize screen */ 273 scr_reset (); /* initialize screen */
265#ifdef RXVT_GRAPHICS
266 Gr_reset (); /* reset graphics */
267#endif
268 274
269#if 0 275#if 0
270#ifdef DEBUG_X
271 XSynchronize (display->display, True); 276 XSynchronize (display->display, True);
272#endif
273#endif 277#endif
274 278
275#ifdef HAVE_SCROLLBARS 279#ifdef HAVE_SCROLLBARS
276 if (Options & Opt_scrollBar) 280 if (Options & Opt_scrollBar)
277 resize_scrollbar (); /* create and map scrollbar */ 281 resize_scrollbar (); /* create and map scrollbar */
278#endif 282#endif
279#if (MENUBAR_MAX) 283#if (MENUBAR_MAX)
280 if (menubar_visible (r)) 284 if (menubar_visible ())
281 XMapWindow (display->display, menuBar.win); 285 XMapWindow (display->display, menuBar.win);
282#endif 286#endif
283#ifdef TRANSPARENT 287#ifdef TRANSPARENT
284 if (Options & Opt_transparent) 288 if (Options & Opt_transparent)
285 { 289 {
718 * init = 1 - initialize 722 * init = 1 - initialize
719 * 723 *
720 * fontname == FONT_UP - switch to bigger font 724 * fontname == FONT_UP - switch to bigger font
721 * fontname == FONT_DN - switch to smaller font 725 * fontname == FONT_DN - switch to smaller font
722 */ 726 */
723void 727bool
724rxvt_term::change_font (int init, const char *fontname) 728rxvt_term::change_font (const char *fontname)
725{} 729{
730 if (fontname == FONT_UP)
731 {
732 // TODO
733 }
734 else if (fontname == FONT_DN)
735 {
736 // TODO
737 }
738 else
739 {
740 rxvt_fontset *fs = new rxvt_fontset (this);
726 741
727void 742 if (fs && fs->populate (fontname))
743 {
744 delete TermWin.fontset;
745 TermWin.fontset = fs;
746 TermWin.fwidth = fs->base_font ()->width;
747 TermWin.fheight = fs->base_font ()->height;
748 TermWin.fbase = fs->base_font ()->ascent;
749
750 // TODO: screen needs to be told about new fonts
751
752 if (TermWin.parent[0])
753 {
754 resize_all_windows (0, 0, 0);
755 scr_remap_chars ();
756 scr_touch (true);
757 }
758
759 return true;
760 }
761 }
762
763 return false;
764}
765
766bool
728rxvt_term::font_up_down (int n, int direction) 767rxvt_term::font_up_down (int n, int direction)
729{} 768{
769 return false;
770}
730 771
731/*----------------------------------------------------------------------*/ 772/*----------------------------------------------------------------------*/
732/*----------------------------------------------------------------------*/ 773/*----------------------------------------------------------------------*/
733/* xterm sequences - title, iconName, color (exptl) */ 774/* xterm sequences - title, iconName, color (exptl) */
734void 775void
995 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); 1036 0, TermWin_TotalWidth (), menuBar_TotalHeight ());
996 1037
997 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, 1038 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x,
998 window_vt_y, TermWin_TotalWidth (), 1039 window_vt_y, TermWin_TotalWidth (),
999 TermWin_TotalHeight ()); 1040 TermWin_TotalHeight ());
1000#ifdef RXVT_GRAPHICS
1001 if (old_height)
1002 Gr_Resize (old_width - szHint.base_width,
1003 old_height - szHint.base_height);
1004#endif
1005 scr_clear (); 1041 scr_clear ();
1006#ifdef XPM_BACKGROUND 1042#ifdef XPM_BACKGROUND
1007 resize_pixmap (); 1043 resize_pixmap ();
1008#endif 1044#endif
1009 1045
1315 if (Input_Context) 1351 if (Input_Context)
1316 return; 1352 return;
1317 1353
1318#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1354#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1319 if (rs[Rs_imLocale]) 1355 if (rs[Rs_imLocale])
1320 setlocale (LC_CTYPE, rs[Rs_imLocale]); 1356 SET_LOCALE (rs[Rs_imLocale]);
1321#endif 1357#endif
1322 1358
1323 p = rs[Rs_inputMethod]; 1359 p = rs[Rs_inputMethod];
1324 if (p && *p) 1360 if (p && *p)
1325 { 1361 {
1356 goto done; 1392 goto done;
1357 1393
1358done: 1394done:
1359#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 1395#if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
1360 if (rs[Rs_imLocale]) 1396 if (rs[Rs_imLocale])
1361 setlocale (LC_CTYPE, locale); 1397 SET_LOCALE (locale);
1362#endif 1398#endif
1363} 1399}
1364 1400
1365void 1401void
1366rxvt_term::IMSetStatusPosition () 1402rxvt_term::IMSetStatusPosition ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines