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.302 by root, Fri Jan 25 16:04:57 2008 UTC vs.
Revision 1.309 by root, Wed Feb 27 01:02:33 2008 UTC

172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this); 172 slip_wheel_ev.set <rxvt_term, &rxvt_term::slip_wheel_cb> (this);
173#endif 173#endif
174#if ENABLE_TRANSPARENCY || ENABLE_PERL 174#if ENABLE_TRANSPARENCY || ENABLE_PERL
175 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this), 175 rootwin_ev.set <rxvt_term, &rxvt_term::rootwin_cb> (this),
176#endif 176#endif
177#ifdef HAVE_SCROLLBARS
178 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this), 177 scrollbar_ev.set <rxvt_term, &rxvt_term::x_cb> (this),
179#endif
180#ifdef USE_XIM 178#ifdef USE_XIM
181 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this), 179 im_ev.set <rxvt_term, &rxvt_term::im_cb> (this),
182#endif 180#endif
183#ifdef POINTER_BLANK 181#ifdef POINTER_BLANK
184 pointer_ev.set <rxvt_term, &rxvt_term::pointer_cb> (this); 182 pointer_ev.set <rxvt_term, &rxvt_term::pointer_cb> (this);
237 selection_clear (); 235 selection_clear ();
238 236
239#ifdef USE_XIM 237#ifdef USE_XIM
240 im_destroy (); 238 im_destroy ();
241#endif 239#endif
242#ifdef XTERM_SCROLLBAR 240 scrollBar.destroy ();
243 if (xscrollbarGC) XFreeGC (dpy, xscrollbarGC);
244 if (ShadowGC) XFreeGC (dpy, ShadowGC);
245#endif
246#ifdef PLAIN_SCROLLBAR
247 if (pscrollbarGC) XFreeGC (dpy, pscrollbarGC);
248#endif
249#ifdef NEXT_SCROLLBAR
250 if (blackGC) XFreeGC (dpy, blackGC);
251 if (whiteGC) XFreeGC (dpy, whiteGC);
252 if (grayGC) XFreeGC (dpy, grayGC);
253 if (darkGC) XFreeGC (dpy, darkGC);
254 if (stippleGC) XFreeGC (dpy, stippleGC);
255 if (dimple) XFreePixmap (dpy, dimple);
256 if (upArrow) XFreePixmap (dpy, upArrow);
257 if (downArrow) XFreePixmap (dpy, downArrow);
258 if (upArrowHi) XFreePixmap (dpy, upArrowHi);
259 if (downArrowHi) XFreePixmap (dpy, downArrowHi);
260#endif
261#ifdef RXVT_SCROLLBAR
262 if (topShadowGC) XFreeGC (dpy, topShadowGC);
263 if (botShadowGC) XFreeGC (dpy, botShadowGC);
264 if (scrollbarGC) XFreeGC (dpy, scrollbarGC);
265#endif
266 if (gc) XFreeGC (dpy, gc); 241 if (gc) XFreeGC (dpy, gc);
267 242
268 delete drawable; 243 delete drawable;
269 // destroy all windows 244 // destroy all windows
270 if (parent[0]) 245 if (parent[0])
337 if (display) 312 if (display)
338 { 313 {
339#if USE_XIM 314#if USE_XIM
340 im_ev.stop (display); 315 im_ev.stop (display);
341#endif 316#endif
342#if HAVE_SCROLLBARS
343 scrollbar_ev.stop (display); 317 scrollbar_ev.stop (display);
344#endif
345#if ENABLE_TRANSPARENCY || ENABLE_PERL 318#if ENABLE_TRANSPARENCY || ENABLE_PERL
346 rootwin_ev.stop (display); 319 rootwin_ev.stop (display);
347#endif 320#endif
348 incr_ev.stop (); 321 incr_ev.stop ();
349 termwin_ev.stop (display); 322 termwin_ev.stop (display);
529 */ 502 */
530void 503void
531rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) 504rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
532{ 505{
533 short recalc_x, recalc_y; 506 short recalc_x, recalc_y;
534 int x, y, sb_w, flags; 507 int x, y, flags;
535 unsigned int w, h; 508 unsigned int w, h;
536 unsigned int max_width, max_height; 509 unsigned int max_width, max_height;
537 510
538 szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; 511 szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
539 szHint.win_gravity = NorthWestGravity; 512 szHint.win_gravity = NorthWestGravity;
586 szHint.win_gravity = SouthEastGravity; 559 szHint.win_gravity = SouthEastGravity;
587 else 560 else
588 szHint.win_gravity = SouthWestGravity; 561 szHint.win_gravity = SouthWestGravity;
589 } 562 }
590 } 563 }
564
565 if (!szHint.width || !szHint.height)
566 rxvt_fatal ("window width or height must not be zero, aborting.\n");
591 } 567 }
592 568
593 /* TODO: BOUNDS */ 569 /* TODO: BOUNDS */
594 width = ncol * fwidth; 570 width = ncol * fwidth;
595 height = nrow * fheight; 571 height = nrow * fheight;
596 max_width = MAX_COLS * fwidth; 572 max_width = MAX_COLS * fwidth;
597 max_height = MAX_ROWS * fheight; 573 max_height = MAX_ROWS * fheight;
598 574
599 szHint.base_width = szHint.base_height = 2 * int_bwidth; 575 szHint.base_width = szHint.base_height = 2 * int_bwidth;
600 576
601 sb_w = 0;
602 window_vt_x = window_vt_y = int_bwidth; 577 window_vt_x = window_vt_y = int_bwidth;
603 578
604 if (scrollBar.state) 579 if (scrollBar.state)
605 { 580 {
606 sb_w = scrollbar_TotalWidth (); 581 int sb_w = scrollBar.total_width ();
607 szHint.base_width += sb_w; 582 szHint.base_width += sb_w;
608 583
609 if (!option (Opt_scrollBar_right)) 584 if (!option (Opt_scrollBar_right))
610 window_vt_x += sb_w; 585 window_vt_x += sb_w;
611 } 586 }
634 else 609 else
635 { 610 {
636 min_it (height, max_height); 611 min_it (height, max_height);
637 szHint.height = szHint.base_height + height; 612 szHint.height = szHint.base_height + height;
638 } 613 }
639
640 if (scrollBar.state && option (Opt_scrollBar_right))
641 window_sb_x = szHint.width - sb_w;
642 614
643 if (recalc_x) 615 if (recalc_x)
644 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 616 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
645 617
646 if (recalc_y) 618 if (recalc_y)
805void 777void
806rxvt_term::set_window_color (int idx, const char *color) 778rxvt_term::set_window_color (int idx, const char *color)
807{ 779{
808#ifdef XTERM_COLOR_CHANGE 780#ifdef XTERM_COLOR_CHANGE
809 rxvt_color xcol; 781 rxvt_color xcol;
810 int i;
811 782
812 if (color == NULL || *color == '\0') 783 if (color == NULL || *color == '\0')
813 return; 784 return;
814 785
815 color = strdup (color); 786 color = strdup (color);
817 rs[Rs_color + idx] = color; 788 rs[Rs_color + idx] = color;
818 789
819 /* handle color aliases */ 790 /* handle color aliases */
820 if (isdigit (*color)) 791 if (isdigit (*color))
821 { 792 {
822 i = atoi (color); 793 int i = atoi (color);
823 794
824 if (i >= 8 && i <= 15) 795 if (i >= 8 && i <= 15)
825 { 796 {
826 /* bright colors */ 797 /* bright colors */
827 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; 798 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8];
987 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 958 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
988 959
989 if (fix_screen || newwidth != old_width || newheight != old_height) 960 if (fix_screen || newwidth != old_width || newheight != old_height)
990 { 961 {
991 if (scrollBar.state) 962 if (scrollBar.state)
992 { 963 scrollBar.resize ();
993 XMoveResizeWindow (dpy, scrollBar.win,
994 window_sb_x, 0,
995 scrollbar_TotalWidth (), szHint.height);
996 resize_scrollbar ();
997 }
998 964
999 XMoveResizeWindow (dpy, vt, 965 XMoveResizeWindow (dpy, vt,
1000 window_vt_x, window_vt_y, 966 window_vt_x, window_vt_y,
1001 width, height); 967 width, height);
1002 968

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines