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.309 by root, Wed Feb 27 01:02:33 2008 UTC vs.
Revision 1.316 by root, Sun Apr 26 01:51:20 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 {
559 szHint.win_gravity = SouthEastGravity; 571 szHint.win_gravity = SouthEastGravity;
560 else 572 else
561 szHint.win_gravity = SouthWestGravity; 573 szHint.win_gravity = SouthWestGravity;
562 } 574 }
563 } 575 }
564
565 if (!szHint.width || !szHint.height)
566 rxvt_fatal ("window width or height must not be zero, aborting.\n");
567 } 576 }
568 577
569 /* TODO: BOUNDS */ 578 /* TODO: BOUNDS */
570 width = ncol * fwidth; 579 width = ncol * fwidth;
571 height = nrow * fheight; 580 height = nrow * fheight;
616 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 625 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
617 626
618 if (recalc_y) 627 if (recalc_y)
619 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; 628 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth;
620 629
621 ncol = width / fwidth; 630 ncol = width / fwidth;
622 nrow = height / fheight; 631 nrow = height / fheight;
623} 632}
624 633
625/*----------------------------------------------------------------------*/ 634/*----------------------------------------------------------------------*/
626/* 635/*
902 int old_width = szHint.width; 911 int old_width = szHint.width;
903 int old_height = szHint.height; 912 int old_height = szHint.height;
904 913
905 window_calc (newwidth, newheight); 914 window_calc (newwidth, newheight);
906 915
907 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);
908 XSetWMNormalHints (dpy, parent[0], &szHint); 922 XSetWMNormalHints (dpy, parent[0], &szHint);
923 szHint.flags |= PBaseSize | PResizeInc;
924 }
909 925
910 if (!ignoreparent) 926 if (!ignoreparent)
911 { 927 {
912#ifdef SMART_RESIZE 928#ifdef SMART_RESIZE
913 /* 929 /*
953#else 969#else
954 XResizeWindow (dpy, parent[0], szHint.width, szHint.height); 970 XResizeWindow (dpy, parent[0], szHint.width, szHint.height);
955#endif 971#endif
956 } 972 }
957 973
974 if (set_hint)
975 XSetWMNormalHints (dpy, parent[0], &szHint);
976
958 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 977 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
959 978
960 if (fix_screen || newwidth != old_width || newheight != old_height) 979 if (fix_screen || newwidth != old_width || newheight != old_height)
961 { 980 {
962 if (scrollBar.state) 981 if (scrollBar.state)
968 987
969#ifdef HAVE_BG_PIXMAP 988#ifdef HAVE_BG_PIXMAP
970 if (bgPixmap.window_size_sensitive ()) 989 if (bgPixmap.window_size_sensitive ())
971 update_background (); 990 update_background ();
972#endif 991#endif
973
974 scr_clear ();
975 } 992 }
976 993
977 if (fix_screen || old_height == 0) 994 if (fix_screen || old_height == 0)
978 scr_reset (); 995 scr_reset ();
979 996
1058 1075
1059/* Checking whether input method is running. */ 1076/* Checking whether input method is running. */
1060bool 1077bool
1061rxvt_term::IMisRunning () 1078rxvt_term::IMisRunning ()
1062{ 1079{
1063 char *p;
1064 Atom atom; 1080 Atom atom;
1065 Window win; 1081 Window win;
1066 char server[IMBUFSIZ]; 1082 char server[IMBUFSIZ];
1067 1083
1068 /* get current locale modifier */ 1084 /* get current locale modifier */
1069 if ((p = XSetLocaleModifiers (NULL)) != NULL) 1085 if (char *p = XSetLocaleModifiers (0))
1070 { 1086 {
1071 strcpy (server, "@server="); 1087 strcpy (server, "@server=");
1072 strncat (server, & (p[4]), IMBUFSIZ - 9); /* skip "@im=" */ 1088 strncat (server, p + 4, IMBUFSIZ - 9); /* skip "@im=" */
1073 1089
1074 if ((p = strchr (server + 1, '@')) != NULL) /* first one only */ 1090 if (p = strchr (server + 1, '@')) /* first one only */
1075 *p = '\0'; 1091 *p = '\0';
1076 1092
1077 atom = XInternAtom (dpy, server, False); 1093 atom = XInternAtom (dpy, server, False);
1078 win = XGetSelectionOwner (dpy, atom); 1094 win = XGetSelectionOwner (dpy, atom);
1079 1095

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines