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.313 by root, Tue Nov 4 16:43:50 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);
229 delete fontset[0]; 227 delete fontset[0];
230 228
231#ifdef HAVE_BG_PIXMAP 229#ifdef HAVE_BG_PIXMAP
232 bgPixmap.destroy (); 230 bgPixmap.destroy ();
233#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
234 238
235 if (display) 239 if (display)
236 { 240 {
237 selection_clear (); 241 selection_clear ();
238 242
239#ifdef USE_XIM 243#ifdef USE_XIM
240 im_destroy (); 244 im_destroy ();
241#endif 245#endif
242#ifdef XTERM_SCROLLBAR 246 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); 247 if (gc) XFreeGC (dpy, gc);
267 248
268 delete drawable; 249 delete drawable;
269 // destroy all windows 250 // destroy all windows
270 if (parent[0]) 251 if (parent[0])
337 if (display) 318 if (display)
338 { 319 {
339#if USE_XIM 320#if USE_XIM
340 im_ev.stop (display); 321 im_ev.stop (display);
341#endif 322#endif
342#if HAVE_SCROLLBARS
343 scrollbar_ev.stop (display); 323 scrollbar_ev.stop (display);
344#endif
345#if ENABLE_TRANSPARENCY || ENABLE_PERL 324#if ENABLE_TRANSPARENCY || ENABLE_PERL
346 rootwin_ev.stop (display); 325 rootwin_ev.stop (display);
347#endif 326#endif
348 incr_ev.stop (); 327 incr_ev.stop ();
349 termwin_ev.stop (display); 328 termwin_ev.stop (display);
529 */ 508 */
530void 509void
531rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight) 510rxvt_term::window_calc (unsigned int newwidth, unsigned int newheight)
532{ 511{
533 short recalc_x, recalc_y; 512 short recalc_x, recalc_y;
534 int x, y, sb_w, flags; 513 int x, y, flags;
535 unsigned int w, h; 514 unsigned int w, h;
536 unsigned int max_width, max_height; 515 unsigned int max_width, max_height;
537 516
538 szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity; 517 szHint.flags = PMinSize | PResizeInc | PBaseSize | PWinGravity;
539 szHint.win_gravity = NorthWestGravity; 518 szHint.win_gravity = NorthWestGravity;
549 if (rs[Rs_geometry]) 528 if (rs[Rs_geometry])
550 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h); 529 flags = XParseGeometry (rs[Rs_geometry], &x, &y, &w, &h);
551 530
552 if (flags & WidthValue) 531 if (flags & WidthValue)
553 { 532 {
533 if (!w)
534 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
535
554 ncol = clamp (w, 0, std::numeric_limits<int16_t>::max ()); 536 ncol = clamp (w, 1, std::numeric_limits<int16_t>::max ());
555 szHint.flags |= USSize; 537 szHint.flags |= USSize;
556 } 538 }
557 539
558 if (flags & HeightValue) 540 if (flags & HeightValue)
559 { 541 {
542 if (!h)
543 rxvt_fatal ("illegal window geometry (width and height must be non-zero), aborting.\n");
544
560 nrow = clamp (h, 0, std::numeric_limits<int16_t>::max ()); 545 nrow = clamp (h, 1, std::numeric_limits<int16_t>::max ());
561 szHint.flags |= USSize; 546 szHint.flags |= USSize;
562 } 547 }
563 548
564 if (flags & XValue) 549 if (flags & XValue)
565 { 550 {
596 max_width = MAX_COLS * fwidth; 581 max_width = MAX_COLS * fwidth;
597 max_height = MAX_ROWS * fheight; 582 max_height = MAX_ROWS * fheight;
598 583
599 szHint.base_width = szHint.base_height = 2 * int_bwidth; 584 szHint.base_width = szHint.base_height = 2 * int_bwidth;
600 585
601 sb_w = 0;
602 window_vt_x = window_vt_y = int_bwidth; 586 window_vt_x = window_vt_y = int_bwidth;
603 587
604 if (scrollBar.state) 588 if (scrollBar.state)
605 { 589 {
606 sb_w = scrollbar_TotalWidth (); 590 int sb_w = scrollBar.total_width ();
607 szHint.base_width += sb_w; 591 szHint.base_width += sb_w;
608 592
609 if (!option (Opt_scrollBar_right)) 593 if (!option (Opt_scrollBar_right))
610 window_vt_x += sb_w; 594 window_vt_x += sb_w;
611 } 595 }
635 { 619 {
636 min_it (height, max_height); 620 min_it (height, max_height);
637 szHint.height = szHint.base_height + height; 621 szHint.height = szHint.base_height + height;
638 } 622 }
639 623
640 if (scrollBar.state && option (Opt_scrollBar_right))
641 window_sb_x = szHint.width - sb_w;
642
643 if (recalc_x) 624 if (recalc_x)
644 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth; 625 szHint.x += DisplayWidth (dpy, display->screen) - szHint.width - 2 * ext_bwidth;
645 626
646 if (recalc_y) 627 if (recalc_y)
647 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth; 628 szHint.y += DisplayHeight (dpy, display->screen) - szHint.height - 2 * ext_bwidth;
648 629
649 ncol = width / fwidth; 630 ncol = width / fwidth;
650 nrow = height / fheight; 631 nrow = height / fheight;
651} 632}
652 633
653/*----------------------------------------------------------------------*/ 634/*----------------------------------------------------------------------*/
654/* 635/*
805void 786void
806rxvt_term::set_window_color (int idx, const char *color) 787rxvt_term::set_window_color (int idx, const char *color)
807{ 788{
808#ifdef XTERM_COLOR_CHANGE 789#ifdef XTERM_COLOR_CHANGE
809 rxvt_color xcol; 790 rxvt_color xcol;
810 int i;
811 791
812 if (color == NULL || *color == '\0') 792 if (color == NULL || *color == '\0')
813 return; 793 return;
814 794
815 color = strdup (color); 795 color = strdup (color);
817 rs[Rs_color + idx] = color; 797 rs[Rs_color + idx] = color;
818 798
819 /* handle color aliases */ 799 /* handle color aliases */
820 if (isdigit (*color)) 800 if (isdigit (*color))
821 { 801 {
822 i = atoi (color); 802 int i = atoi (color);
823 803
824 if (i >= 8 && i <= 15) 804 if (i >= 8 && i <= 15)
825 { 805 {
826 /* bright colors */ 806 /* bright colors */
827 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8]; 807 pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i - 8];
931 int old_width = szHint.width; 911 int old_width = szHint.width;
932 int old_height = szHint.height; 912 int old_height = szHint.height;
933 913
934 window_calc (newwidth, newheight); 914 window_calc (newwidth, newheight);
935 915
936 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);
937 XSetWMNormalHints (dpy, parent[0], &szHint); 922 XSetWMNormalHints (dpy, parent[0], &szHint);
923 szHint.flags |= PBaseSize | PResizeInc;
924 }
938 925
939 if (!ignoreparent) 926 if (!ignoreparent)
940 { 927 {
941#ifdef SMART_RESIZE 928#ifdef SMART_RESIZE
942 /* 929 /*
987 fix_screen = ncol != prev_ncol || nrow != prev_nrow; 974 fix_screen = ncol != prev_ncol || nrow != prev_nrow;
988 975
989 if (fix_screen || newwidth != old_width || newheight != old_height) 976 if (fix_screen || newwidth != old_width || newheight != old_height)
990 { 977 {
991 if (scrollBar.state) 978 if (scrollBar.state)
992 { 979 scrollBar.resize ();
993 XMoveResizeWindow (dpy, scrollBar.win,
994 window_sb_x, 0,
995 scrollbar_TotalWidth (), szHint.height);
996 resize_scrollbar ();
997 }
998 980
999 XMoveResizeWindow (dpy, vt, 981 XMoveResizeWindow (dpy, vt,
1000 window_vt_x, window_vt_y, 982 window_vt_x, window_vt_y,
1001 width, height); 983 width, height);
1002 984
1005 update_background (); 987 update_background ();
1006#endif 988#endif
1007 989
1008 scr_clear (); 990 scr_clear ();
1009 } 991 }
992
993 if (set_hint)
994 XSetWMNormalHints (dpy, parent[0], &szHint);
1010 995
1011 if (fix_screen || old_height == 0) 996 if (fix_screen || old_height == 0)
1012 scr_reset (); 997 scr_reset ();
1013 998
1014 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version 999 // TODO, with nvidia-8178, resizes kill the alpha channel, report if not fixed in newer version

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines