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.306 by ayin, Mon Feb 18 09:58:04 2008 UTC vs.
Revision 1.318 by root, Sat May 30 08:51:23 2009 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 ();
236 242
237#ifdef USE_XIM 243#ifdef USE_XIM
238 im_destroy (); 244 im_destroy ();
239#endif 245#endif
240#ifdef XTERM_SCROLLBAR 246 scrollBar.destroy ();
241 if (xscrollbarGC) XFreeGC (dpy, xscrollbarGC);
242 if (ShadowGC) XFreeGC (dpy, ShadowGC);
243#endif
244#ifdef PLAIN_SCROLLBAR
245 if (pscrollbarGC) XFreeGC (dpy, pscrollbarGC);
246#endif
247#ifdef NEXT_SCROLLBAR
248 if (blackGC) XFreeGC (dpy, blackGC);
249 if (whiteGC) XFreeGC (dpy, whiteGC);
250 if (grayGC) XFreeGC (dpy, grayGC);
251 if (darkGC) XFreeGC (dpy, darkGC);
252 if (stippleGC) XFreeGC (dpy, stippleGC);
253 if (dimple) XFreePixmap (dpy, dimple);
254 if (upArrow) XFreePixmap (dpy, upArrow);
255 if (downArrow) XFreePixmap (dpy, downArrow);
256 if (upArrowHi) XFreePixmap (dpy, upArrowHi);
257 if (downArrowHi) XFreePixmap (dpy, downArrowHi);
258#endif
259#ifdef RXVT_SCROLLBAR
260 if (topShadowGC) XFreeGC (dpy, topShadowGC);
261 if (botShadowGC) XFreeGC (dpy, botShadowGC);
262 if (scrollbarGC) XFreeGC (dpy, scrollbarGC);
263#endif
264 if (gc) XFreeGC (dpy, gc); 247 if (gc) XFreeGC (dpy, gc);
265 248
266 delete drawable; 249 delete drawable;
267 // destroy all windows 250 // destroy all windows
268 if (parent[0]) 251 if (parent[0])
545 if (rs[Rs_geometry]) 528 if (rs[Rs_geometry])
546 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); 529 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
547 530
548 if (flags & WidthValue) 531 if (flags & WidthValue)
549 { 532 {
533 if (!w)
534 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
535
550 ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); 536 ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ());
551 szHint.flags |= USSize; 537 szHint.flags |= USSize;
552 } 538 }
553 539
554 if (flags & HeightValue) 540 if (flags & HeightValue)
555 { 541 {
542 if (!h)
543 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
544
556 nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); 545 nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ());
557 szHint.flags |= USSize; 546 szHint.flags |= USSize;
558 } 547 }
559 548
560 if (flags & XValue) 549 if (flags & XValue)
561 { 550 {
636 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 625 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
637 626
638 if (recalc_y) 627 if (recalc_y)
639 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; 628 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth;
640 629
641 ncol = width / fwidth; 630 ncol = width / fwidth;
642 nrow = height / fheight; 631 nrow = height / fheight;
643} 632}
644 633
645/*----------------------------------------------------------------------*/ 634/*----------------------------------------------------------------------*/
646/* 635/*
657 646
658 ws.ws_col = ncol; 647 ws.ws_col = ncol;
659 ws.ws_row = nrow; 648 ws.ws_row = nrow;
660 ws.ws_xpixel = width; 649 ws.ws_xpixel = width;
661 ws.ws_ypixel = height; 650 ws.ws_ypixel = height;
662 (void)ioctl (pty->pty, TIOCSWINSZ, &ws); 651 ioctl (pty->pty, TIOCSWINSZ, &ws);
663 652
664#if 0 653#if 0
665 // TIOCSWINSZ is supposed to do this automatically and correctly 654 // TIOCSWINSZ is supposed to do this automatically and correctly
666 if (cmd_pid) /* force through to the command */ 655 if (cmd_pid) /* force through to the command */
667 kill (-cmd_pid, SIGWINCH); 656 kill (-cmd_pid, SIGWINCH);
699 delete fontset[0]; 688 delete fontset[0];
700 fontset[0] = fs; 689 fontset[0] = fs;
701 690
702 prop = (*fs)[1]->properties (); 691 prop = (*fs)[1]->properties ();
703 prop.height += lineSpace; 692 prop.height += lineSpace;
693 prop.width += letterSpace;
704 694
705 fs->set_prop (prop, false); 695 fs->set_prop (prop, false);
706 696
707 fwidth = prop.width; 697 fwidth = prop.width;
708 fheight = prop.height; 698 fheight = prop.height;
922 int old_width = szHint.width; 912 int old_width = szHint.width;
923 int old_height = szHint.height; 913 int old_height = szHint.height;
924 914
925 window_calc (newwidth, newheight); 915 window_calc (newwidth, newheight);
926 916
927 if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) 917 bool set_hint = !HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END));
918
919 // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow
920 if (set_hint)
921 {
922 szHint.flags &= ~(PBaseSize | PResizeInc);
928 XSetWMNormalHints (dpy, parent[0], &szHint); 923 XSetWMNormalHints (dpy, parent[0], &szHint);
924 szHint.flags |= PBaseSize | PResizeInc;
925 }
929 926
930 if (!ignoreparent) 927 if (!ignoreparent)
931 { 928 {
932#ifdef SMART_RESIZE 929#ifdef SMART_RESIZE
933 /* 930 /*
973#else 970#else
974 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 971 XResizeWindow (dpy, parent[0], szHint.width, szHint.height);
975#endif 972#endif
976 } 973 }
977 974
975 if (set_hint)
976 XSetWMNormalHints (dpy, parent[0], &szHint);
977
978 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 978 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
979 979
980 if (fix_screen || newwidth != old_width || newheight != old_height) 980 if (fix_screen || newwidth != old_width || newheight != old_height)
981 { 981 {
982 if (scrollBar.state) 982 if (scrollBar.state)
983 resize_scrollbar (); 983 scrollBar.resize ();
984 984
985 XMoveResizeWindow (dpy, vt, 985 XMoveResizeWindow (dpy, vt,
986 window_vt_x, window_vt_y, 986 window_vt_x, window_vt_y,
987 width, height); 987 width, height);
988 988
989#ifdef HAVE_BG_PIXMAP 989#ifdef HAVE_BG_PIXMAP
990 if (bgPixmap.window_size_sensitive ()) 990 if (bgPixmap.window_size_sensitive ())
991 update_background (); 991 update_background ();
992#endif 992#endif
993
994 scr_clear ();
995 } 993 }
996 994
997 if (fix_screen || old_height == 0) 995 if (fix_screen || old_height == 0)
998 scr_reset (); 996 scr_reset ();
999 997
1078 1076
1079/* Checking whether input method is running. */ 1077/* Checking whether input method is running. */
1080bool 1078bool
1081rxvt_term::IMisRunning () 1079rxvt_term::IMisRunning ()
1082{ 1080{
1083 char *p;
1084 Atom atom; 1081 Atom atom;
1085 Window win; 1082 Window win;
1086 char server[IMBUFSIZ]; 1083 char server[IMBUFSIZ];
1087 1084
1088 /* get current locale modifier */ 1085 /* get current locale modifier */
1089 if ((p = XSetLocaleModifiers (NULL)) != NULL) 1086 if (char *p = XSetLocaleModifiers (0))
1090 { 1087 {
1091 strcpy (server, "@server="); 1088 strcpy (server, "@server=");
1092 strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ 1089 strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */
1093 1090
1094 if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ 1091 if (p = strchr (server + 1, '@')) /* first one only */
1095 *p = '\0'; 1092 *p = '\0';
1096 1093
1097 atom = XInternAtom (dpy, server, False); 1094 atom = XInternAtom (dpy, server, False);
1098 win = XGetSelectionOwner (dpy, atom); 1095 win = XGetSelectionOwner (dpy, atom);
1099 1096

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines