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.190 by root, Thu Jan 19 20:30:36 2006 UTC vs.
Revision 1.191 by root, Fri Jan 20 10:27:08 2006 UTC

48# include <termios.h> 48# include <termios.h>
49#endif 49#endif
50 50
51vector<rxvt_term *> rxvt_term::termlist; 51vector<rxvt_term *> rxvt_term::termlist;
52 52
53// used to tell global functions which terminal instance is "active"
54rxvt_t rxvt_current_term;
55
53static char curlocale[128], savelocale[128]; 56static char curlocale[128], savelocale[128];
54 57
55bool 58bool
56rxvt_set_locale (const char *locale) 59rxvt_set_locale (const char *locale) NOTHROW
57{ 60{
58 if (!locale || !strncmp (locale, curlocale, 128)) 61 if (!locale || !strncmp (locale, curlocale, 128))
59 return false; 62 return false;
60 63
61 strncpy (curlocale, locale, 128); 64 strncpy (curlocale, locale, 128);
62 setlocale (LC_CTYPE, curlocale); 65 setlocale (LC_CTYPE, curlocale);
63 return true; 66 return true;
64} 67}
65 68
66void 69void
67rxvt_push_locale (const char *locale) 70rxvt_push_locale (const char *locale) NOTHROW
68{ 71{
69 strcpy (savelocale, curlocale); 72 strcpy (savelocale, curlocale);
70 rxvt_set_locale (locale); 73 rxvt_set_locale (locale);
71} 74}
72 75
73void 76void
74rxvt_pop_locale () 77rxvt_pop_locale () NOTHROW
75{ 78{
76 rxvt_set_locale (savelocale); 79 rxvt_set_locale (savelocale);
77} 80}
78 81
79#if ENABLE_COMBINING 82#if ENABLE_COMBINING
182 185
183 termlist.push_back (this); 186 termlist.push_back (this);
184 187
185#ifdef KEYSYM_RESOURCE 188#ifdef KEYSYM_RESOURCE
186 keyboard = new keyboard_manager; 189 keyboard = new keyboard_manager;
187
188 if (!keyboard)
189 rxvt_fatal ("out of memory, aborting.\n");
190#endif 190#endif
191} 191}
192 192
193// clean up the most important stuff, do *not* call x or free mem etc. 193// clean up the most important stuff, do *not* call x or free mem etc.
194// for use before an emergency exit 194// for use before an emergency exit
200 delete pty; pty = 0; 200 delete pty; pty = 0;
201} 201}
202 202
203rxvt_term::~rxvt_term () 203rxvt_term::~rxvt_term ()
204{ 204{
205 HOOK_INVOKE ((this, HOOK_DESTROY, DT_END));
206
207 termlist.erase (find (termlist.begin (), termlist.end(), this)); 205 termlist.erase (find (termlist.begin (), termlist.end(), this));
208 206
209 emergency_cleanup (); 207 emergency_cleanup ();
210 208
211#if ENABLE_STYLES 209#if ENABLE_STYLES
302 300
303void 301void
304rxvt_term::destroy () 302rxvt_term::destroy ()
305{ 303{
306 if (destroy_ev.active) 304 if (destroy_ev.active)
305 return;
306
307 if (HOOK_INVOKE ((this, HOOK_DESTROY, DT_END)))
307 return; 308 return;
308 309
309#if ENABLE_OVERLAY 310#if ENABLE_OVERLAY
310 scr_overlay_off (); 311 scr_overlay_off ();
311#endif 312#endif
508 check_our_parents (); 509 check_our_parents ();
509 rootwin_ev.start (display, display->root); 510 rootwin_ev.start (display, display->root);
510 } 511 }
511#endif 512#endif
512 513
514 set_colorfgbg ();
515
516 init_command (cmd_argv);
517
518 free (cmd_argv);
519
520 if (pty->pty >= 0)
521 pty_ev.start (pty->pty, EVENT_READ);
522
523 check_ev.start ();
524
525 HOOK_INVOKE ((this, HOOK_START, DT_END));
526
513 XMapWindow (disp, vt); 527 XMapWindow (disp, vt);
514 XMapWindow (disp, parent[0]); 528 XMapWindow (disp, parent[0]);
515
516 set_colorfgbg ();
517
518 init_command (cmd_argv);
519
520 free (cmd_argv);
521
522 if (pty->pty >= 0)
523 pty_ev.start (pty->pty, EVENT_READ);
524
525 check_ev.start ();
526
527 HOOK_INVOKE ((this, HOOK_START, DT_END));
528 529
529 return true; 530 return true;
530} 531}
531 532
532static struct sig_handlers 533static struct sig_handlers
631 rxvt_fatal ("memory allocation failure. aborting.\n"); 632 rxvt_fatal ("memory allocation failure. aborting.\n");
632 633
633 return p; 634 return p;
634} 635}
635 636
636void * 637void *
637rxvt_realloc (void *ptr, size_t size) 638rxvt_realloc (void *ptr, size_t size)
638{ 639{
639 void *p = realloc (ptr, size); 640 void *p = realloc (ptr, size);
640 641
641 if (!p) 642 if (!p)
1589 XFree (preedit_attr); 1590 XFree (preedit_attr);
1590 XFree (status_attr); 1591 XFree (status_attr);
1591} 1592}
1592#endif /* USE_XIM */ 1593#endif /* USE_XIM */
1593 1594
1594/*----------------------------------------------------------------------*/
1595rxvt_t rxvt_current_term;
1596
1597/*----------------------- end-of-file (C source) -----------------------*/ 1595/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines