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.155 by root, Mon Jan 2 15:35:43 2006 UTC vs.
Revision 1.186 by root, Tue Jan 17 15:41:33 2006 UTC

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 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
17 * 17 *
18 * 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
19 * 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
20 * the Free Software Foundation; either version 2 of the License, or 20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version. 21 * (at your option) any later version.
46 46
47#ifdef HAVE_TERMIOS_H 47#ifdef HAVE_TERMIOS_H
48# include <termios.h> 48# include <termios.h>
49#endif 49#endif
50 50
51#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
52static uid_t saved_euid;
53static gid_t saved_egid;
54#endif
55
56bool
57rxvt_tainted ()
58{
59#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
60 return getuid () != saved_euid || getgid () != saved_egid;
61#else
62 return false;
63#endif
64}
65
51vector<rxvt_term *> rxvt_term::termlist; 66vector<rxvt_term *> rxvt_term::termlist;
52 67
53static char curlocale[128]; 68static char curlocale[128], savelocale[128];
54 69
55bool 70bool
56rxvt_set_locale (const char *locale) 71rxvt_set_locale (const char *locale)
57{ 72{
58 if (!locale || !strncmp (locale, curlocale, 128)) 73 if (!locale || !strncmp (locale, curlocale, 128))
59 return false; 74 return false;
60 75
61 strncpy (curlocale, locale, 128); 76 strncpy (curlocale, locale, 128);
62 setlocale (LC_CTYPE, curlocale); 77 setlocale (LC_CTYPE, curlocale);
63 return true; 78 return true;
79}
80
81void
82rxvt_push_locale (const char *locale)
83{
84 strcpy (savelocale, curlocale);
85 rxvt_set_locale (locale);
86}
87
88void
89rxvt_pop_locale ()
90{
91 rxvt_set_locale (savelocale);
64} 92}
65 93
66#if ENABLE_COMBINING 94#if ENABLE_COMBINING
67class rxvt_composite_vec rxvt_composite; 95class rxvt_composite_vec rxvt_composite;
68 96
132#if TRANSPARENT 160#if TRANSPARENT
133 rootwin_ev (this, &rxvt_term::rootwin_cb), 161 rootwin_ev (this, &rxvt_term::rootwin_cb),
134#endif 162#endif
135#ifdef HAVE_SCROLLBARS 163#ifdef HAVE_SCROLLBARS
136 scrollbar_ev (this, &rxvt_term::x_cb), 164 scrollbar_ev (this, &rxvt_term::x_cb),
137#endif
138#ifdef MENUBAR
139 menubar_ev (this, &rxvt_term::x_cb),
140#endif 165#endif
141#ifdef CURSOR_BLINK 166#ifdef CURSOR_BLINK
142 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 167 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
143#endif 168#endif
144#ifdef TEXT_BLINK 169#ifdef TEXT_BLINK
184void rxvt_term::emergency_cleanup () 209void rxvt_term::emergency_cleanup ()
185{ 210{
186 if (cmd_pid) 211 if (cmd_pid)
187 kill (-cmd_pid, SIGHUP); 212 kill (-cmd_pid, SIGHUP);
188 213
189#ifdef UTMP_SUPPORT 214 delete pty; pty = 0;
190 privileged_utmp (RESTORE);
191#endif
192
193 pty.put ();
194} 215}
195 216
196rxvt_term::~rxvt_term () 217rxvt_term::~rxvt_term ()
197{ 218{
198 PERL_INVOKE ((this, HOOK_DESTROY, DT_END)); 219 HOOK_INVOKE ((this, HOOK_DESTROY, DT_END));
199 220
200 termlist.erase (find (termlist.begin (), termlist.end(), this)); 221 termlist.erase (find (termlist.begin (), termlist.end(), this));
201 222
202 emergency_cleanup (); 223 emergency_cleanup ();
203 224
214 235
215 selection_clear (); 236 selection_clear ();
216 237
217#ifdef USE_XIM 238#ifdef USE_XIM
218 im_destroy (); 239 im_destroy ();
219#endif
220#ifdef MENUBAR
221 if (menubarGC) XFreeGC (disp, menubarGC);
222#endif 240#endif
223#ifdef XTERM_SCROLLBAR 241#ifdef XTERM_SCROLLBAR
224 if (xscrollbarGC) XFreeGC (disp, xscrollbarGC); 242 if (xscrollbarGC) XFreeGC (disp, xscrollbarGC);
225 if (ShadowGC) XFreeGC (disp, ShadowGC); 243 if (ShadowGC) XFreeGC (disp, ShadowGC);
226#endif 244#endif
237 if (upArrow) XFreePixmap (disp, upArrow); 255 if (upArrow) XFreePixmap (disp, upArrow);
238 if (downArrow) XFreePixmap (disp, downArrow); 256 if (downArrow) XFreePixmap (disp, downArrow);
239 if (upArrowHi) XFreePixmap (disp, upArrowHi); 257 if (upArrowHi) XFreePixmap (disp, upArrowHi);
240 if (downArrowHi) XFreePixmap (disp, downArrowHi); 258 if (downArrowHi) XFreePixmap (disp, downArrowHi);
241#endif 259#endif
242#if defined(MENUBAR) || defined(RXVT_SCROLLBAR) 260#ifdef RXVT_SCROLLBAR
243 if (topShadowGC) XFreeGC (disp, topShadowGC); 261 if (topShadowGC) XFreeGC (disp, topShadowGC);
244 if (botShadowGC) XFreeGC (disp, botShadowGC); 262 if (botShadowGC) XFreeGC (disp, botShadowGC);
245 if (scrollbarGC) XFreeGC (disp, scrollbarGC); 263 if (scrollbarGC) XFreeGC (disp, scrollbarGC);
246#endif 264#endif
247 if (gc) XFreeGC (disp, gc); 265 if (gc) XFreeGC (disp, gc);
248 266
249#if defined(MENUBAR) && (MENUBAR_MAX > 1)
250 delete menuBar.drawable;
251 //if (menuBar.win)
252 // XDestroyWindow (disp, menuBar.win);
253#endif
254 delete drawable; 267 delete drawable;
255 // destroy all windows 268 // destroy all windows
256 if (parent[0]) 269 if (parent[0])
257 XDestroyWindow (disp, parent[0]); 270 XDestroyWindow (disp, parent[0]);
258 } 271 }
259 272
260 // TODO: free pixcolours, colours should become part of rxvt_display 273 // TODO: free pixcolours, colours should become part of rxvt_display
261
262 delete pix_colors_focused; 274 delete pix_colors_focused;
263#if OFF_FOCUS_FADING 275#if OFF_FOCUS_FADING
264 delete pix_colors_unfocused; 276 delete pix_colors_unfocused;
265#endif 277#endif
266 278
315 im_ev.stop (display); 327 im_ev.stop (display);
316#endif 328#endif
317#if HAVE_SCROLLBARS 329#if HAVE_SCROLLBARS
318 scrollbar_ev.stop (display); 330 scrollbar_ev.stop (display);
319#endif 331#endif
320#if MENUBAR
321 menubar_ev.stop (display);
322#endif
323#if TRANSPARENT 332#if TRANSPARENT
324 rootwin_ev.stop (display); 333 rootwin_ev.stop (display);
325#endif 334#endif
326 incr_ev.stop (); 335 incr_ev.stop ();
327 termwin_ev.stop (display); 336 termwin_ev.stop (display);
350} 359}
351 360
352void 361void
353rxvt_term::destroy_cb (time_watcher &w) 362rxvt_term::destroy_cb (time_watcher &w)
354{ 363{
355 SET_R (this); 364 make_current ();
356 365
357 delete this; 366 delete this;
358} 367}
359 368
360/*----------------------------------------------------------------------*/ 369/*----------------------------------------------------------------------*/
451/*----------------------------------------------------------------------*/ 460/*----------------------------------------------------------------------*/
452bool 461bool
453rxvt_term::init (int argc, const char *const *argv) 462rxvt_term::init (int argc, const char *const *argv)
454{ 463{
455 SET_R (this); 464 SET_R (this);
456
457 set_locale (""); 465 set_locale ("");
466 set_environ (envv); // few things in X do not call setlocale :(
458 467
459 if (!init_vars ()) 468 if (!init_vars ())
460 return false; 469 return false;
461 470
462 init_secondary (); 471 init_secondary ();
465 474
466#ifdef KEYSYM_RESOURCE 475#ifdef KEYSYM_RESOURCE
467 keyboard->register_done (); 476 keyboard->register_done ();
468#endif 477#endif
469 478
470#if MENUBAR_MAX
471 menubar_read (rs[Rs_menu]);
472#endif
473#ifdef HAVE_SCROLLBARS 479#ifdef HAVE_SCROLLBARS
474 if (OPTION (Opt_scrollBar)) 480 if (OPTION (Opt_scrollBar))
475 scrollBar.setIdle (); /* set existence for size calculations */ 481 scrollBar.setIdle (); /* set existence for size calculations */
476#endif 482#endif
477 483
478#if ENABLE_PERL 484#if ENABLE_PERL
485 if (!rs[Rs_perl_ext_1])
486 rs[Rs_perl_ext_1] = "default";
487
488 if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1])
489 || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2])
490 || (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
491 {
492#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
493 // ignore some perl-related arguments if some bozo installed us set[ug]id
494 if (rxvt_tainted ())
495 {
496 if ((rs[Rs_perl_lib] && *rs[Rs_perl_lib])
497 || (rs[Rs_perl_eval] && *rs[Rs_perl_eval]))
498 {
499 rxvt_warn ("running with elevated privileges: ignoring perl-lib and perl-eval.\n");
500 rs[Rs_perl_lib] = 0;
501 rs[Rs_perl_eval] = 0;
502 }
503 }
504#endif
479 rxvt_perl.init (); 505 rxvt_perl.init (this);
480#endif
481
482 PERL_INVOKE ((this, HOOK_INIT, DT_END)); 506 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
507 }
508#endif
509
510 pty = rxvt_new_ptytty ();
483 511
484 create_windows (argc, argv); 512 create_windows (argc, argv);
485 513
486 dDisp; 514 dDisp;
487 515
488 init_xlocale (); 516 init_xlocale ();
489 517
490 scr_reset (); /* initialize screen */ 518 scr_reset (); // initialize screen
491 519
492#if 0 520#if 0
493 XSynchronize (disp, True); 521 XSynchronize (disp, True);
494#endif 522#endif
495 523
496#ifdef HAVE_SCROLLBARS 524#ifdef HAVE_SCROLLBARS
497 if (OPTION (Opt_scrollBar)) 525 if (OPTION (Opt_scrollBar))
498 resize_scrollbar (); /* create and map scrollbar */ 526 resize_scrollbar (); /* create and map scrollbar */
499#endif 527#endif
500#if (MENUBAR_MAX)
501 if (menubar_visible ())
502 XMapWindow (disp, menuBar.win);
503#endif
504#ifdef TRANSPARENT 528#ifdef TRANSPARENT
505 if (OPTION (Opt_transparent)) 529 if (OPTION (Opt_transparent))
506 { 530 {
507 XSelectInput (disp, display->root, PropertyChangeMask); 531 XSelectInput (disp, display->root, PropertyChangeMask);
508 check_our_parents (); 532 check_our_parents ();
517 541
518 init_command (cmd_argv); 542 init_command (cmd_argv);
519 543
520 free (cmd_argv); 544 free (cmd_argv);
521 545
546 if (pty->pty >= 0)
522 pty_ev.start (pty.pty, EVENT_READ); 547 pty_ev.start (pty->pty, EVENT_READ);
523 548
524 check_ev.start (); 549 check_ev.start ();
525 550
526 PERL_INVOKE ((this, HOOK_START, DT_END)); 551 HOOK_INVOKE ((this, HOOK_START, DT_END));
527 552
528 return true; 553 return true;
529} 554}
530 555
531static struct sig_handlers 556static struct sig_handlers
566 sw_int (this, &sig_handlers::sig_term) 591 sw_int (this, &sig_handlers::sig_term)
567 { 592 {
568 } 593 }
569} sig_handlers; 594} sig_handlers;
570 595
596char **rxvt_environ; // startup environment
597
571void 598void
572rxvt_init () 599rxvt_init ()
573{ 600{
601 uid_t uid = getuid ();
602 gid_t gid = getgid ();
603
604 // before doing anything else, check for setuid/setgid operation,
605 // start the helper process and drop privileges
606 if (uid != geteuid ()
607 || 1 //D
608 || gid != getegid ())
609 {
610#if PTYTTY_HELPER
611 rxvt_ptytty_server ();
612#else
613 rxvt_warn ("running setuid/setgid without pty helper compiled in, continuing unprivileged.\n");
614#endif
615
616 // drop privileges
617#if HAVE_SETRESUID
618 setresgid (gid, gid, gid);
619 setresuid (uid, uid, uid);
620#elif HAVE_SETREUID
621 setregid (gid, gid);
622 setreuid (uid, uid);
623#elif HAVE_SETUID
624 setgid (gid);
625 setuid (uid);
626#endif
627
628 if (uid != geteuid ()
629 || gid != getegid ())
630 rxvt_fatal ("unable to drop privileges, aborting.\n");
631 }
632
633 rxvt_environ = environ;
634
574 /* 635 /*
575 * Save and then give up any super-user privileges 636 * Save and then give up any super-user privileges
576 * If we need privileges in any area then we must specifically request it. 637 * If we need privileges in any area then we must specifically request it.
577 * We should only need to be root in these cases: 638 * We should only need to be root in these cases:
578 * 1. write utmp entries on some systems 639 * 1. write utmp entries on some systems
592 /* signal (SIGURG, SIG_DFL); */ 653 /* signal (SIGURG, SIG_DFL); */
593 654
594 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 655 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
595 // TODO: handle this with exceptions and tolerate the memory loss 656 // TODO: handle this with exceptions and tolerate the memory loss
596 XSetIOErrorHandler (rxvt_xioerror_handler); 657 XSetIOErrorHandler (rxvt_xioerror_handler);
658
659 XrmInitialize ();
597} 660}
598 661
599/* ------------------------------------------------------------------------- * 662/* ------------------------------------------------------------------------- *
600 * MEMORY ALLOCATION WRAPPERS * 663 * MEMORY ALLOCATION WRAPPERS *
601 * ------------------------------------------------------------------------- */ 664 * ------------------------------------------------------------------------- */
637 * ------------------------------------------------------------------------- */ 700 * ------------------------------------------------------------------------- */
638/* take care of suid/sgid super-user (root) privileges */ 701/* take care of suid/sgid super-user (root) privileges */
639void 702void
640rxvt_privileges (rxvt_privaction action) 703rxvt_privileges (rxvt_privaction action)
641{ 704{
642#if (defined(HAVE_SETEUID) || defined(HAVE_SETREUID)) && !defined(__CYGWIN32__)
643 static uid_t euid;
644 static gid_t egid;
645#endif
646
647#if ! defined(__CYGWIN32__) 705#if ! defined(__CYGWIN32__)
648# if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) 706# if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
649 /* setreuid () is the poor man's setuid (), seteuid () */ 707 /* setreuid () is the poor man's setuid (), seteuid () */
650# define seteuid(a) setreuid(-1, (a)) 708# define seteuid(a) setreuid(-1, (a))
651# define setegid(a) setregid(-1, (a)) 709# define setegid(a) setregid(-1, (a))
657 case IGNORE: 715 case IGNORE:
658 /* 716 /*
659 * change effective uid/gid - not real uid/gid - so we can switch 717 * change effective uid/gid - not real uid/gid - so we can switch
660 * back to root later, as required 718 * back to root later, as required
661 */ 719 */
720 setegid (getgid ());
662 seteuid (getuid ()); 721 seteuid (getuid ());
663 setegid (getgid ());
664 break; 722 break;
665 case SAVE: 723 case SAVE:
666 euid = geteuid ();
667 egid = getegid (); 724 saved_egid = getegid ();
725 saved_euid = geteuid ();
668 break; 726 break;
669 case RESTORE: 727 case RESTORE:
670 seteuid (euid);
671 setegid (egid); 728 setegid (saved_egid);
729 seteuid (saved_euid);
672 break; 730 break;
673 } 731 }
674# else 732# else
675 switch (action) 733 switch (action)
676 { 734 {
677 case IGNORE: 735 case IGNORE:
736 setgid (getgid ());
678 setuid (getuid ()); 737 setuid (getuid ());
679 setgid (getgid ());
680 /* FALLTHROUGH */ 738 /* FALLTHROUGH */
681 case SAVE: 739 case SAVE:
682 /* FALLTHROUGH */ 740 /* FALLTHROUGH */
683 case RESTORE: 741 case RESTORE:
684 break; 742 break;
685 } 743 }
686# endif 744# endif
687#endif 745#endif
688} 746}
689 747
690#ifdef UTMP_SUPPORT
691void
692rxvt_term::privileged_utmp (rxvt_privaction action)
693{
694 if (OPTION (Opt_utmpInhibit)
695 || !pty.name || !*pty.name)
696 return;
697
698 rxvt_privileges (RESTORE);
699
700 if (action == SAVE)
701 makeutent (pty.name, rs[Rs_display_name]);
702 else
703 cleanutent ();
704
705 rxvt_privileges (IGNORE);
706}
707#endif
708
709/*----------------------------------------------------------------------*/ 748/*----------------------------------------------------------------------*/
710/* 749/*
711 * window size/position calculcations for XSizeHint and other storage. 750 * window size/position calculcations for XSizeHint and other storage.
712 * if width/height are non-zero then override calculated width/height 751 * if width/height are non-zero then override calculated width/height
713 */ 752 */
714void 753void
715rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) 754rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
716{ 755{
717 short recalc_x, recalc_y; 756 short recalc_x, recalc_y;
718 int x, y, sb_w, mb_h, flags; 757 int x, y, sb_w, flags;
719 unsigned int w, h; 758 unsigned int w, h;
720 unsigned int max_width, max_height; 759 unsigned int max_width, max_height;
721 dDisp; 760 dDisp;
722 761
723 D_SIZE ((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d", 762 D_SIZE ((stderr, "< Cols/Rows: %3d x %3d ; Width/Height: %4d x %4d",
784 max_width = MAX_COLS * fwidth; 823 max_width = MAX_COLS * fwidth;
785 max_height = MAX_ROWS * fheight; 824 max_height = MAX_ROWS * fheight;
786 825
787 szHint.base_width = szHint.base_height = 2 * int_bwidth; 826 szHint.base_width = szHint.base_height = 2 * int_bwidth;
788 827
789 sb_w = mb_h = 0; 828 sb_w = 0;
790 window_vt_x = window_vt_y = int_bwidth; 829 window_vt_x = window_vt_y = int_bwidth;
791 830
792 if (scrollbar_visible ()) 831 if (scrollBar.state)
793 { 832 {
794 sb_w = scrollbar_TotalWidth (); 833 sb_w = scrollbar_TotalWidth ();
795 szHint.base_width += sb_w; 834 szHint.base_width += sb_w;
796 if (!OPTION (Opt_scrollBar_right)) 835 if (!OPTION (Opt_scrollBar_right))
797 window_vt_x += sb_w; 836 window_vt_x += sb_w;
798 } 837 }
799 838
800 if (menubar_visible ())
801 {
802 mb_h = menuBar_TotalHeight ();
803 szHint.base_height += mb_h;
804 window_vt_y += mb_h;
805 }
806
807 szHint.width_inc = fwidth; 839 szHint.width_inc = fwidth;
808 szHint.height_inc = fheight; 840 szHint.height_inc = fheight;
809 szHint.min_width = szHint.base_width + szHint.width_inc; 841 szHint.min_width = szHint.base_width + szHint.width_inc;
810 szHint.min_height = szHint.base_height + szHint.height_inc; 842 szHint.min_height = szHint.base_height + szHint.height_inc;
811 843
829 { 861 {
830 min_it (height, max_height); 862 min_it (height, max_height);
831 szHint.height = szHint.base_height + height; 863 szHint.height = szHint.base_height + height;
832 } 864 }
833 865
834 if (scrollbar_visible () && OPTION (Opt_scrollBar_right)) 866 if (scrollBar.state && OPTION (Opt_scrollBar_right))
835 window_sb_x = szHint.width - sb_w; 867 window_sb_x = szHint.width - sb_w;
836 868
837 if (recalc_x) 869 if (recalc_x)
838 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth; 870 szHint.x += DisplayWidth (disp, display->screen) - szHint.width - 2 * ext_bwidth;
839 if (recalc_y) 871 if (recalc_y)
853 * Called after a window size change. 885 * Called after a window size change.
854 */ 886 */
855void 887void
856rxvt_term::tt_winch () 888rxvt_term::tt_winch ()
857{ 889{
858 if (pty.pty < 0) 890 if (pty->pty < 0)
859 return; 891 return;
860 892
861 struct winsize ws; 893 struct winsize ws;
862 894
863 ws.ws_col = ncol; 895 ws.ws_col = ncol;
864 ws.ws_row = nrow; 896 ws.ws_row = nrow;
865 ws.ws_xpixel = width; 897 ws.ws_xpixel = width;
866 ws.ws_ypixel = height; 898 ws.ws_ypixel = height;
867 (void)ioctl (pty.pty, TIOCSWINSZ, &ws); 899 (void)ioctl (pty->pty, TIOCSWINSZ, &ws);
868 900
869#if 0 901#if 0
870 // TIOCSWINSZ⎈ is supposed to do this automatically and correctly 902 // TIOCSWINSZ⎈ is supposed to do this automatically and correctly
871 if (cmd_pid) /* force through to the command */ 903 if (cmd_pid) /* force through to the command */
872 kill (-cmd_pid, SIGWINCH); 904 kill (-cmd_pid, SIGWINCH);
908 prop.height += lineSpace; 940 prop.height += lineSpace;
909 fs->set_prop (prop); 941 fs->set_prop (prop);
910 942
911 fwidth = prop.width; 943 fwidth = prop.width;
912 fheight = prop.height; 944 fheight = prop.height;
913 fbase = (*fs)[1]->ascent; 945 fbase = prop.ascent;
914 946
915 for (int style = 1; style < 4; style++) 947 for (int style = 1; style < 4; style++)
916 { 948 {
917#if ENABLE_STYLES 949#if ENABLE_STYLES
918 const char *res = rs[Rs_font + style]; 950 const char *res = rs[Rs_font + style];
1009 i = atoi (color); 1041 i = atoi (color);
1010 1042
1011 if (i >= 8 && i <= 15) 1043 if (i >= 8 && i <= 15)
1012 { /* bright colors */ 1044 { /* bright colors */
1013 i -= 8; 1045 i -= 8;
1014# ifndef NO_BRIGHTCOLOR
1015 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; 1046 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i];
1016 SET_PIXCOLOR (idx); 1047 SET_PIXCOLOR (idx);
1017 goto done; 1048 goto done;
1018# endif
1019 } 1049 }
1020 1050
1021 if (i >= 0 && i <= 7) 1051 if (i >= 0 && i <= 7)
1022 { /* normal colors */ 1052 { /* normal colors */
1023 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; 1053 pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
1196 1226
1197 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 1227 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
1198 1228
1199 if (fix_screen || newwidth != old_width || newheight != old_height) 1229 if (fix_screen || newwidth != old_width || newheight != old_height)
1200 { 1230 {
1201 if (scrollbar_visible ()) 1231 if (scrollBar.state)
1202 { 1232 {
1203 XMoveResizeWindow (disp, scrollBar.win, 1233 XMoveResizeWindow (disp, scrollBar.win,
1204 window_sb_x, 0, 1234 window_sb_x, 0,
1205 scrollbar_TotalWidth (), szHint.height); 1235 scrollbar_TotalWidth (), szHint.height);
1206 resize_scrollbar (); 1236 resize_scrollbar ();
1207 } 1237 }
1208 1238
1209 if (menubar_visible ())
1210 XMoveResizeWindow (disp, menuBar.win,
1211 window_vt_x, 0,
1212 TermWin_TotalWidth (), menuBar_TotalHeight ());
1213
1214 XMoveResizeWindow (disp, vt, 1239 XMoveResizeWindow (disp, vt,
1215 window_vt_x, window_vt_y, 1240 window_vt_x, window_vt_y,
1216 TermWin_TotalWidth (), TermWin_TotalHeight ()); 1241 width, height);
1217 1242
1218 scr_clear (); 1243 scr_clear ();
1219#ifdef XPM_BACKGROUND 1244#ifdef XPM_BACKGROUND
1220 resize_pixmap (); 1245 resize_pixmap ();
1221#endif 1246#endif
1401 XRectangle rect, status_rect, needed_rect; 1426 XRectangle rect, status_rect, needed_rect;
1402 unsigned long fg, bg; 1427 unsigned long fg, bg;
1403 const char *p; 1428 const char *p;
1404 char **s; 1429 char **s;
1405 XIMStyles *xim_styles; 1430 XIMStyles *xim_styles;
1431
1432 set_environ (envv);
1406 1433
1407 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1434 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1408 return false; 1435 return false;
1409 1436
1410 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1437 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
1576 int i; 1603 int i;
1577 const char *p; 1604 const char *p;
1578 char **s; 1605 char **s;
1579 char buf[IMBUFSIZ]; 1606 char buf[IMBUFSIZ];
1580 1607
1581 SET_R (this); 1608 make_current ();
1582 1609
1583 im_destroy (); 1610 im_destroy ();
1584 1611
1585 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); 1612 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
1586 if (Input_Context) 1613 if (Input_Context)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines