ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.215 by root, Fri Dec 23 14:46:34 2005 UTC vs.
Revision 1.221 by root, Sat Dec 31 18:27:57 2005 UTC

147 147
148 text_t t = l.t[x]; 148 text_t t = l.t[x];
149 149
150 if (t != NOCHAR || !x) 150 if (t != NOCHAR || !x)
151 { 151 {
152 iso14755_51 (l.t[x], l.r[x]); 152 iso14755_51 (l.t[x], l.r[x], x, y);
153 iso14755buf = ISO_14755_54; 153 iso14755buf = ISO_14755_54;
154 break; 154 break;
155 } 155 }
156 156
157 x--; 157 x--;
158 } 158 }
159} 159}
160#endif
161 160
162#if ENABLE_OVERLAY
163void 161void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 162rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
165{ 163{
166 rxvt_fontset *fs = FONTSET (r); 164 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 165 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2, *fname; 166 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 167 int len;
170 168
171 fname = rxvt_utf8towcs (f->name); 169 fname = rxvt_utf8towcs (f->name);
172 170
173#if ENABLE_COMBINING 171# if ENABLE_COMBINING
174 if (IS_COMPOSE (ch)) 172 if (IS_COMPOSE (ch))
175 { 173 {
176 len = rxvt_composite.expand (ch, 0); 174 len = rxvt_composite.expand (ch, 0);
177 alloc = chr = new wchar_t[len]; 175 alloc = chr = new wchar_t[len];
178 rxvt_composite.expand (ch, chr); 176 rxvt_composite.expand (ch, chr);
179 } 177 }
180 else 178 else
181#endif 179# endif
182 { 180 {
183 ch2 = ch; 181 ch2 = ch;
184 182
185 alloc = 0; 183 alloc = 0;
186 chr = &ch2; 184 chr = &ch2;
187 len = 1; 185 len = 1;
188 } 186 }
189 187
188 char attr[80]; // plenty
189
190 sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s",
191 (int)r,
192 fgcolor_of (r), bgcolor_of (r),
193 r & RS_Bold ? " bold" : "",
194 r & RS_Italic ? " italic" : "",
195 r & RS_Blink ? " blink" : "",
196 r & RS_RVid ? " rvid" : "",
197 r & RS_Uline ? " uline" : "",
198 r & RS_Careful ? " careful" : "");
199
190 int width = wcswidth (fname, wcslen (fname)); 200 int width = wcswidth (fname, wcslen (fname));
191 201
192 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 202 max_it (width, 8+5); // for char + hey
203 max_it (width, strlen (attr));
204
205 if (y >= 0)
206 {
207 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
208 x = 0;
209 }
210
211 scr_overlay_new (x, y, width, len + 2);
193 212
194 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 213 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
195 214
196 for (int y = 0; y < len; y++) 215 for (int y = 0; y < len; y++)
197 { 216 {
200 ch = *chr++; 219 ch = *chr++;
201 220
202 sprintf (buf, "%8x", ch); 221 sprintf (buf, "%8x", ch);
203 scr_overlay_set (0, y, buf); 222 scr_overlay_set (0, y, buf);
204 scr_overlay_set (9, y, '='); 223 scr_overlay_set (9, y, '=');
205#if !UNICODE3 224# if !UNICODE3
206 if (ch >= 0x10000) 225 if (ch >= 0x10000)
207 ch = 0xfffd; 226 ch = 0xfffd;
208#endif 227# endif
209 scr_overlay_set (11, y, ch, r); 228 scr_overlay_set (11, y, ch, r);
210 scr_overlay_set (12, y, NOCHAR, r); 229 scr_overlay_set (12, y, NOCHAR, r);
211 } 230 }
212 231
232 scr_overlay_set (0, len , attr);
213 scr_overlay_set (0, len, fname); 233 scr_overlay_set (0, len + 1, fname);
214 234
215 free (fname); 235 free (fname);
216 236
217#if ENABLE_COMBINING 237# if ENABLE_COMBINING
218 if (alloc) 238 if (alloc)
219 delete [] alloc; 239 delete [] alloc;
220#endif 240# endif
221} 241}
222#endif 242#endif
223 243
224void 244void
225rxvt_term::commit_iso14755 () 245rxvt_term::commit_iso14755 ()
844 } 864 }
845 865
846 if (len <= 0) 866 if (len <= 0)
847 return; /* not mapped */ 867 return; /* not mapped */
848 868
849 if (options & Opt_scrollTtyKeypress) 869 if (OPTION (Opt_scrollTtyKeypress))
850 if (view_start) 870 if (view_start)
851 { 871 {
852 view_start = 0; 872 view_start = 0;
853 want_refresh = 1; 873 want_refresh = 1;
854 } 874 }
1071 } 1091 }
1072 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) 1092 else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0)
1073 { 1093 {
1074 pty_ev.stop (); 1094 pty_ev.stop ();
1075 1095
1076 if (!(options & Opt_hold)) 1096 if (!OPTION (Opt_hold))
1077 destroy (); 1097 destroy ();
1078 } 1098 }
1079 1099
1080 return false; 1100 return false;
1081} 1101}
1103 recolour_cursor (); 1123 recolour_cursor ();
1104 1124
1105#ifdef POINTER_BLANK 1125#ifdef POINTER_BLANK
1106 hidden_pointer = 0; 1126 hidden_pointer = 0;
1107 1127
1108 if (options & Opt_pointerBlank) 1128 if (OPTION (Opt_pointerBlank))
1109 pointer_ev.start (NOW + pointerBlankDelay); 1129 pointer_ev.start (NOW + pointerBlankDelay);
1110#endif 1130#endif
1111} 1131}
1112 1132
1113#ifdef POINTER_BLANK 1133#ifdef POINTER_BLANK
1114void 1134void
1115rxvt_term::pointer_blank () 1135rxvt_term::pointer_blank ()
1116{ 1136{
1117 if (! (options & Opt_pointerBlank)) 1137 if (! OPTION (Opt_pointerBlank))
1118 return; 1138 return;
1119 1139
1120 XDefineCursor (display->display, vt, display->blank_cursor); 1140 XDefineCursor (display->display, vt, display->blank_cursor);
1121 XFlush (display->display); 1141 XFlush (display->display);
1122 1142
1220 1240
1221 SET_R (this); 1241 SET_R (this);
1222 SET_LOCALE (locale); 1242 SET_LOCALE (locale);
1223 1243
1224#if defined(CURSOR_BLINK) 1244#if defined(CURSOR_BLINK)
1225 if ((options & Opt_cursorBlink) && ev.type == KeyPress) 1245 if (OPTION (Opt_cursorBlink) && ev.type == KeyPress)
1226 { 1246 {
1227 if (hidden_cursor) 1247 if (hidden_cursor)
1228 { 1248 {
1229 hidden_cursor = 0; 1249 hidden_cursor = 0;
1230 want_refresh = 1; 1250 want_refresh = 1;
1233 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1253 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1234 } 1254 }
1235#endif 1255#endif
1236 1256
1237#if defined(POINTER_BLANK) 1257#if defined(POINTER_BLANK)
1238 if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) 1258 if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0)
1239 { 1259 {
1240 if (ev.type == MotionNotify 1260 if (ev.type == MotionNotify
1241 || ev.type == ButtonPress 1261 || ev.type == ButtonPress
1242 || ev.type == ButtonRelease) 1262 || ev.type == ButtonRelease)
1243 if (hidden_pointer) 1263 if (hidden_pointer)
1439 seen_resize = 1; 1459 seen_resize = 1;
1440 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); 1460 resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1);
1441 } 1461 }
1442 1462
1443#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ 1463#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
1444 if (options & Opt_transparent) 1464 if (OPTION (Opt_transparent))
1445 check_our_parents (); 1465 check_our_parents ();
1446#endif 1466#endif
1447 } 1467 }
1448 break; 1468 break;
1449 1469
1658 IMSetStatusPosition (); 1678 IMSetStatusPosition ();
1659 XSetICFocus (Input_Context); 1679 XSetICFocus (Input_Context);
1660 } 1680 }
1661#endif 1681#endif
1662#if CURSOR_BLINK 1682#if CURSOR_BLINK
1663 if (options & Opt_cursorBlink) 1683 if (OPTION (Opt_cursorBlink))
1664 cursor_blink_ev.start (NOW + BLINK_INTERVAL); 1684 cursor_blink_ev.start (NOW + BLINK_INTERVAL);
1665#endif 1685#endif
1666#if OFF_FOCUS_FADING 1686#if OFF_FOCUS_FADING
1667 if (rs[Rs_fade]) 1687 if (rs[Rs_fade])
1668 { 1688 {
1690#if USE_XIM 1710#if USE_XIM
1691 if (Input_Context != NULL) 1711 if (Input_Context != NULL)
1692 XUnsetICFocus (Input_Context); 1712 XUnsetICFocus (Input_Context);
1693#endif 1713#endif
1694#if CURSOR_BLINK 1714#if CURSOR_BLINK
1695 if (options & Opt_cursorBlink) 1715 if (OPTION (Opt_cursorBlink))
1696 cursor_blink_ev.stop (); 1716 cursor_blink_ev.stop ();
1697 hidden_cursor = 0; 1717 hidden_cursor = 0;
1698#endif 1718#endif
1699#if OFF_FOCUS_FADING 1719#if OFF_FOCUS_FADING
1700 if (rs[Rs_fade]) 1720 if (rs[Rs_fade])
1724 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) 1744 && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID])
1725 return; 1745 return;
1726 1746
1727 /* FALLTHROUGH */ 1747 /* FALLTHROUGH */
1728 case ReparentNotify: 1748 case ReparentNotify:
1729 if ((options & Opt_transparent) && check_our_parents () && am_transparent) 1749 if (OPTION (Opt_transparent) && check_our_parents () && am_transparent)
1730 want_refresh = want_full_refresh = 1; 1750 want_refresh = want_full_refresh = 1;
1731 break; 1751 break;
1732 } 1752 }
1733} 1753}
1734#endif 1754#endif
2076 2096
2077 v = ev.button == Button4 ? UP : DN; 2097 v = ev.button == Button4 ? UP : DN;
2078 2098
2079 if (ev.state & ShiftMask) 2099 if (ev.state & ShiftMask)
2080 i = 1; 2100 i = 1;
2081 else if (options & Opt_mouseWheelScrollPage) 2101 else if (OPTION (Opt_mouseWheelScrollPage))
2082 i = nrow - 1; 2102 i = nrow - 1;
2083 else 2103 else
2084 i = 5; 2104 i = 5;
2085 2105
2086# ifdef MOUSE_SLIP_WHEELING 2106# ifdef MOUSE_SLIP_WHEELING
2372 XWindowAttributes wattr, wrootattr; 2392 XWindowAttributes wattr, wrootattr;
2373 dDisp; 2393 dDisp;
2374 2394
2375 pchanged = 0; 2395 pchanged = 0;
2376 2396
2377 if (!(options & Opt_transparent)) 2397 if (!OPTION (Opt_transparent))
2378 return pchanged; /* Don't try any more */ 2398 return pchanged; /* Don't try any more */
2379 2399
2380 XGetWindowAttributes (disp, display->root, &wrootattr); 2400 XGetWindowAttributes (disp, display->root, &wrootattr);
2381 rootdepth = wrootattr.depth; 2401 rootdepth = wrootattr.depth;
2382 2402
2660 if (ch == C0_LF) 2680 if (ch == C0_LF)
2661 nlines++; 2681 nlines++;
2662 2682
2663 refresh_count++; 2683 refresh_count++;
2664 2684
2665 if (!(options & Opt_jumpScroll) 2685 if (!OPTION (Opt_jumpScroll)
2666 || (refresh_count >= refresh_limit * (nrow - 1))) 2686 || (refresh_count >= refresh_limit * (nrow - 1)))
2667 { 2687 {
2668 refreshnow = true; 2688 refreshnow = true;
2669 ch = NOCHAR; 2689 ch = NOCHAR;
2670 break; 2690 break;
2704 * the number of pages between refreshes is refresh_limit, which 2724 * the number of pages between refreshes is refresh_limit, which
2705 * is incremented here because we must be doing flat-out scrolling. 2725 * is incremented here because we must be doing flat-out scrolling.
2706 */ 2726 */
2707 if (refreshnow) 2727 if (refreshnow)
2708 { 2728 {
2709 if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) 2729 if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
2710 refresh_limit++; 2730 refresh_limit++;
2711 else 2731 else
2712 { 2732 {
2713 flag = true; 2733 flag = true;
2714 scr_refresh (refresh_type); 2734 scr_refresh (refresh_type);
3378 break; 3398 break;
3379 case 6: /* CPR requested */ 3399 case 6: /* CPR requested */
3380 scr_report_position (); 3400 scr_report_position ();
3381 break; 3401 break;
3382 case 7: /* unofficial extension */ 3402 case 7: /* unofficial extension */
3383 if (options & Opt_insecure) 3403 if (OPTION (Opt_insecure))
3384 tt_printf ("%-.250s\012", rs[Rs_display_name]); 3404 tt_printf ("%-.250s\012", rs[Rs_display_name]);
3385 break; 3405 break;
3386 case 8: /* unofficial extension */ 3406 case 8: /* unofficial extension */
3387 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST); 3407 process_xterm_seq (XTerm_title, RESNAME "-" VERSION, CHAR_ST);
3388 break; 3408 break;
3552 break; 3572 break;
3553 case 20: /* report icon label */ 3573 case 20: /* report icon label */
3554 { 3574 {
3555 char *s; 3575 char *s;
3556 XGetIconName (disp, parent[0], &s); 3576 XGetIconName (disp, parent[0], &s);
3557 tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3577 tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3558 XFree (s); 3578 XFree (s);
3559 } 3579 }
3560 break; 3580 break;
3561 case 21: /* report window title */ 3581 case 21: /* report window title */
3562 { 3582 {
3563 char *s; 3583 char *s;
3564 XFetchName (disp, parent[0], &s); 3584 XFetchName (disp, parent[0], &s);
3565 tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ 3585 tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */
3566 XFree (s); 3586 XFree (s);
3567 } 3587 }
3568 break; 3588 break;
3569 } 3589 }
3570} 3590}
3846 // TODO, when secure mode? 3866 // TODO, when secure mode?
3847 break; 3867 break;
3848 3868
3849#ifdef MENUBAR 3869#ifdef MENUBAR
3850 case URxvt_Menu: 3870 case URxvt_Menu:
3851 if (options & Opt_insecure) 3871 if (OPTION (Opt_insecure))
3852 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3872 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3853 break; 3873 break;
3854#endif 3874#endif
3855#if 0 3875#if 0
3856 case XTerm_dumpscreen: /* no error notices */ 3876 case XTerm_dumpscreen: /* no error notices */
3872 case URxvt_italicFont: 3892 case URxvt_italicFont:
3873 case URxvt_boldItalicFont: 3893 case URxvt_boldItalicFont:
3874#endif 3894#endif
3875 if (query) 3895 if (query)
3876 tt_printf ("\33]%d;%-.250s%c", saveop, 3896 tt_printf ("\33]%d;%-.250s%c", saveop,
3877 (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc 3897 OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc
3878 ? fontset[op - URxvt_font]->fontdesc : "", 3898 ? fontset[op - URxvt_font]->fontdesc : "",
3879 resp); 3899 resp);
3880 else 3900 else
3881 { 3901 {
3882 const char *&res = rs[Rs_font + (op - URxvt_font)]; 3902 const char *&res = rs[Rs_font + (op - URxvt_font)];
3888 break; 3908 break;
3889 3909
3890#if ENABLE_FRILLS 3910#if ENABLE_FRILLS
3891 case URxvt_locale: 3911 case URxvt_locale:
3892 if (query) 3912 if (query)
3893 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); 3913 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp);
3894 else 3914 else
3895 { 3915 {
3896 set_locale (str); 3916 set_locale (str);
3897 pty.set_utf8_mode (enc_utf8); 3917 pty.set_utf8_mode (enc_utf8);
3898 init_xlocale (); 3918 init_xlocale ();
4026 } 4046 }
4027 4047
4028 /* extra handling for values with state unkept */ 4048 /* extra handling for values with state unkept */
4029 switch (arg[i]) 4049 switch (arg[i])
4030 { 4050 {
4051#if ENABLE_STYLES
4052 case 1021:
4053 if (mode)
4054 SET_OPTION (Opt_intensityStyles);
4055 else
4056 CLR_OPTION (Opt_intensityStyles);
4057#endif
4031 case 1048: /* alternative cursor save */ 4058 case 1048: /* alternative cursor save */
4032 case 1049: 4059 case 1049:
4033 if (options & Opt_secondaryScreen) 4060 if (OPTION (Opt_secondaryScreen))
4034 if (mode == 0) 4061 if (mode == 0)
4035 scr_cursor (RESTORE); 4062 scr_cursor (RESTORE);
4036 else if (mode == 1) 4063 else if (mode == 1)
4037 scr_cursor (SAVE); 4064 scr_cursor (SAVE);
4038 break; 4065 break;
4053 case 3: /* 80/132 */ 4080 case 3: /* 80/132 */
4054 if (priv_modes & PrivMode_132OK) 4081 if (priv_modes & PrivMode_132OK)
4055 set_widthheight (((state ? 132 : 80) * fwidth), height); 4082 set_widthheight (((state ? 132 : 80) * fwidth), height);
4056 break; 4083 break;
4057 case 4: /* smooth scrolling */ 4084 case 4: /* smooth scrolling */
4058 if (state) 4085 if (!state)
4059 options &= ~Opt_jumpScroll; 4086 SET_OPTION (Opt_jumpScroll);
4060 else 4087 else
4061 options |= Opt_jumpScroll; 4088 CLR_OPTION (Opt_jumpScroll);
4062 break; 4089 break;
4063 case 5: /* reverse video */ 4090 case 5: /* reverse video */
4064 scr_rvideo_mode (state); 4091 scr_rvideo_mode (state);
4065 break; 4092 break;
4066 case 6: /* relative/absolute origins */ 4093 case 6: /* relative/absolute origins */
4107#if 0 4134#if 0
4108 case 1001: 4135 case 1001:
4109 break; /* X11 mouse highlighting */ 4136 break; /* X11 mouse highlighting */
4110#endif 4137#endif
4111 case 1010: /* scroll to bottom on TTY output inhibit */ 4138 case 1010: /* scroll to bottom on TTY output inhibit */
4112 if (state) 4139 if (!state)
4113 options &= ~Opt_scrollTtyOutput; 4140 SET_OPTION (Opt_scrollTtyOutput);
4114 else 4141 else
4115 options |= Opt_scrollTtyOutput; 4142 CLR_OPTION (Opt_scrollTtyOutput);
4116 break; 4143 break;
4117 case 1011: /* scroll to bottom on key press */ 4144 case 1011: /* scroll to bottom on key press */
4118 if (state) 4145 if (state)
4119 options |= Opt_scrollTtyKeypress; 4146 SET_OPTION (Opt_scrollTtyKeypress);
4120 else 4147 else
4121 options &= ~Opt_scrollTtyKeypress; 4148 CLR_OPTION (Opt_scrollTtyKeypress);
4122 break; 4149 break;
4123 case 1047: /* secondary screen w/ clearing last */ 4150 case 1047: /* secondary screen w/ clearing last */
4124 if (options & Opt_secondaryScreen) 4151 if (OPTION (Opt_secondaryScreen))
4125 if (current_screen != PRIMARY) 4152 if (current_screen != PRIMARY)
4126 scr_erase_screen (2); 4153 scr_erase_screen (2);
4127 scr_change_screen (state); 4154 scr_change_screen (state);
4128 break; 4155 break;
4129 case 1049: /* secondary screen w/ clearing first */ 4156 case 1049: /* secondary screen w/ clearing first */
4130 scr_change_screen (state); 4157 scr_change_screen (state);
4131 if (options & Opt_secondaryScreen) 4158 if (OPTION (Opt_secondaryScreen))
4132 if (current_screen != PRIMARY) 4159 if (current_screen != PRIMARY)
4133 scr_erase_screen (2); 4160 scr_erase_screen (2);
4134 break; 4161 break;
4135 default: 4162 default:
4136 break; 4163 break;
4286 case 106: 4313 case 106:
4287 case 107: 4314 case 107:
4288 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); 4315 scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
4289 break; 4316 break;
4290#endif 4317#endif
4291
4292 } 4318 }
4293 } 4319 }
4294} 4320}
4295/*}}} */ 4321/*}}} */
4296 4322

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines