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.65 by pcg, Fri Apr 2 15:15:26 2004 UTC vs.
Revision 1.73 by root, Fri Jul 30 14:59:12 2004 UTC

1/*--------------------------------*-C-*---------------------------------*; 1/*--------------------------------*-C-*---------------------------------*
2 * File: main.c 2 * File: main.C
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk> 6 * Copyright (c) 1992 John Bovey, University of Kent at Canterbury <jdb@ukc.ac.uk>
7 * - original version 7 * - original version
155 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb), 155 cursor_blink_ev (this, &rxvt_term::cursor_blink_cb),
156#endif 156#endif
157#ifdef TEXT_BLINK 157#ifdef TEXT_BLINK
158 text_blink_ev (this, &rxvt_term::text_blink_cb), 158 text_blink_ev (this, &rxvt_term::text_blink_cb),
159#endif 159#endif
160#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
161 cont_scroll_ev (this, &rxvt_term::cont_scroll_cb),
162#endif
163#ifdef SELECTION_SCROLLING
164 sel_scroll_ev (this, &rxvt_term::sel_scroll_cb),
165#endif
166#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
167 slip_wheel_ev (this, &rxvt_term::slip_wheel_cb),
168#endif
160#ifdef POINTER_BLANK 169#ifdef POINTER_BLANK
161 pointer_ev (this, &rxvt_term::pointer_cb), 170 pointer_ev (this, &rxvt_term::pointer_cb),
162#endif 171#endif
163#ifdef USE_XIM 172#ifdef USE_XIM
164 im_ev (this, &rxvt_term::im_cb), 173 im_ev (this, &rxvt_term::im_cb),
233 XDestroyWindow (display->display, TermWin.parent[0]); 242 XDestroyWindow (display->display, TermWin.parent[0]);
234 } 243 }
235 244
236 // TODO: free pixcolours, colours should become part of rxvt_display 245 // TODO: free pixcolours, colours should become part of rxvt_display
237 246
238 delete PixColors; 247 delete PixColorsFocused;
248#ifdef OFF_FOCUS_FADING
249 delete PixColorsUnFocused;
250#endif
239 251
240 displays.put (display); 252 displays.put (display);
241 253
242 scr_release (); 254 scr_release ();
243 255
285#ifdef CURSOR_BLINK 297#ifdef CURSOR_BLINK
286 cursor_blink_ev.stop (); 298 cursor_blink_ev.stop ();
287#endif 299#endif
288#ifdef TEXT_BLINK 300#ifdef TEXT_BLINK
289 text_blink_ev.stop (); 301 text_blink_ev.stop ();
302#endif
303#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
304 cont_scroll_ev.stop ();
305#endif
306#ifdef SELECTION_SCROLLING
307 sel_scroll_ev.stop ();
290#endif 308#endif
291#ifdef POINTER_BLANK 309#ifdef POINTER_BLANK
292 pointer_ev.stop (); 310 pointer_ev.stop ();
293#endif 311#endif
294 312
740 max_height = MAX_ROWS * TermWin.fheight; 758 max_height = MAX_ROWS * TermWin.fheight;
741 759
742 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth; 760 szHint.base_width = szHint.base_height = 2 * TermWin.int_bwidth;
743 761
744 sb_w = mb_h = 0; 762 sb_w = mb_h = 0;
745 window_vt_x = window_vt_y = 0; 763 window_vt_x = window_vt_y = TermWin.int_bwidth;
764
746 if (scrollbar_visible ()) 765 if (scrollbar_visible ())
747 { 766 {
748 sb_w = scrollbar_TotalWidth (); 767 sb_w = scrollbar_TotalWidth ();
749 szHint.base_width += sb_w; 768 szHint.base_width += sb_w;
750 if (! (Options & Opt_scrollBar_right)) 769 if (!(Options & Opt_scrollBar_right))
751 window_vt_x = sb_w; 770 window_vt_x += sb_w;
752 } 771 }
772
753 if (menubar_visible ()) 773 if (menubar_visible ())
754 { 774 {
755 mb_h = menuBar_TotalHeight (); 775 mb_h = menuBar_TotalHeight ();
756 szHint.base_height += mb_h; 776 szHint.base_height += mb_h;
757 window_vt_y = mb_h; 777 window_vt_y += mb_h;
758 } 778 }
779
759 szHint.width_inc = TermWin.fwidth; 780 szHint.width_inc = TermWin.fwidth;
760 szHint.height_inc = TermWin.fheight; 781 szHint.height_inc = TermWin.fheight;
761 szHint.min_width = szHint.base_width + szHint.width_inc; 782 szHint.min_width = szHint.base_width + szHint.width_inc;
762 szHint.min_height = szHint.base_height + szHint.height_inc; 783 szHint.min_height = szHint.base_height + szHint.height_inc;
763 784
769 else 790 else
770 { 791 {
771 MIN_IT (TermWin.width, max_width); 792 MIN_IT (TermWin.width, max_width);
772 szHint.width = szHint.base_width + TermWin.width; 793 szHint.width = szHint.base_width + TermWin.width;
773 } 794 }
795
774 if (height && height - szHint.base_height < max_height) 796 if (height && height - szHint.base_height < max_height)
775 { 797 {
776 szHint.height = height; 798 szHint.height = height;
777 TermWin.height = height - szHint.base_height; 799 TermWin.height = height - szHint.base_height;
778 } 800 }
779 else 801 else
780 { 802 {
781 MIN_IT (TermWin.height, max_height); 803 MIN_IT (TermWin.height, max_height);
782 szHint.height = szHint.base_height + TermWin.height; 804 szHint.height = szHint.base_height + TermWin.height;
783 } 805 }
806
784 if (scrollbar_visible () && (Options & Opt_scrollBar_right)) 807 if (scrollbar_visible () && (Options & Opt_scrollBar_right))
785 window_sb_x = szHint.width - sb_w; 808 window_sb_x = szHint.width - sb_w;
786 809
787 if (recalc_x) 810 if (recalc_x)
788 szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display)) 811 szHint.x += (DisplayWidth (display->display, DefaultScreen (display->display))
935 i = atoi (color); 958 i = atoi (color);
936 if (i >= 8 && i <= 15) 959 if (i >= 8 && i <= 15)
937 { /* bright colors */ 960 { /* bright colors */
938 i -= 8; 961 i -= 8;
939# ifndef NO_BRIGHTCOLOR 962# ifndef NO_BRIGHTCOLOR
940 PixColors[idx] = PixColors[minBrightCOLOR + i]; 963 PixColorsFocused[idx] = PixColorsFocused[minBrightCOLOR + i];
941 SET_PIXCOLOR (idx); 964 SET_PIXCOLOR (idx);
942 goto Done; 965 goto Done;
943# endif 966# endif
944 967
945 } 968 }
946 if (i >= 0 && i <= 7) 969 if (i >= 0 && i <= 7)
947 { /* normal colors */ 970 { /* normal colors */
948 PixColors[idx] = PixColors[minCOLOR + i]; 971 PixColorsFocused[idx] = PixColorsFocused[minCOLOR + i];
949 SET_PIXCOLOR (idx); 972 SET_PIXCOLOR (idx);
950 goto Done; 973 goto Done;
951 } 974 }
952 } 975 }
953 976
970 XFreeColors (display->display, XCMAP, (PixColors + idx), 1, 993 XFreeColors (display->display, XCMAP, (PixColors + idx), 1,
971 DisplayPlanes (display->display, display->screen)); 994 DisplayPlanes (display->display, display->screen));
972 } 995 }
973# endif 996# endif
974 997
975 PixColors[idx] = xcol; 998 PixColorsFocused[idx] = xcol;
976 SET_PIXCOLOR (idx); 999 SET_PIXCOLOR (idx);
977 1000
978 /* XSetWindowAttributes attr; */ 1001 /* XSetWindowAttributes attr; */
979 /* Cursor cursor; */ 1002 /* Cursor cursor; */
980Done: 1003Done:
1004#ifdef OFF_FOCUS_FADING
1005 PixColorsUnFocused[idx] = PixColorsFocused[idx].fade (display, atoi (rs[Rs_fade]));
1006#endif
981 if (idx == Color_bg && ! (Options & Opt_transparent)) 1007 if (idx == Color_bg && ! (Options & Opt_transparent))
982 XSetWindowBackground (display->display, TermWin.vt, 1008 XSetWindowBackground (display->display, TermWin.vt, PixColors[Color_bg]);
983 PixColors[Color_bg]);
984 1009
985 /* handle Color_BD, scrollbar background, etc. */ 1010 /* handle Color_BD, scrollbar background, etc. */
986 1011
987 set_colorfgbg (); 1012 set_colorfgbg ();
988 recolour_cursor (); 1013 recolour_cursor ();
996void 1021void
997rxvt_term::recolour_cursor () 1022rxvt_term::recolour_cursor ()
998{ 1023{
999 XColor xcol[2]; 1024 XColor xcol[2];
1000 1025
1001 xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColors[Color_pointer_fg] : PixColors[Color_fg]; 1026 xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg];
1002 xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColors[Color_pointer_bg] : PixColors[Color_bg]; 1027 xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg];
1003 XQueryColors (display->display, XCMAP, xcol, 2); 1028 XQueryColors (display->display, XCMAP, xcol, 2);
1004 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1); 1029 XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
1005} 1030}
1006 1031
1007/*----------------------------------------------------------------------*/ 1032/*----------------------------------------------------------------------*/
1079 int old_width = szHint.width, old_height = szHint.height; 1104 int old_width = szHint.width, old_height = szHint.height;
1080#endif 1105#endif
1081 1106
1082 window_calc (width, height); 1107 window_calc (width, height);
1083 XSetWMNormalHints (display->display, TermWin.parent[0], &szHint); 1108 XSetWMNormalHints (display->display, TermWin.parent[0], &szHint);
1109
1084 if (!ignoreparent) 1110 if (!ignoreparent)
1085 { 1111 {
1086#ifdef SMART_RESIZE 1112#ifdef SMART_RESIZE
1087 /* 1113 /*
1088 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt> 1114 * resize by Marius Gedminas <marius.gedminas@uosis.mif.vu.lt>
1123 dy /= 2; 1149 dy /= 2;
1124 1150
1125 XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy, 1151 XMoveResizeWindow (display->display, TermWin.parent[0], x + dx, y + dy,
1126 szHint.width, szHint.height); 1152 szHint.width, szHint.height);
1127#else 1153#else
1128 XResizeWindow (display->display, TermWin.parent[0], szHint.width, 1154 XResizeWindow (display->display, TermWin.parent[0], szHint.width, szHint.height);
1129 szHint.height);
1130#endif 1155#endif
1131
1132 } 1156 }
1133 1157
1134 fix_screen = (TermWin.ncol != prev_ncol 1158 fix_screen = TermWin.ncol != prev_ncol || TermWin.nrow != prev_nrow;
1135 || TermWin.nrow != prev_nrow);
1136 1159
1137 if (fix_screen || width != old_width || height != old_height) 1160 if (fix_screen || width != old_width || height != old_height)
1138 { 1161 {
1139 if (scrollbar_visible ()) 1162 if (scrollbar_visible ())
1140 { 1163 {
1141 XMoveResizeWindow (display->display, scrollBar.win, window_sb_x, 1164 XMoveResizeWindow (display->display, scrollBar.win,
1165 window_sb_x, 0,
1142 0, scrollbar_TotalWidth (), szHint.height); 1166 scrollbar_TotalWidth (), szHint.height);
1143 resize_scrollbar (); 1167 resize_scrollbar ();
1144 } 1168 }
1145 1169
1146 if (menubar_visible ()) 1170 if (menubar_visible ())
1147 XMoveResizeWindow (display->display, menuBar.win, window_vt_x, 1171 XMoveResizeWindow (display->display, menuBar.win,
1172 window_vt_x, 0,
1148 0, TermWin_TotalWidth (), menuBar_TotalHeight ()); 1173 TermWin_TotalWidth (), menuBar_TotalHeight ());
1149 1174
1150 XMoveResizeWindow (display->display, TermWin.vt, window_vt_x, 1175 XMoveResizeWindow (display->display, TermWin.vt,
1151 window_vt_y, TermWin_TotalWidth (), 1176 window_vt_x, window_vt_y,
1152 TermWin_TotalHeight ()); 1177 TermWin_TotalWidth (), TermWin_TotalHeight ());
1153 scr_clear (height != old_height); 1178 scr_clear ();
1154#ifdef XPM_BACKGROUND 1179#ifdef XPM_BACKGROUND
1155 resize_pixmap (); 1180 resize_pixmap ();
1156#endif 1181#endif
1157
1158 } 1182 }
1159 1183
1160 if (fix_screen || old_height == 0) 1184 if (fix_screen || old_height == 0)
1161 { 1185 {
1162 int curr_screen = -1; 1186 int curr_screen = -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines