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.310 by root, Wed Feb 27 01:05:55 2008 UTC vs.
Revision 1.320 by sf-exg, Sat Jan 30 20:43:56 2010 UTC

227 delete fontset[0]; 227 delete fontset[0];
228 228
229#ifdef HAVE_BG_PIXMAP 229#ifdef HAVE_BG_PIXMAP
230 bgPixmap.destroy (); 230 bgPixmap.destroy ();
231#endif 231#endif
232#ifdef HAVE_AFTERIMAGE
233 if (asv)
234 destroy_asvisual (asv, 0);
235 if (asimman)
236 destroy_image_manager (asimman, 0);
237#endif
232 238
233 if (display) 239 if (display)
234 { 240 {
235 selection_clear (); 241 selection_clear ();
242 selection_clear (true);
236 243
237#ifdef USE_XIM 244#ifdef USE_XIM
238 im_destroy (); 245 im_destroy ();
239#endif 246#endif
240 scrollBar.destroy (); 247 scrollBar.destroy ();
265 /* clear all resources */ 272 /* clear all resources */
266 for (int i = 0; i < allocated.size (); i++) 273 for (int i = 0; i < allocated.size (); i++)
267 free (allocated [i]); 274 free (allocated [i]);
268 275
269 free (selection.text); 276 free (selection.text);
277 free (selection.clip_text);
270 // TODO: manage env vars in child only(!) 278 // TODO: manage env vars in child only(!)
271 free (env_display); 279 free (env_display);
272 free (env_term); 280 free (env_term);
273 free (locale); 281 free (locale);
274 free (v_buffer); 282 free (v_buffer);
619 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 627 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
620 628
621 if (recalc_y) 629 if (recalc_y)
622 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; 630 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth;
623 631
624 ncol = width / fwidth; 632 ncol = width / fwidth;
625 nrow = height / fheight; 633 nrow = height / fheight;
626} 634}
627 635
628/*----------------------------------------------------------------------*/ 636/*----------------------------------------------------------------------*/
629/* 637/*
640 648
641 ws.ws_col = ncol; 649 ws.ws_col = ncol;
642 ws.ws_row = nrow; 650 ws.ws_row = nrow;
643 ws.ws_xpixel = width; 651 ws.ws_xpixel = width;
644 ws.ws_ypixel = height; 652 ws.ws_ypixel = height;
645 (void)ioctl (pty->pty, TIOCSWINSZ, &ws); 653 ioctl (pty->pty, TIOCSWINSZ, &ws);
646 654
647#if 0 655#if 0
648 // TIOCSWINSZ is supposed to do this automatically and correctly 656 // TIOCSWINSZ is supposed to do this automatically and correctly
649 if (cmd_pid) /* force through to the command */ 657 if (cmd_pid) /* force through to the command */
650 kill (-cmd_pid, SIGWINCH); 658 kill (-cmd_pid, SIGWINCH);
682 delete fontset[0]; 690 delete fontset[0];
683 fontset[0] = fs; 691 fontset[0] = fs;
684 692
685 prop = (*fs)[1]->properties (); 693 prop = (*fs)[1]->properties ();
686 prop.height += lineSpace; 694 prop.height += lineSpace;
695 prop.width += letterSpace;
687 696
688 fs->set_prop (prop, false); 697 fs->set_prop (prop, false);
689 698
690 fwidth = prop.width; 699 fwidth = prop.width;
691 fheight = prop.height; 700 fheight = prop.height;
905 int old_width = szHint.width; 914 int old_width = szHint.width;
906 int old_height = szHint.height; 915 int old_height = szHint.height;
907 916
908 window_calc (newwidth, newheight); 917 window_calc (newwidth, newheight);
909 918
910 if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) 919 bool set_hint = !HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END));
920
921 // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow
922 if (set_hint)
923 {
924 szHint.flags &= ~(PBaseSize | PResizeInc);
911 XSetWMNormalHints (dpy, parent[0], &szHint); 925 XSetWMNormalHints (dpy, parent[0], &szHint);
926 szHint.flags |= PBaseSize | PResizeInc;
927 }
912 928
913 if (!ignoreparent) 929 if (!ignoreparent)
914 { 930 {
915#ifdef SMART_RESIZE 931#ifdef SMART_RESIZE
916 /* 932 /*
956#else 972#else
957 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 973 XResizeWindow (dpy, parent[0], szHint.width, szHint.height);
958#endif 974#endif
959 } 975 }
960 976
977 if (set_hint)
978 XSetWMNormalHints (dpy, parent[0], &szHint);
979
961 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 980 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
962 981
963 if (fix_screen || newwidth != old_width || newheight != old_height) 982 if (fix_screen || newwidth != old_width || newheight != old_height)
964 { 983 {
965 if (scrollBar.state) 984 if (scrollBar.state)
971 990
972#ifdef HAVE_BG_PIXMAP 991#ifdef HAVE_BG_PIXMAP
973 if (bgPixmap.window_size_sensitive ()) 992 if (bgPixmap.window_size_sensitive ())
974 update_background (); 993 update_background ();
975#endif 994#endif
976
977 scr_clear ();
978 } 995 }
979 996
980 if (fix_screen || old_height == 0) 997 if (fix_screen || old_height == 0)
981 scr_reset (); 998 scr_reset ();
982 999
1061 1078
1062/* Checking whether input method is running. */ 1079/* Checking whether input method is running. */
1063bool 1080bool
1064rxvt_term::IMisRunning () 1081rxvt_term::IMisRunning ()
1065{ 1082{
1066 char *p;
1067 Atom atom; 1083 Atom atom;
1068 Window win; 1084 Window win;
1069 char server[IMBUFSIZ]; 1085 char server[IMBUFSIZ];
1070 1086
1071 /* get current locale modifier */ 1087 /* get current locale modifier */
1072 if ((p = XSetLocaleModifiers (NULL)) != NULL) 1088 if (char *p = XSetLocaleModifiers (0))
1073 { 1089 {
1074 strcpy (server, "@server="); 1090 strcpy (server, "@server=");
1075 strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ 1091 strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */
1076 1092
1077 if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ 1093 if (p = strchr (server + 1, '@')) /* first one only */
1078 *p = '\0'; 1094 *p = '\0';
1079 1095
1080 atom = XInternAtom (dpy, server, False); 1096 atom = XInternAtom (dpy, server, False);
1081 win = XGetSelectionOwner (dpy, atom); 1097 win = XGetSelectionOwner (dpy, atom);
1082 1098
1149 1165
1150 term->make_current (); 1166 term->make_current ();
1151 1167
1152 if (text) 1168 if (text)
1153 { 1169 {
1154 void *str; 1170 wchar_t *str;
1155 1171
1156 if (!text->encoding_is_wchar && text->string.multi_byte) 1172 if (!text->encoding_is_wchar && text->string.multi_byte)
1157 { 1173 {
1158 // of course, X makes it ugly again 1174 // of course, X makes it ugly again
1159 if (term->rs[Rs_imLocale]) 1175 if (term->rs[Rs_imLocale])
1160 SET_LOCALE (term->rs[Rs_imLocale]); 1176 SET_LOCALE (term->rs[Rs_imLocale]);
1161 1177
1162 str = rxvt_temp_buf ((text->length + 1) * sizeof (wchar_t)); 1178 str = rxvt_temp_buf<wchar_t> (text->length + 1);
1163 mbstowcs ((wchar_t *)str, text->string.multi_byte, text->length + 1); 1179 mbstowcs (str, text->string.multi_byte, text->length + 1);
1164 1180
1165 if (term->rs[Rs_imLocale]) 1181 if (term->rs[Rs_imLocale])
1166 SET_LOCALE (term->locale); 1182 SET_LOCALE (term->locale);
1167 } 1183 }
1168 else 1184 else
1169 str = (void *)text->string.wide_char; 1185 str = text->string.wide_char;
1170 1186
1171 HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW, 1187 HOOK_INVOKE ((term, HOOK_XIM_PREEDIT_DRAW,
1172 DT_INT, call_data->caret, 1188 DT_INT, call_data->caret,
1173 DT_INT, call_data->chg_first, 1189 DT_INT, call_data->chg_first,
1174 DT_INT, call_data->chg_length, 1190 DT_INT, call_data->chg_length,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines