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.51 by pcg, Sat Mar 6 00:05:01 2004 UTC vs.
Revision 1.67 by pcg, Sun May 9 18:19:49 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>
7 * - original version 7 * - original version
44# include <termios.h> 44# include <termios.h>
45#endif 45#endif
46 46
47#include <cstring> 47#include <cstring>
48 48
49vector<rxvt_term *> rxvt_term::termlist;
50
49static char curlocale[128]; 51static char curlocale[128];
50 52
51void 53bool
52rxvt_set_locale (const char *locale) 54rxvt_set_locale (const char *locale)
53{ 55{
54 if (locale && STRNCMP (locale, curlocale, 128)) 56 if (!locale || !STRNCMP (locale, curlocale, 128))
55 { 57 return false;
58
56 STRNCPY (curlocale, locale, 128); 59 STRNCPY (curlocale, locale, 128);
57 setlocale (LC_CTYPE, curlocale); 60 setlocale (LC_CTYPE, curlocale);
58 } 61 return true;
59} 62}
60 63
64#if ENABLE_COMBINING
61class rxvt_composite_vec rxvt_composite; 65class rxvt_composite_vec rxvt_composite;
62 66
63text_t rxvt_composite_vec::compose (uint32_t c1, uint32_t c2) 67text_t rxvt_composite_vec::compose (unicode_t c1, unicode_t c2)
64{ 68{
65 compose_char *cc; 69 compose_char *cc;
66 70
67 // break compose chains, as stupid readline really likes to duplicate 71 // break compose chains, as stupid readline really likes to duplicate
68 // composing characters for some reason near the end of a line. 72 // composing characters for some reason near the end of a line.
94 v.push_back (compose_char (c1, c2)); 98 v.push_back (compose_char (c1, c2));
95 99
96 return v.size () - 1 + COMPOSE_LO; 100 return v.size () - 1 + COMPOSE_LO;
97} 101}
98 102
99int rxvt_composite_vec::expand (uint32_t c, wchar_t *r) 103int rxvt_composite_vec::expand (unicode_t c, wchar_t *r)
100{ 104{
101 compose_char *cc = (*this)[c]; 105 compose_char *cc = (*this)[c];
102 106
103 if (!cc) 107 if (!cc)
104 { 108 {
117 } 121 }
118 122
119 return len; 123 return len;
120 124
121} 125}
126#endif
122 127
123extern struct rxvt_composite_vec rxvt_composite;
124void * 128void *
125rxvt_term::operator new (size_t s) 129rxvt_term::operator new (size_t s)
126{ 130{
127 void *p = malloc (s); 131 void *p = malloc (s);
128 132
163 destroy_ev (this, &rxvt_term::destroy_cb), 167 destroy_ev (this, &rxvt_term::destroy_cb),
164 pty_ev (this, &rxvt_term::pty_cb), 168 pty_ev (this, &rxvt_term::pty_cb),
165 incr_ev (this, &rxvt_term::incr_cb) 169 incr_ev (this, &rxvt_term::incr_cb)
166{ 170{
167 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; 171 cmdbuf_ptr = cmdbuf_endp = cmdbuf_base;
172
173 termlist.push_back (this);
168} 174}
169 175
170rxvt_term::~rxvt_term () 176rxvt_term::~rxvt_term ()
171{ 177{
178 termlist.erase (find (termlist.begin (), termlist.end(), this));
179
172 if (cmd_fd >= 0) 180 if (cmd_fd >= 0)
173 close (cmd_fd); 181 close (cmd_fd);
174 182
175#ifndef NO_SETOWNER_TTYDEV 183#ifndef NO_SETOWNER_TTYDEV
176 privileged_ttydev (RESTORE); 184 privileged_ttydev (RESTORE);
181 189
182 delete TermWin.fontset; 190 delete TermWin.fontset;
183 191
184 if (display) 192 if (display)
185 { 193 {
194 selection_clear ();
195
196#ifdef MENUBAR
197 if (menubarGC) XFreeGC (display->display, menubarGC);
198#endif
199#ifdef XTERM_SCROLLBAR
200 if (xscrollbarGC) XFreeGC (display->display, xscrollbarGC);
201 if (ShadowGC) XFreeGC (display->display, ShadowGC);
202#endif
203#ifdef PLAIN_SCROLLBAR
204 if (pscrollbarGC) XFreeGC (display->display, pscrollbarGC);
205#endif
206#ifdef NEXT_SCROLLBAR
207 if (blackGC) XFreeGC (display->display, blackGC);
208 if (whiteGC) XFreeGC (display->display, whiteGC);
209 if (grayGC) XFreeGC (display->display, grayGC);
210 if (darkGC) XFreeGC (display->display, darkGC);
211 if (stippleGC) XFreeGC (display->display, stippleGC);
212 if (dimple) XFreePixmap (display->display, dimple);
213 if (upArrow) XFreePixmap (display->display, upArrow);
214 if (downArrow) XFreePixmap (display->display, downArrow);
215 if (upArrowHi) XFreePixmap (display->display, upArrowHi);
216 if (downArrowHi) XFreePixmap (display->display, downArrowHi);
217#endif
218#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
219 if (topShadowGC) XFreeGC (display->display, topShadowGC);
220 if (botShadowGC) XFreeGC (display->display, botShadowGC);
221 if (scrollbarGC) XFreeGC (display->display, scrollbarGC);
222#endif
223 if (TermWin.gc) XFreeGC (display->display, TermWin.gc);
224
186#if defined(MENUBAR) && (MENUBAR_MAX > 1) 225#if defined(MENUBAR) && (MENUBAR_MAX > 1)
187 delete menuBar.drawable; 226 delete menuBar.drawable;
188 //if (menuBar.win) 227 //if (menuBar.win)
189 // XDestroyWindow (display->display, menuBar.win); 228 // XDestroyWindow (display->display, menuBar.win);
190#endif 229#endif
200 239
201 displays.put (display); 240 displays.put (display);
202 241
203 scr_release (); 242 scr_release ();
204 243
244 /* clear all resources */
245 for (int i = 0; i < allocated.size (); i++)
246 free (allocated[i]);
247
248 free (selection.text);
249 // TODO: manage env vars in child only(!)
205 free (env_windowid); 250 free (env_windowid);
206 free (env_display); 251 free (env_display);
207 free (env_term); 252 free (env_term);
208 free (env_colorfgbg); 253 free (env_colorfgbg);
209 free (locale); 254 free (locale);
255#if 0
210 free (codeset); 256 free (codeset);
257#endif
211 258
212 delete envv; 259 delete envv;
213 delete argv; 260 delete argv;
214} 261}
215 262
256 delete this; 303 delete this;
257} 304}
258 305
259/*----------------------------------------------------------------------*/ 306/*----------------------------------------------------------------------*/
260/* rxvt_init () */ 307/* rxvt_init () */
261/* LIBPROTO */
262rxvt_t
263rxvt_init (int argc, const char *const *argv)
264{
265 SET_R (new rxvt_term);
266
267 if (!GET_R->init_vars () || !GET_R->init (argc, argv))
268 {
269 delete GET_R;
270 SET_R (0);
271 }
272
273 return GET_R;
274}
275
276static int (*old_xerror_handler) (Display *dpy, XErrorEvent *event);
277
278void
279rxvt_init_signals ()
280{
281 /* install exit handler for cleanup */
282#if 0
283#ifdef HAVE_ATEXIT
284 atexit (rxvt_clean_exit);
285#else
286#endif
287#endif
288
289 struct sigaction sa;
290
291 sigfillset (&sa.sa_mask);
292 sa.sa_flags = SA_NOCLDSTOP | SA_RESTART;
293 sa.sa_handler = SIG_IGN; sigaction (SIGHUP , &sa, 0);
294 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0);
295 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGINT , &sa, 0);
296 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGQUIT, &sa, 0);
297 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGTERM, &sa, 0);
298 sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0);
299
300 /* need to trap SIGURG for SVR4 (Unixware) rlogin */
301 /* signal (SIGURG, SIG_DFL); */
302
303 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
304 //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler);
305}
306
307bool 308bool
308rxvt_term::init (int argc, const char *const *argv) 309rxvt_term::init (int argc, const char *const *argv)
309{ 310{
311 SET_R (this);
312
313 if (!init_vars ())
314 return false;
315
310 /* 316 /*
311 * Save and then give up any super-user privileges 317 * Save and then give up any super-user privileges
312 * If we need privileges in any area then we must specifically request it. 318 * If we need privileges in any area then we must specifically request it.
313 * We should only need to be root in these cases: 319 * We should only need to be root in these cases:
314 * 1. write utmp entries on some systems 320 * 1. write utmp entries on some systems
369 check_ev.start (); 375 check_ev.start ();
370 376
371 return true; 377 return true;
372} 378}
373 379
380static int (*old_xerror_handler) (Display *dpy, XErrorEvent *event);
381
382void
383rxvt_init_signals ()
384{
385 /* install exit handler for cleanup */
386#if 0
387#ifdef HAVE_ATEXIT
388 atexit (rxvt_clean_exit);
389#else
390#endif
391#endif
392
393 struct sigaction sa;
394
395 sigfillset (&sa.sa_mask);
396 sa.sa_flags = SA_NOCLDSTOP | SA_RESTART;
397 sa.sa_handler = SIG_IGN; sigaction (SIGHUP , &sa, 0);
398 sa.sa_handler = SIG_IGN; sigaction (SIGPIPE, &sa, 0);
399 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGINT , &sa, 0);
400 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGQUIT, &sa, 0);
401 sa.sa_handler = rxvt_Exit_signal; sigaction (SIGTERM, &sa, 0);
402 sa.sa_handler = rxvt_Child_signal; sigaction (SIGCHLD, &sa, 0);
403
404 /* need to trap SIGURG for SVR4 (Unixware) rlogin */
405 /* signal (SIGURG, SIG_DFL); */
406
407 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
408 //XSetIOErrorHandler ((XErrorHandler) rxvt_xioerror_handler);
409}
410
374/* ------------------------------------------------------------------------- * 411/* ------------------------------------------------------------------------- *
375 * SIGNAL HANDLING & EXIT HANDLER * 412 * SIGNAL HANDLING & EXIT HANDLER *
376 * ------------------------------------------------------------------------- */ 413 * ------------------------------------------------------------------------- */
377/* 414/*
378 * Catch a SIGCHLD signal and exit if the direct child has died 415 * Catch a SIGCHLD signal and exit if the direct child has died
379 */ 416 */
417
418void rxvt_term::child_exited (int pid)
419{
420 for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++)
421 if (pid == (*t)->cmd_pid)
422 {
423 (*t)->destroy ();
424 break;
425 }
426}
427
380/* ARGSUSED */ 428/* ARGSUSED */
381/* EXTPROTO */ 429/* EXTPROTO */
382RETSIGTYPE 430RETSIGTYPE
383rxvt_Child_signal (int sig __attribute__ ((unused))) 431rxvt_Child_signal (int sig __attribute__ ((unused)))
384{ 432{
385 int pid, save_errno = errno; 433 int pid, save_errno = errno;
434
386 while ((pid = waitpid (-1, NULL, WNOHANG)) == -1 && errno == EINTR) 435 while ((pid = waitpid (-1, NULL, WNOHANG)) > 0)
387 ; 436 rxvt_term::child_exited (pid);
437
388 errno = save_errno; 438 errno = save_errno;
389
390#if 0
391 if (pid == cmd_pid)
392 exit (EXIT_SUCCESS);
393#endif
394} 439}
395 440
396/* 441/*
397 * Catch a fatal signal and tidy up before quitting 442 * Catch a fatal signal and tidy up before quitting
398 */ 443 */
400RETSIGTYPE 445RETSIGTYPE
401rxvt_Exit_signal (int sig) 446rxvt_Exit_signal (int sig)
402{ 447{
403 signal (sig, SIG_DFL); 448 signal (sig, SIG_DFL);
404#ifdef DEBUG_CMD 449#ifdef DEBUG_CMD
405 rxvt_print_error ("signal %d", sig); 450 rxvt_warn ("caught signal %d, exiting.\n", sig);
406#endif 451#endif
407 rxvt_clean_exit (); 452 rxvt_clean_exit ();
408 kill (getpid (), sig); 453 kill (getpid (), sig);
409} 454}
410 455
685 else 730 else
686 szHint.win_gravity = SouthWestGravity; 731 szHint.win_gravity = SouthWestGravity;
687 } 732 }
688 } 733 }
689 } 734 }
735
690 /* TODO: BOUNDS */ 736 /* TODO: BOUNDS */
691 TermWin.width = TermWin.ncol * TermWin.fwidth; 737 TermWin.width = TermWin.ncol * TermWin.fwidth;
692 TermWin.height = TermWin.nrow * TermWin.fheight; 738 TermWin.height = TermWin.nrow * TermWin.fheight;
693 max_width = MAX_COLS * TermWin.fwidth; 739 max_width = MAX_COLS * TermWin.fwidth;
694 max_height = MAX_ROWS * TermWin.fheight; 740 max_height = MAX_ROWS * TermWin.fheight;
695 741
696 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth; 742 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;
697 743
698 sb_w = mb_h = 0; 744 sb_w = mb_h = 0;
699 window_vt_x = window_vt_y = 0; 745 window_vt_x = window_vt_y = 0;
746
700 if (scrollbar_visible ()) 747 if (scrollbar_visible ())
701 { 748 {
702 sb_w = scrollbar_TotalWidth (); 749 sb_w = scrollbar_TotalWidth ();
703 szHint.base_width += sb_w; 750 szHint.base_width += sb_w;
704 if (! (Options & Opt_scrollBar_right)) 751 if (! (Options & Opt_scrollBar_right))
705 window_vt_x = sb_w; 752 window_vt_x = sb_w;
706 } 753 }
754
707 if (menubar_visible ()) 755 if (menubar_visible ())
708 { 756 {
709 mb_h = menuBar_TotalHeight (); 757 mb_h = menuBar_TotalHeight ();
710 szHint.base_height += mb_h; 758 szHint.base_height += mb_h;
711 window_vt_y = mb_h; 759 window_vt_y = mb_h;
712 } 760 }
761
713 szHint.width_inc = TermWin.fwidth; 762 szHint.width_inc = TermWin.fwidth;
714 szHint.height_inc = TermWin.fheight; 763 szHint.height_inc = TermWin.fheight;
715 szHint.min_width = szHint.base_width + szHint.width_inc; 764 szHint.min_width = szHint.base_width + szHint.width_inc;
716 szHint.min_height = szHint.base_height + szHint.height_inc; 765 szHint.min_height = szHint.base_height + szHint.height_inc;
717 766
723 else 772 else
724 { 773 {
725 MIN_IT (TermWin.width, max_width); 774 MIN_IT (TermWin.width, max_width);
726 szHint.width = szHint.base_width + TermWin.width; 775 szHint.width = szHint.base_width + TermWin.width;
727 } 776 }
777
728 if (height && height - szHint.base_height < max_height) 778 if (height && height - szHint.base_height < max_height)
729 { 779 {
730 szHint.height = height; 780 szHint.height = height;
731 TermWin.height = height - szHint.base_height; 781 TermWin.height = height - szHint.base_height;
732 } 782 }
733 else 783 else
734 { 784 {
735 MIN_IT (TermWin.height, max_height); 785 MIN_IT (TermWin.height, max_height);
736 szHint.height = szHint.base_height + TermWin.height; 786 szHint.height = szHint.base_height + TermWin.height;
737 } 787 }
788
738 if (scrollbar_visible () && (Options & Opt_scrollBar_right)) 789 if (scrollbar_visible () && (Options & Opt_scrollBar_right))
739 window_sb_x = szHint.width - sb_w; 790 window_sb_x = szHint.width - sb_w;
740 791
741 if (recalc_x) 792 if (recalc_x)
742 szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display)) 793 szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display))
836/*----------------------------------------------------------------------*/ 887/*----------------------------------------------------------------------*/
837/* xterm sequences - title, iconName, color (exptl) */ 888/* xterm sequences - title, iconName, color (exptl) */
838void 889void
839rxvt_term::set_title (const char *str) 890rxvt_term::set_title (const char *str)
840{ 891{
841#ifndef SMART_WINDOW_TITLE 892#ifdef SMART_WINDOW_TITLE
842 XStoreName (display->display, TermWin.parent[0], str);
843#else
844 char *name; 893 char *name;
845 894
846 if (XFetchName (display->display, TermWin.parent[0], &name) == 0) 895 if (!XFetchName (display->display, TermWin.parent[0], &name))
847 name = NULL; 896 name = NULL;
897
848 if (name == NULL || STRCMP (name, str)) 898 if (name == NULL || STRCMP (name, str))
899#endif
849 XStoreName (display->display, TermWin.parent[0], str); 900 XStoreName (display->display, TermWin.parent[0], str);
901
902#ifdef SMART_WINDOW_TITLE
850 if (name) 903 if (name)
851 XFree (name); 904 XFree (name);
852#endif 905#endif
853} 906}
854 907
855void 908void
856rxvt_term::set_iconName (const char *str) 909rxvt_term::set_icon_name (const char *str)
857{ 910{
858#ifndef SMART_WINDOW_TITLE 911#ifdef SMART_WINDOW_TITLE
859 XSetIconName (display->display, TermWin.parent[0], str);
860#else
861 char *name; 912 char *name;
862 913
863 if (XGetIconName (display->display, TermWin.parent[0], &name)) 914 if (!XGetIconName (display->display, TermWin.parent[0], &name))
864 name = NULL; 915 name = NULL;
916
865 if (name == NULL || STRCMP (name, str)) 917 if (name == NULL || STRCMP (name, str))
918#endif
866 XSetIconName (display->display, TermWin.parent[0], str); 919 XSetIconName (display->display, TermWin.parent[0], str);
920
921#ifdef SMART_WINDOW_TITLE
867 if (name) 922 if (name)
868 XFree (name); 923 XFree (name);
869#endif 924#endif
870} 925}
871 926
898 PixColors[idx] = PixColors[minCOLOR + i]; 953 PixColors[idx] = PixColors[minCOLOR + i];
899 SET_PIXCOLOR (idx); 954 SET_PIXCOLOR (idx);
900 goto Done; 955 goto Done;
901 } 956 }
902 } 957 }
958
903 if (!rXParseAllocColor (& xcol, color)) 959 if (!rXParseAllocColor (& xcol, color))
904 return; 960 return;
961
905 /* XStoreColor (display->display, XCMAP, XColor*); */ 962 /* XStoreColor (display->display, XCMAP, XColor*); */
906 963
907 /* 964 /*
908 * FIXME: should free colors here, but no idea how to do it so instead, 965 * FIXME: should free colors here, but no idea how to do it so instead,
909 * so just keep gobbling up the colormap 966 * so just keep gobbling up the colormap
932 989
933 /* handle Color_BD, scrollbar background, etc. */ 990 /* handle Color_BD, scrollbar background, etc. */
934 991
935 set_colorfgbg (); 992 set_colorfgbg ();
936 recolour_cursor (); 993 recolour_cursor ();
937 /* the only reasonable way to enforce a clean update */ 994 scr_touch (true);
938 scr_poweron ();
939} 995}
940 996
941#else 997#else
942# define set_window_color (idx,color) ((void)0) 998# define set_window_color (idx,color) ((void)0)
943#endif /* XTERM_COLOR_CHANGE */ 999#endif /* XTERM_COLOR_CHANGE */
944 1000
945void 1001void
946rxvt_term::recolour_cursor () 1002rxvt_term::recolour_cursor ()
947{ 1003{
948#if TODO
949 rxvt_color xcol[2]; 1004 XColor xcol[2];
950 1005
951 xcol[0] = PixColors[Color_pointer]; 1006 xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg];
952 xcol[1] = PixColors[Color_bg]; 1007 xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg];
953 XQueryColors (display->display, XCMAP, xcol, 2); 1008 XQueryColors (display->display, XCMAP, xcol, 2);
954 XRecolorCursor (display->display, TermWin_cursor, & (xcol[0]), & (xcol[1])); 1009 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
955#endif
956} 1010}
957 1011
958/*----------------------------------------------------------------------*/ 1012/*----------------------------------------------------------------------*/
959/* 1013/*
960 * find if fg/bg matches any of the normal (low-intensity) colors 1014 * find if fg/bg matches any of the normal (low-intensity) colors
1009int 1063int
1010rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour) 1064rxvt_term::rXParseAllocColor (rxvt_color *screen_in_out, const char *colour)
1011{ 1065{
1012 if (!screen_in_out->set (display, colour)) 1066 if (!screen_in_out->set (display, colour))
1013 { 1067 {
1014 rxvt_print_error ("can't allocate colour: %s", colour); 1068 rxvt_warn ("can't get colour '%s', continuing without.\n", colour);
1015 return false; 1069 return false;
1016 } 1070 }
1017 1071
1018 return true; 1072 return true;
1019} 1073}
1030 int old_width = szHint.width, old_height = szHint.height; 1084 int old_width = szHint.width, old_height = szHint.height;
1031#endif 1085#endif
1032 1086
1033 window_calc (width, height); 1087 window_calc (width, height);
1034 XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); 1088 XSetWMNormalHints (display->display, TermWin.parent[0], &szHint);
1089
1035 if (!ignoreparent) 1090 if (!ignoreparent)
1036 { 1091 {
1037#ifdef SMART_RESIZE 1092#ifdef SMART_RESIZE
1038 /* 1093 /*
1039 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> 1094 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt>
1074 dy /= 2; 1129 dy /= 2;
1075 1130
1076 XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, 1131 XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy,
1077 szHint.width, szHint.height); 1132 szHint.width, szHint.height);
1078#else 1133#else
1079 XResizeWindow (display->display, TermWin.parent[0], szHint.width, 1134 XResizeWindow (display->display, TermWin.parent[0], szHint.width, szHint.height);
1080 szHint.height);
1081#endif 1135#endif
1082
1083 } 1136 }
1084 1137
1085 fix_screen = (TermWin.ncol != prev_ncol 1138 fix_screen = TermWin.ncol != prev_ncol || TermWin.nrow != prev_nrow;
1086 || TermWin.nrow != prev_nrow);
1087 1139
1088 if (fix_screen || width != old_width || height != old_height) 1140 if (fix_screen || width != old_width || height != old_height)
1089 { 1141 {
1090 if (scrollbar_visible ()) 1142 if (scrollbar_visible ())
1091 { 1143 {
1092 XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, 1144 XMoveResizeWindow (display->display, scrollBar.win,
1145 window_sb_x, 0,
1093 0, scrollbar_TotalWidth (), szHint.height); 1146 scrollbar_TotalWidth (), szHint.height);
1094 resize_scrollbar (); 1147 resize_scrollbar ();
1095 } 1148 }
1096 1149
1097 if (menubar_visible ()) 1150 if (menubar_visible ())
1098 XMoveResizeWindow (display->display, menuBar.win, window_vt_x, 1151 XMoveResizeWindow (display->display, menuBar.win,
1152 window_vt_x, 0,
1099 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); 1153 TermWin_TotalWidth (), menuBar_TotalHeight ());
1100 1154
1101 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, 1155 XMoveResizeWindow (display->display, TermWin.vt,
1102 window_vt_y, TermWin_TotalWidth (), 1156 window_vt_x, window_vt_y,
1103 TermWin_TotalHeight ()); 1157 TermWin_TotalWidth (), TermWin_TotalHeight ());
1104 scr_clear (height != old_height); 1158 scr_clear ();
1105#ifdef XPM_BACKGROUND 1159#ifdef XPM_BACKGROUND
1106 resize_pixmap (); 1160 resize_pixmap ();
1107#endif 1161#endif
1108
1109 } 1162 }
1110 1163
1111 if (fix_screen || old_height == 0) 1164 if (fix_screen || old_height == 0)
1112 { 1165 {
1113 int curr_screen = -1; 1166 int curr_screen = -1;
1386 if (preedit_attr) XFree (preedit_attr); 1439 if (preedit_attr) XFree (preedit_attr);
1387 if (status_attr) XFree (status_attr); 1440 if (status_attr) XFree (status_attr);
1388 1441
1389 if (Input_Context == NULL) 1442 if (Input_Context == NULL)
1390 { 1443 {
1391 rxvt_print_error ("failed to create input context"); 1444 rxvt_warn ("failed to create input context, continuing without XIM.\n");
1392 display->put_xim (input_method); 1445 display->put_xim (input_method);
1393 return false; 1446 return false;
1394 } 1447 }
1395 1448
1396 if (input_style & XIMPreeditArea) 1449 if (input_style & XIMPreeditArea)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines