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.317 by root, Tue May 12 08:21:56 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);
922 int old_width = szHint.width; 911 int old_width = szHint.width;
923 int old_height = szHint.height; 912 int old_height = szHint.height;
924 913
925 window_calc (newwidth, newheight); 914 window_calc (newwidth, newheight);
926 915
927 if (!HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END))) 916 bool set_hint = !HOOK_INVOKE ((this, HOOK_RESIZE_ALL_WINDOWS, DT_INT, newwidth, DT_INT, newheight, DT_END));
917
918 // to avoid races between us and the wm, we clear the incremental size hints around the xresizewindow
919 if (set_hint)
920 {
921 szHint.flags &= ~(PBaseSize | PResizeInc);
928 XSetWMNormalHints (dpy, parent[0], &szHint); 922 XSetWMNormalHints (dpy, parent[0], &szHint);
923 szHint.flags |= PBaseSize | PResizeInc;
924 }
929 925
930 if (!ignoreparent) 926 if (!ignoreparent)
931 { 927 {
932#ifdef SMART_RESIZE 928#ifdef SMART_RESIZE
933 /* 929 /*
973#else 969#else
974 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 970 XResizeWindow (dpy, parent[0], szHint.width, szHint.height);
975#endif 971#endif
976 } 972 }
977 973
974 if (set_hint)
975 XSetWMNormalHints (dpy, parent[0], &szHint);
976
978 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 977 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
979 978
980 if (fix_screen || newwidth != old_width || newheight != old_height) 979 if (fix_screen || newwidth != old_width || newheight != old_height)
981 { 980 {
982 if (scrollBar.state) 981 if (scrollBar.state)
983 resize_scrollbar (); 982 scrollBar.resize ();
984 983
985 XMoveResizeWindow (dpy, vt, 984 XMoveResizeWindow (dpy, vt,
986 window_vt_x, window_vt_y, 985 window_vt_x, window_vt_y,
987 width, height); 986 width, height);
988 987
989#ifdef HAVE_BG_PIXMAP 988#ifdef HAVE_BG_PIXMAP
990 if (bgPixmap.window_size_sensitive ()) 989 if (bgPixmap.window_size_sensitive ())
991 update_background (); 990 update_background ();
992#endif 991#endif
993
994 scr_clear ();
995 } 992 }
996 993
997 if (fix_screen || old_height == 0) 994 if (fix_screen || old_height == 0)
998 scr_reset (); 995 scr_reset ();
999 996
1078 1075
1079/* Checking whether input method is running. */ 1076/* Checking whether input method is running. */
1080bool 1077bool
1081rxvt_term::IMisRunning () 1078rxvt_term::IMisRunning ()
1082{ 1079{
1083 char *p;
1084 Atom atom; 1080 Atom atom;
1085 Window win; 1081 Window win;
1086 char server[IMBUFSIZ]; 1082 char server[IMBUFSIZ];
1087 1083
1088 /* get current locale modifier */ 1084 /* get current locale modifier */
1089 if ((p = XSetLocaleModifiers (NULL)) != NULL) 1085 if (char *p = XSetLocaleModifiers (0))
1090 { 1086 {
1091 strcpy (server, "@server="); 1087 strcpy (server, "@server=");
1092 strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ 1088 strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */
1093 1089
1094 if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ 1090 if (p = strchr (server + 1, '@')) /* first one only */
1095 *p = '\0'; 1091 *p = '\0';
1096 1092
1097 atom = XInternAtom (dpy, server, False); 1093 atom = XInternAtom (dpy, server, False);
1098 win = XGetSelectionOwner (dpy, atom); 1094 win = XGetSelectionOwner (dpy, atom);
1099 1095

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines