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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines