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.435 by sf-exg, Wed Jan 6 12:10:44 2010 UTC vs.
Revision 1.449 by sf-exg, Sun Apr 18 11:06:46 2010 UTC

162 162
163void 163void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) 164rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y)
165{ 165{
166 rxvt_fontset *fs = FONTSET (r); 166 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2, *fname; 167 wchar_t *chr, *alloc, ch2, **fname;
169 int len; 168 int len;
170
171 fname = rxvt_utf8towcs (f->name);
172 169
173# if ENABLE_COMBINING 170# if ENABLE_COMBINING
174 if (IS_COMPOSE (ch)) 171 if (IS_COMPOSE (ch))
175 { 172 {
176 len = rxvt_composite.expand (ch, 0); 173 len = rxvt_composite.expand (ch, 0);
197 r & RS_Blink ? " blink" : "", 194 r & RS_Blink ? " blink" : "",
198 r & RS_RVid ? " rvid" : "", 195 r & RS_RVid ? " rvid" : "",
199 r & RS_Uline ? " uline" : "", 196 r & RS_Uline ? " uline" : "",
200 r & RS_Careful ? " careful" : ""); 197 r & RS_Careful ? " careful" : "");
201 198
199 int width = 0;
200 fname = rxvt_temp_buf<wchar_t *> (len);
201 for (int i = 0; i < len; i++)
202 {
203 rxvt_font *f = (*fs)[fs->find_font_idx (chr[i])];
204 fname[i] = rxvt_utf8towcs (f->name);
202 int width = wcswidth (fname, wcslen (fname)); 205 max_it (width, wcswidth (fname[i], wcslen (fname[i])));
206 }
203 207
204 max_it (width, 8+5); // for char + hex 208 max_it (width, 8+5); // for char + hex
205 max_it (width, strlen (attr)); 209 max_it (width, strlen (attr));
206 210
207 if (y >= 0) 211 if (y >= 0)
208 { 212 {
209 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; 213 y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1;
210 x = 0; 214 x = 0;
211 } 215 }
212 216
213 scr_overlay_new (x, y, width, len + 2); 217 scr_overlay_new (x, y, width, len * 2 + 1);
214 218
215 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 219 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
216 220
217 for (int y = 0; y < len; y++) 221 for (int y = 0; y < len; y++)
218 { 222 {
237// char buf[4+4+3+1]; 241// char buf[4+4+3+1];
238// snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y); 242// snprintf (buf, sizeof (buf), "(%.4d|%.4d)", x, y);
239// scr_overlay_set (0, 0, buf); 243// scr_overlay_set (0, 0, buf);
240// } 244// }
241 scr_overlay_set (0, len , attr); 245 scr_overlay_set (0, len , attr);
246 for (int i = 0; i < len; i++)
247 {
242 scr_overlay_set (0, len + 1, fname); 248 scr_overlay_set (0, len + 1 + i, fname[i]);
243
244 free (fname); 249 free (fname[i]);
250 }
245 251
246# if ENABLE_COMBINING 252# if ENABLE_COMBINING
247 if (alloc) 253 if (alloc)
248 delete [] alloc; 254 delete [] alloc;
249# endif 255# endif
282} 288}
283 289
284static int 290static int
285hex_keyval (XKeyEvent &ev) 291hex_keyval (XKeyEvent &ev)
286{ 292{
287 // check wether this event corresponds to a hex digit 293 // check whether this event corresponds to a hex digit
288 // if the modifiers had not been pressed. 294 // if the modifiers had not been pressed.
289 for (int index = 0; index < 8; index++) 295 for (int index = 0; index < 8; index++)
290 { 296 {
291 KeySym k = XLookupKeysym (&ev, index); 297 KeySym k = XLookupKeysym (&ev, index);
292 298
416 */ 422 */
417 shft = ev.state & ShiftMask; 423 shft = ev.state & ShiftMask;
418 ctrl = ev.state & ControlMask; 424 ctrl = ev.state & ControlMask;
419 meta = ev.state & ModMetaMask; 425 meta = ev.state & ModMetaMask;
420 426
421 if (numlock_state || (ev.state & ModNumLockMask))
422 {
423 numlock_state = (ev.state & ModNumLockMask);
424 set_privmode (PrivMode_aplKP, !numlock_state);
425 }
426
427 kbuf[0] = 0; 427 kbuf[0] = 0;
428 428
429#ifdef USE_XIM 429#ifdef USE_XIM
430 if (Input_Context) 430 if (Input_Context)
431 { 431 {
505#ifdef PAGING_CONTEXT_LINES 505#ifdef PAGING_CONTEXT_LINES
506 lnsppg = nrow - PAGING_CONTEXT_LINES; 506 lnsppg = nrow - PAGING_CONTEXT_LINES;
507#else 507#else
508 lnsppg = nrow * 4 / 5; 508 lnsppg = nrow * 4 / 5;
509#endif 509#endif
510 max_it (lnsppg, 1);
511
510 if (keysym == XK_Prior) 512 if (keysym == XK_Prior)
511 { 513 {
512 scr_page (UP, lnsppg); 514 scr_page (UP, lnsppg);
513 return; 515 return;
514 } 516 }
645 if (keysym >= 0xFF00 && keysym <= 0xFFFF) 647 if (keysym >= 0xFF00 && keysym <= 0xFFFF)
646 { 648 {
647 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft; 649 bool kp = priv_modes & PrivMode_aplKP ? !shft : shft;
648 unsigned int newlen = 1; 650 unsigned int newlen = 1;
649 651
652 if (ev.state & ModNumLockMask)
653 kp = false;
654
650 switch (translate_keypad (keysym, kp)) 655 keysym = translate_keypad (keysym, kp);
656
657 switch (keysym)
651 { 658 {
652#ifndef NO_BACKSPACE_KEY 659#ifndef NO_BACKSPACE_KEY
653 case XK_BackSpace: 660 case XK_BackSpace:
654 if (priv_modes & PrivMode_HaveBackSpace) 661 if (priv_modes & PrivMode_HaveBackSpace)
655 { 662 {
1025 } 1032 }
1026 1033
1027 display->flush (); 1034 display->flush ();
1028} 1035}
1029 1036
1030/* checks wether a refresh is requested and starts the refresh timer */ 1037/* checks whether a refresh is requested and starts the refresh timer */
1031void 1038void
1032rxvt_term::refresh_check () 1039rxvt_term::refresh_check ()
1033{ 1040{
1034 if (want_refresh && !flush_ev.is_active ()) 1041 if (want_refresh && !flush_ev.is_active ())
1035 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally 1042 flush_ev.start (1. / 60.); // refresh at max. 60 Hz normally
1129 // this should really be sched_yield(), but the linux guys thought 1136 // this should really be sched_yield(), but the linux guys thought
1130 // that giving a process calling sched_yield () less cpu time than 1137 // that giving a process calling sched_yield () less cpu time than
1131 // ones with high nice levels is a useful thing to do. It surely is is 1138 // ones with high nice levels is a useful thing to do. It surely is is
1132 // allowed by the sus... as is returning ENOSYS. 1139 // allowed by the sus... as is returning ENOSYS.
1133 // since the linux guys additionally thought that breaking the only 1140 // since the linux guys additionally thought that breaking the only
1134 // known workaroudn against their unusable sched_yield hack is cool, 1141 // known workaround against their unusable sched_yield hack is cool,
1135 // we just nanosleep a bit and hope for the best. 1142 // we just nanosleep a bit and hope for the best.
1136 1143
1137 struct timespec ts = { 0, 1000 }; 1144 struct timespec ts = { 0, 1000 };
1138 nanosleep (&ts, 0); 1145 nanosleep (&ts, 0);
1139 1146
1462 selection_property (ev.xproperty.window, ev.xproperty.atom); 1469 selection_property (ev.xproperty.window, ev.xproperty.atom);
1463 1470
1464 break; 1471 break;
1465 1472
1466 case SelectionClear: 1473 case SelectionClear:
1467 selection_clear (); 1474 selection_clear (ev.xselectionclear.selection == xa[XA_CLIPBOARD]);
1468 break; 1475 break;
1469 1476
1470 case SelectionNotify: 1477 case SelectionNotify:
1471 if (selection_wait == Sel_normal) 1478 if (selection_wait == Sel_normal)
1472 selection_paste (ev.xselection.requestor, ev.xselection.property, true); 1479 selection_paste (ev.xselection.requestor, ev.xselection.property, true);
2143 selection_make (ev.time); 2150 selection_make (ev.time);
2144 break; 2151 break;
2145 2152
2146 case Button2: 2153 case Button2:
2147 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? 2154 if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window?
2148 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary); 2155 selection_request (ev.time, ev.state & ModMetaMask ? Sel_Clipboard : Sel_Primary);
2149 break; 2156 break;
2150 2157
2151#ifdef MOUSE_WHEEL 2158#ifdef MOUSE_WHEEL
2152 case Button4: 2159 case Button4:
2153 case Button5: 2160 case Button5:
3387 process_color_seq (op, Color_pointer_fg, str, resp); 3394 process_color_seq (op, Color_pointer_fg, str, resp);
3388 break; 3395 break;
3389 case XTerm_Color_pointer_bg: 3396 case XTerm_Color_pointer_bg:
3390 process_color_seq (op, Color_pointer_bg, str, resp); 3397 process_color_seq (op, Color_pointer_bg, str, resp);
3391 break; 3398 break;
3399#ifdef OPTION_HC
3400 case XTerm_Color_HC:
3401 process_color_seq (op, Color_HC, str, resp);
3402 break;
3403#endif
3392#ifndef NO_BOLD_UNDERLINE_REVERSE 3404#ifndef NO_BOLD_UNDERLINE_REVERSE
3393 case XTerm_Color_RV:
3394 process_color_seq (op, Color_RV, str, resp);
3395 break;
3396 case Rxvt_Color_BD:
3397 case URxvt_Color_BD: 3405 case URxvt_Color_BD:
3398 process_color_seq (op, Color_BD, str, resp); 3406 process_color_seq (op, Color_BD, str, resp);
3399 break; 3407 break;
3400 case Rxvt_Color_UL:
3401 case URxvt_Color_UL: 3408 case URxvt_Color_UL:
3402 process_color_seq (op, Color_UL, str, resp); 3409 process_color_seq (op, Color_UL, str, resp);
3403 break; 3410 break;
3404 case URxvt_Color_IT: 3411 case URxvt_Color_IT:
3405 process_color_seq (op, Color_IT, str, resp); 3412 process_color_seq (op, Color_IT, str, resp);
3430 case Rxvt_Pixmap: 3437 case Rxvt_Pixmap:
3431 if (!strcmp (str, "?")) 3438 if (!strcmp (str, "?"))
3432 { 3439 {
3433 char str[256]; 3440 char str[256];
3434 3441
3435 sprintf (str, "[%dx%d+%d+%d]", /* can't presume snprintf () ! */ 3442 sprintf (str, "[%dx%d+%d+%d]",
3436 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767), 3443 min (bgPixmap.h_scale, 32767), min (bgPixmap.v_scale, 32767),
3437 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767)); 3444 min (bgPixmap.h_align, 32767), min (bgPixmap.v_align, 32767));
3438 process_xterm_seq (XTerm_title, str, CHAR_ST); 3445 process_xterm_seq (XTerm_title, str, CHAR_ST);
3439 } 3446 }
3440 else 3447 else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines