--- rxvt-unicode/src/command.C 2006/01/11 05:14:26 1.256 +++ rxvt-unicode/src/command.C 2006/01/16 15:00:20 1.267 @@ -149,7 +149,7 @@ for (;;) { - const line_t &l = ROW(y - view_start); + const line_t &l = ROW(y + view_start); text_t t = l.t[x]; @@ -445,7 +445,7 @@ } else if (keysym == XK_End) { - scr_move_to (1, 0); + scr_move_to (1, 1); return; } } @@ -921,9 +921,7 @@ } /*}}} */ -#if MENUBAR_MAX || defined (KEYSYM_RESOURCE) -/*{{{ rxvt_cmd_write (), rxvt_cmd_getc () */ -/* attempt to `write' count to the input buffer */ +#if defined (KEYSYM_RESOURCE) unsigned int rxvt_term::cmd_write (const char *str, unsigned int count) { @@ -974,10 +972,10 @@ { if (SHOULD_INVOKE (HOOK_LINE_UPDATE)) { - int row = -view_start; + int row = view_start; int end_row = row + nrow; - while (row > -nsaved && ROW (row - 1).is_longer ()) + while (row > top_row && ROW (row - 1).is_longer ()) --row; do @@ -1023,8 +1021,7 @@ void rxvt_term::check_cb (check_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); display->flush (); @@ -1035,8 +1032,7 @@ void rxvt_term::flush_cb (time_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); refresh_limit = 1; refresh_count = 0; @@ -1103,8 +1099,7 @@ || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) : scr_page (UP, mouse_slip_wheel_speed)) { - if (view_start == nsaved || - view_start == 0) + if (view_start == top_row || view_start == 0) mouse_slip_wheel_speed = 0; refresh_type |= SMOOTH_REFRESH; @@ -1175,8 +1170,7 @@ void rxvt_term::pty_cb (io_watcher &w, short revents) { - SET_R (this); - SET_LOCALE (locale); + make_current (); if (revents & EVENT_READ) // loop, but don't allow a single term to monopolize us @@ -1218,8 +1212,7 @@ void rxvt_term::pointer_cb (time_watcher &w) { - SET_R (this); - SET_LOCALE (locale); + make_current (); pointer_blank (); } @@ -1308,11 +1301,16 @@ void rxvt_term::x_cb (XEvent &ev) { + make_current (); + dDisp; - SET_R (this); - SET_LOCALE (locale); + if (ev.xany.window == vt + && SHOULD_INVOKE (HOOK_X_EVENT) + && HOOK_INVOKE ((this, HOOK_X_EVENT, DT_XEVENT, &ev, DT_END))) + return; + // for XQueryPointer Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; @@ -1589,10 +1587,6 @@ scrollBar.setIdle (); scrollbar_show (0); } -#ifdef MENUBAR - if (menubar_visible () && isMenuBarWindow (ev.xany.window)) - menubar_expose (); -#endif #ifdef TRANSPARENT if (am_transparent && ev.xany.window == parent[0]) @@ -1606,19 +1600,13 @@ if (hidden_pointer) pointer_unblank (); #endif -#if MENUBAR - if (isMenuBarWindow (ev.xany.window)) - { - menubar_control (ev.xbutton); - break; - } -#endif if ((priv_modes & PrivMode_mouse_report) && !bypass_keystate) break; if (ev.xany.window == vt) { - if (HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) + if (SHOULD_INVOKE (HOOK_MOTION_NOTIFY) + && HOOK_INVOKE ((this, HOOK_MOTION_NOTIFY, DT_XEVENT, &ev, DT_END))) ; // nop else if (ev.xbutton.state & (Button1Mask | Button3Mask)) { @@ -1820,8 +1808,7 @@ void rxvt_term::rootwin_cb (XEvent &ev) { - SET_R (this); - SET_LOCALE (locale); + make_current (); switch (ev.type) { @@ -1922,7 +1909,7 @@ #endif /* allow shift+left click to extend selection */ - if (ev.state & ShiftMask && ! (priv_modes & PrivMode_mouse_report)) + if (ev.state & ShiftMask && !(priv_modes & PrivMode_mouse_report)) { if (MEvent.button == Button1 && clickintime) selection_rotate (ev.x, ev.y); @@ -2100,14 +2087,6 @@ return; } - -#if MENUBAR - /* - * Menubar window processing of button press - */ - if (isMenuBarWindow (ev.window)) - menubar_control (ev); -#endif } void @@ -2226,10 +2205,6 @@ #endif } } -#ifdef MENUBAR - else if (isMenuBarWindow (ev.window)) - menubar_control (ev); -#endif } #ifdef TRANSPARENT @@ -2782,7 +2757,8 @@ // scr_add_lines only works for nlines <= nrow - 1. if (nlines >= nrow - 1) { - if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) + if (!(SHOULD_INVOKE (HOOK_ADD_LINES) + && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) scr_add_lines (buf, str - buf, nlines); nlines = 0; @@ -2807,7 +2783,8 @@ ch = next_char (); } - if (!HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END))) + if (!(SHOULD_INVOKE (HOOK_ADD_LINES) + && HOOK_INVOKE ((this, HOOK_ADD_LINES, DT_WCS_LEN, buf, str - buf, DT_END)))) scr_add_lines (buf, str - buf, nlines); /* @@ -3862,7 +3839,7 @@ *name++ = '\0'; color = atoi (buf) + minCOLOR; - if (!IN_RANGE_EXC (color, minCOLOR, TOTAL_COLORS)) + if (!IN_RANGE_INC (color, minCOLOR, maxTermCOLOR)) break; if ((buf = strchr (name, ';')) != NULL) @@ -3896,15 +3873,17 @@ process_color_seq (XTerm_Color_pointer_bg, Color_pointer_bg, str, resp); break; #ifndef NO_BOLD_UNDERLINE_REVERSE - case XTerm_Color_BD: - process_color_seq (XTerm_Color_BD, Color_BD, str, resp); - break; - case XTerm_Color_UL: - process_color_seq (XTerm_Color_UL, Color_UL, str, resp); - break; case XTerm_Color_RV: process_color_seq (XTerm_Color_RV, Color_RV, str, resp); break; + case Rxvt_Color_BD: + case URxvt_Color_BD: + process_color_seq (op, Color_BD, str, resp); + break; + case Rxvt_Color_UL: + case URxvt_Color_UL: + process_color_seq (op, Color_UL, str, resp); + break; case URxvt_Color_IT: process_color_seq (URxvt_Color_IT, Color_IT, str, resp); break; @@ -3918,7 +3897,7 @@ break; #endif - case XTerm_Pixmap: + case Rxvt_Pixmap: if (*str != ';') { #if XPM_BACKGROUND @@ -3945,10 +3924,10 @@ } break; - case XTerm_restoreFG: + case Rxvt_restoreFG: set_window_color (Color_fg, str); break; - case XTerm_restoreBG: + case Rxvt_restoreBG: set_window_color (Color_bg, str); break; @@ -3956,14 +3935,8 @@ // TODO, when secure mode? break; -#ifdef MENUBAR - case URxvt_Menu: - if (OPTION (Opt_insecure)) - menubar_dispatch (const_cast(str)); // casting away constness is checked - break; -#endif #if 0 - case XTerm_dumpscreen: /* no error notices */ + case Rxvt_dumpscreen: /* no error notices */ { int fd; if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0) @@ -4088,9 +4061,6 @@ { 7, PrivMode_Autowrap }, // 8, bi-directional support mode { 9, PrivMode_MouseX10 }, -#ifdef menuBar_esc - { menuBar_esc, PrivMode_menuBar }, -#endif // 18, 19 printing-related { 25, PrivMode_VisibleCursor }, #ifdef scrollBar_esc @@ -4195,13 +4165,6 @@ if (state) /* orthogonal */ priv_modes &= ~PrivMode_MouseX11; break; -#ifdef menuBar_esc - case menuBar_esc: -#ifdef MENUBAR - map_menuBar (state); -#endif - break; -#endif #ifdef scrollBar_esc case scrollBar_esc: if (scrollbar_mapping (state))