--- rxvt-unicode/src/command.C 2003/12/18 07:31:18 1.20 +++ rxvt-unicode/src/command.C 2004/01/29 23:31:45 1.32 @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: command.c *----------------------------------------------------------------------* - * $Id: command.C,v 1.20 2003/12/18 07:31:18 pcg Exp $ + * $Id: command.C,v 1.32 2004/01/29 23:31:45 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey, University of Kent at Canterbury @@ -66,7 +66,7 @@ static int debug_key = 1; /* accessible by a debugger only */ #endif int valid_keysym; - unsigned char *kbuf = R->kbuf; + unsigned char kbuf[KBUFSZ]; /* * use Num_Lock to toggle Keypad on/off. If Num_Lock is off, allow an @@ -92,7 +92,7 @@ Status status_return; #ifdef X_HAVE_UTF8_STRING - if (R->enc_utf8) + if (R->enc_utf8 && 0) len = Xutf8LookupString (R->Input_Context, ev, (char *)kbuf, KBUFSZ, &keysym, &status_return); else @@ -637,7 +637,7 @@ fprintf(stderr, "'\n"); } #endif /* DEBUG_CMD */ - R->tt_write(kbuf, (unsigned int)len); + R->tt_write (kbuf, (unsigned int)len); } /*}}} */ @@ -681,15 +681,15 @@ if (want_full_refresh) { want_full_refresh = 0; - rxvt_scr_clear (this); - rxvt_scr_touch (this, False); + scr_clear (); + scr_touch (false); want_refresh = 1; } #endif if (want_refresh) { - rxvt_scr_refresh (this, refresh_type); + scr_refresh (refresh_type); rxvt_scrollbar_show (this, 1); #ifdef USE_XIM rxvt_IMSendSpot (this); @@ -697,10 +697,6 @@ } XFlush (Xdisplay); -#if 0 - if (XPending (Xdisplay)) process_x_events (); - if (XPending (Xdisplay)) process_x_events (); -#endif } void @@ -722,8 +718,7 @@ XNextEvent (Xdisplay, &xev); #if defined(CURSOR_BLINK) - if ((Options & Opt_cursorBlink) - && xev.type == KeyPress) + if ((Options & Opt_cursorBlink) && xev.type == KeyPress) { if (hidden_cursor) { @@ -731,13 +726,12 @@ want_refresh = 1; } - blink_ev.start (NOW + BLINK_INTERVAL); + cursor_blink_ev.start (NOW + BLINK_INTERVAL); } #endif #if defined(POINTER_BLANK) - if ((Options & Opt_pointerBlank) - && (pointerBlankDelay > 0)) + if ((Options & Opt_pointerBlank) && pointerBlankDelay > 0) { if (xev.type == MotionNotify || xev.type == ButtonPress @@ -758,13 +752,29 @@ while (XPending (Xdisplay)); } +#ifdef CURSOR_BLINK void -rxvt_term::blink_cb (time_watcher &w) +rxvt_term::cursor_blink_cb (time_watcher &w) { - w.at += BLINK_INTERVAL; hidden_cursor = !hidden_cursor; want_refresh = 1; + + w.start (w.at + BLINK_INTERVAL); +} +#endif + +#ifdef TEXT_BLINK +void +rxvt_term::text_blink_cb (time_watcher &w) +{ + if (scr_refresh_rend (RS_Blink, RS_Blink)) + { + hidden_text = !hidden_text; + want_refresh = 1; + w.start (w.at + TEXT_BLINK_INTERVAL); + } } +#endif void rxvt_term::x_cb (io_watcher &w, short revents) @@ -889,7 +899,7 @@ if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) refresh_limit++; - rxvt_scr_refresh (this, refresh_type); + scr_refresh (refresh_type); } } @@ -997,7 +1007,7 @@ if (!R->scroll_selection_delay-- && rxvt_scr_page(aR_ R->scroll_selection_dir, R->scroll_selection_lines)) { - rxvt_selection_extend(aR_ R->selection_save_x, + R->selection_extend (R->selection_save_x, R->selection_save_y, R->selection_save_state); R->scroll_selection_delay = SCROLLBAR_CONTINUOUS_DELAY; R->refresh_type |= SMOOTH_REFRESH; @@ -1023,26 +1033,22 @@ #endif } +#ifdef POINTER_BLANK void rxvt_term::pointer_unblank () { XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); recolour_cursor (); -#ifdef POINTER_BLANK hidden_pointer = 0; if (Options & Opt_pointerBlank) pointer_ev.start (NOW + pointerBlankDelay); -#endif } -#ifdef POINTER_BLANK void rxvt_term::pointer_blank () { - pointer_ev.stop (); - if (!(Options & Opt_pointerBlank)) return; @@ -1071,7 +1077,7 @@ x = ev->x; y = ev->y; - rxvt_pixel_position(aR_ &x, &y); + R->pixel_position (&x, &y); if (R->MEvent.button == AnyButton) { button_number = 3; @@ -1299,7 +1305,7 @@ #endif #ifdef CURSOR_BLINK if (R->Options & Opt_cursorBlink) - R->blink_ev.start (NOW + BLINK_INTERVAL); + R->cursor_blink_ev.start (NOW + BLINK_INTERVAL); #endif } break; @@ -1314,7 +1320,7 @@ #endif #ifdef CURSOR_BLINK if (R->Options & Opt_cursorBlink) - R->blink_ev.stop (); + R->cursor_blink_ev.stop (); R->hidden_cursor = 0; #endif } @@ -1332,8 +1338,7 @@ ConfigureNotify, ev)); if (R->szHint.width != width || R->szHint.height != height) { D_SIZE((stderr, "Size: Resizing from: %4d x %4d", R->szHint.width, R->szHint.height)); - rxvt_resize_all_windows(aR_ (unsigned int)width, - (unsigned int)height, 1); + R->resize_all_windows (width, height, 1); } #ifdef DEBUG_SIZE else { @@ -1366,10 +1371,16 @@ case UnmapNotify: R->TermWin.mapped = 0; +#ifdef TEXT_BLINK + R->text_blink_ev.stop (); +#endif break; case MapNotify: R->TermWin.mapped = 1; +#ifdef TEXT_BLINK + R->text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL); +#endif break; case PropertyNotify: @@ -1402,12 +1413,12 @@ case Expose: if (ev->xany.window == R->TermWin.vt) { #ifdef NO_SLOW_LINK_SUPPORT - rxvt_scr_expose(aR_ ev->xexpose.x, ev->xexpose.y, - ev->xexpose.width, ev->xexpose.height, False); + R->scr_expose (ev->xexpose.x, ev->xexpose.y, + ev->xexpose.width, ev->xexpose.height, False); #else // don't understand this, so commented it out - rxvt_scr_expose(aR_ ev->xexpose.x, ev->xexpose.y, - ev->xexpose.width, ev->xexpose.height, False); + R->scr_expose (ev->xexpose.x, ev->xexpose.y, + ev->xexpose.width, ev->xexpose.height, False); //rxvt_scr_expose(aR_ ev->xexpose.x, 0, // ev->xexpose.width, R->TermWin.height, False); #endif @@ -1462,7 +1473,7 @@ /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - R->MEvent.time) > MOUSE_THRESHOLD) { #endif - rxvt_selection_extend(aR_ (ev->xbutton.x), (ev->xbutton.y), + R->selection_extend ((ev->xbutton.x), (ev->xbutton.y), (ev->xbutton.state & Button3Mask) ? 2 : 0); #ifdef SELECTION_SCROLLING if (ev->xbutton.yTermWin.int_bwidth || @@ -1521,7 +1532,7 @@ &unused_mask); rxvt_scr_move_to(aR_ scrollbar_position(ev->xbutton.y) - R->csrO, scrollbar_size()); - rxvt_scr_refresh(aR_ R->refresh_type); + R->scr_refresh (R->refresh_type); R->refresh_limit = 0; rxvt_scrollbar_show(aR_ 1); } @@ -1533,7 +1544,7 @@ void rxvt_button_press(pR_ XButtonEvent *ev) { - int reportmode = 0, clickintime; + int reportmode = 0, clickintime; R->bypass_keystate = ev->state & (R->ModMetaMask | ShiftMask); if (!R->bypass_keystate) @@ -1590,19 +1601,32 @@ switch (ev->button) { case Button1: - if (R->MEvent.button == Button1 && clickintime) - R->MEvent.clicks++; + /* allow shift+left click to extend selection */ + if (ev->state & ShiftMask && !(R->PrivateModes & PrivMode_mouse_report)) + { + if (R->MEvent.button == Button1 && clickintime) + R->selection_rotate (ev->x, ev->y); + else + R->selection_extend (ev->x, ev->y, 1); + } else - R->MEvent.clicks = 1; - rxvt_selection_click(aR_ R->MEvent.clicks, ev->x, ev->y); + { + if (R->MEvent.button == Button1 && clickintime) + R->MEvent.clicks++; + else + R->MEvent.clicks = 1; + + R->selection_click (R->MEvent.clicks, ev->x, ev->y); + } + R->MEvent.button = Button1; break; case Button3: if (R->MEvent.button == Button3 && clickintime) - rxvt_selection_rotate(aR_ ev->x, ev->y); + R->selection_rotate (ev->x, ev->y); else - rxvt_selection_extend(aR_ ev->x, ev->y, 1); + R->selection_extend (ev->x, ev->y, 1); R->MEvent.button = Button3; break; } @@ -1806,7 +1830,7 @@ if (R->PrivateModes & PrivMode_mouse_report && R->bypass_keystate && ev->button == Button1 && R->MEvent.clicks <= 1) - rxvt_selection_extend(aR_ ev->x, ev->y, 0); + R->selection_extend (ev->x, ev->y, 0); switch (ev->button) { case Button1: @@ -1839,13 +1863,13 @@ # endif # ifdef JUMP_MOUSE_WHEEL rxvt_scr_page(aR_ v, i); - rxvt_scr_refresh(aR_ SMOOTH_REFRESH); + R->scr_refresh (SMOOTH_REFRESH); rxvt_scrollbar_show(aR_ 1); # else - for (; i--;) + while (i--) { rxvt_scr_page(aR_ v, 1); - rxvt_scr_refresh(aR_ SMOOTH_REFRESH); + R->scr_refresh (SMOOTH_REFRESH); rxvt_scrollbar_show(aR_ 1); } # endif @@ -2209,7 +2233,7 @@ rxvt_scr_index(aR_ DN); break; case 'J': /* erase to end of screen */ - rxvt_scr_erase_screen(aR_ 0); + R->scr_erase_screen (0); break; case 'K': /* erase to end of line */ rxvt_scr_erase_line(aR_ 0); @@ -2554,7 +2578,7 @@ break; case CSI_ED: /* 8.3.40: (0) ERASE IN PAGE */ - rxvt_scr_erase_screen(aR_ arg[0]); + R->scr_erase_screen (arg[0]); break; case CSI_EL: /* 8.3.42: (0) ERASE IN LINE */ @@ -2686,7 +2710,7 @@ case CSI_78: /* DECREQTPARM */ if (arg[0] == 0 || arg[0] == 1) - R->tt_printf("\033[%d;1;1;112;112;1;0x", arg[0] + 2); + R->tt_printf("\033[%d;1;1;128;128;1;0x", arg[0] + 2); /* FALLTHROUGH */ default: @@ -2734,7 +2758,7 @@ XLowerWindow(R->Xdisplay, R->TermWin.parent[0]); break; case 7: /* refresh window */ - rxvt_scr_touch(aR_ True); + R->scr_touch (true); break; case 8: /* set size (chars) */ rxvt_set_widthheight(aR_ (unsigned int)(args[2] * R->TermWin.fwidth), @@ -2955,7 +2979,7 @@ rxvt_scale_pixmap(aR_ ""); /* reset to default scaling */ rxvt_set_bgPixmap(aR_ str); /* change pixmap */ #endif - rxvt_scr_touch(aR_ True); + R->scr_touch (true); } while ((str = STRCHR(str, ';')) != NULL) { str++; @@ -2967,7 +2991,7 @@ #ifdef XPM_BACKGROUND rxvt_resize_pixmap(aR); #endif - rxvt_scr_touch(aR_ True); + R->scr_touch (true); } break; @@ -3063,6 +3087,7 @@ { 1010, PrivMode_TtyOutputInh }, { 1011, PrivMode_Keypress }, { 1047, PrivMode_Screen }, + { 1049, PrivMode_Screen }, /* xterm extension, not fully implemented */ }; if (nargs == 0) @@ -3143,8 +3168,8 @@ #ifdef scrollBar_esc case scrollBar_esc: if (rxvt_scrollbar_mapping(aR_ state)) { - rxvt_resize_all_windows(aR_ 0, 0, 0); - rxvt_scr_touch(aR_ True); + R->resize_all_windows (0, 0, 0); + R->scr_touch (true); } break; #endif @@ -3179,8 +3204,9 @@ R->Options &= ~Opt_scrollTtyKeypress; break; case 1047: /* secondary screen w/ clearing */ + case 1049: /* better secondary screen w/ clearing, but not fully implemented */ if (R->current_screen != PRIMARY) - rxvt_scr_erase_screen(aR_ 2); + R->scr_erase_screen (2); rxvt_scr_change_screen(aR_ state); /* FALLTHROUGH */ default: