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.308 by ayin, Tue Feb 19 13:01:32 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
522 if (rs[Rs_geometry]) 528 if (rs[Rs_geometry])
523 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); 529 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
524 530
525 if (flags & WidthValue) 531 if (flags & WidthValue)
526 { 532 {
533 if (!w)
534 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
535
527 ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); 536 ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ());
528 szHint.flags |= USSize; 537 szHint.flags |= USSize;
529 } 538 }
530 539
531 if (flags & HeightValue) 540 if (flags & HeightValue)
532 { 541 {
542 if (!h)
543 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
544
533 nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); 545 nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ());
534 szHint.flags |= USSize; 546 szHint.flags |= USSize;
535 } 547 }
536 548
537 if (flags & XValue) 549 if (flags & XValue)
538 { 550 {
613 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 625 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
614 626
615 if (recalc_y) 627 if (recalc_y)
616 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; 628 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth;
617 629
618 ncol = width / fwidth; 630 ncol = width / fwidth;
619 nrow = height / fheight; 631 nrow = height / fheight;
620} 632}
621 633
622/*----------------------------------------------------------------------*/ 634/*----------------------------------------------------------------------*/
623/* 635/*
634 646
635 ws.ws_col = ncol; 647 ws.ws_col = ncol;
636 ws.ws_row = nrow; 648 ws.ws_row = nrow;
637 ws.ws_xpixel = width; 649 ws.ws_xpixel = width;
638 ws.ws_ypixel = height; 650 ws.ws_ypixel = height;
639 (void)ioctl (pty->pty, TIOCSWINSZ, &ws); 651 ioctl (pty->pty, TIOCSWINSZ, &ws);
640 652
641#if 0 653#if 0
642 // TIOCSWINSZ is supposed to do this automatically and correctly 654 // TIOCSWINSZ is supposed to do this automatically and correctly
643 if (cmd_pid) /* force through to the command */ 655 if (cmd_pid) /* force through to the command */
644 kill (-cmd_pid, SIGWINCH); 656 kill (-cmd_pid, SIGWINCH);
676 delete fontset[0]; 688 delete fontset[0];
677 fontset[0] = fs; 689 fontset[0] = fs;
678 690
679 prop = (*fs)[1]->properties (); 691 prop = (*fs)[1]->properties ();
680 prop.height += lineSpace; 692 prop.height += lineSpace;
693 prop.width += letterSpace;
681 694
682 fs->set_prop (prop, false); 695 fs->set_prop (prop, false);
683 696
684 fwidth = prop.width; 697 fwidth = prop.width;
685 fheight = prop.height; 698 fheight = prop.height;
899 int old_width = szHint.width; 912 int old_width = szHint.width;
900 int old_height = szHint.height; 913 int old_height = szHint.height;
901 914
902 window_calc (newwidth, newheight); 915 window_calc (newwidth, newheight);
903 916
904 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);
905 XSetWMNormalHints (dpy, parent[0], &szHint); 923 XSetWMNormalHints (dpy, parent[0], &szHint);
924 szHint.flags |= PBaseSize | PResizeInc;
925 }
906 926
907 if (!ignoreparent) 927 if (!ignoreparent)
908 { 928 {
909#ifdef SMART_RESIZE 929#ifdef SMART_RESIZE
910 /* 930 /*
950#else 970#else
951 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 971 XResizeWindow (dpy, parent[0], szHint.width, szHint.height);
952#endif 972#endif
953 } 973 }
954 974
975 if (set_hint)
976 XSetWMNormalHints (dpy, parent[0], &szHint);
977
955 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 978 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
956 979
957 if (fix_screen || newwidth != old_width || newheight != old_height) 980 if (fix_screen || newwidth != old_width || newheight != old_height)
958 { 981 {
959 if (scrollBar.state) 982 if (scrollBar.state)
965 988
966#ifdef HAVE_BG_PIXMAP 989#ifdef HAVE_BG_PIXMAP
967 if (bgPixmap.window_size_sensitive ()) 990 if (bgPixmap.window_size_sensitive ())
968 update_background (); 991 update_background ();
969#endif 992#endif
970
971 scr_clear ();
972 } 993 }
973 994
974 if (fix_screen || old_height == 0) 995 if (fix_screen || old_height == 0)
975 scr_reset (); 996 scr_reset ();
976 997
1055 1076
1056/* Checking whether input method is running. */ 1077/* Checking whether input method is running. */
1057bool 1078bool
1058rxvt_term::IMisRunning () 1079rxvt_term::IMisRunning ()
1059{ 1080{
1060 char *p;
1061 Atom atom; 1081 Atom atom;
1062 Window win; 1082 Window win;
1063 char server[IMBUFSIZ]; 1083 char server[IMBUFSIZ];
1064 1084
1065 /* get current locale modifier */ 1085 /* get current locale modifier */
1066 if ((p = XSetLocaleModifiers (NULL)) != NULL) 1086 if (char *p = XSetLocaleModifiers (0))
1067 { 1087 {
1068 strcpy (server, "@server="); 1088 strcpy (server, "@server=");
1069 strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ 1089 strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */
1070 1090
1071 if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ 1091 if (p = strchr (server + 1, '@')) /* first one only */
1072 *p = '\0'; 1092 *p = '\0';
1073 1093
1074 atom = XInternAtom (dpy, server, False); 1094 atom = XInternAtom (dpy, server, False);
1075 win = XGetSelectionOwner (dpy, atom); 1095 win = XGetSelectionOwner (dpy, atom);
1076 1096

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines