--- rxvt-unicode/src/command.C 2006/01/16 15:00:20 1.267 +++ rxvt-unicode/src/command.C 2006/01/20 12:16:28 1.277 @@ -66,9 +66,6 @@ #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) -// exception thrown when the command parser runs out of input data -class out_of_input { } out_of_input; - #if ENABLE_FRILLS || ISO_14755 #define ISO_14755_STARTED 0x80000000UL @@ -466,7 +463,7 @@ { /* normal XTerm key bindings */ case XK_Insert: /* Shift+Insert = paste mouse selection */ - selection_request (ev.time, 0, 0); + selection_request (ev.time); return; #if TODO /* rxvt extras */ @@ -1008,7 +1005,7 @@ while (row < end_row); } - scr_refresh (refresh_type); + scr_refresh (); scrollbar_show (1); #ifdef USE_XIM IMSendSpot (); @@ -1046,7 +1043,7 @@ hidden_cursor = !hidden_cursor; want_refresh = 1; - w.start (w.at + BLINK_INTERVAL); + w.start (w.at + CURSOR_BLINK_INTERVAL); } #endif @@ -1070,7 +1067,6 @@ if ((scrollbar_isUp() || scrollbar_isDn()) && scr_page (scrollbar_isUp() ? UP : DN, 1)) { - refresh_type |= SMOOTH_REFRESH; want_refresh = 1; w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); } @@ -1084,7 +1080,6 @@ if (scr_page (scroll_selection_dir, scroll_selection_lines)) { selection_extend (selection_save_x, selection_save_y, selection_save_state); - refresh_type |= SMOOTH_REFRESH; want_refresh = 1; w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); } @@ -1102,7 +1097,6 @@ if (view_start == top_row || view_start == 0) mouse_slip_wheel_speed = 0; - refresh_type |= SMOOTH_REFRESH; want_refresh = 1; w.start (w.at + SCROLLBAR_CONTINUOUS_DELAY); } @@ -1142,7 +1136,7 @@ cmdbuf_ptr = cmdbuf_base; cmdbuf_endp = cmdbuf_ptr + n; - ssize_t r = read (pty.pty, cmdbuf_endp, CBUFSIZ - n); + ssize_t r = read (pty->pty, cmdbuf_endp, CBUFSIZ - n); if (r > 0) { @@ -1410,52 +1404,35 @@ case ClientMessage: if (ev.xclient.format == 32 - && ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) + && !HOOK_INVOKE ((this, HOOK_CLIENT_MESSAGE, DT_XEVENT, &ev, DT_END))) { - if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) - destroy (); + if (ev.xclient.message_type == xa[XA_WM_PROTOCOLS]) + { + if (!HOOK_INVOKE ((this, HOOK_WM_PROTOCOLS, DT_XEVENT, &ev, DT_END))) + { + if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) + { + if (!HOOK_INVOKE ((this, HOOK_WM_DELETE_WINDOW, DT_XEVENT, &ev, DT_END))) + destroy (); + } #if ENABLE_EWMH - else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) - XSendEvent (disp, ev.xclient.window = display->root, - False, SubstructureRedirectMask | SubstructureNotifyMask, - &ev); + else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING]) + XSendEvent (disp, ev.xclient.window = display->root, + False, SubstructureRedirectMask | SubstructureNotifyMask, + &ev); #endif - } + } + } #if ENABLE_XEMBED - else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) - { - if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) - focus_in (); - else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) - focus_out (); - } + else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED]) + { + if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) + focus_in (); + else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) + focus_out (); + } #endif -#ifdef OFFIX_DND - /* OffiX Dnd (drag 'n' drop) protocol */ - else if (ev.xclient.message_type == xa[XA_DNDPROTOCOL] - && (ev.xclient.data.l[0] == DndFile - || ev.xclient.data.l[0] == DndDir - || ev.xclient.data.l[0] == DndLink)) - { - /* Get Dnd data */ - Atom ActualType; - int ActualFormat; - unsigned char *data; - unsigned long Size, RemainingBytes; - - XGetWindowProperty (disp, display->root, - xa[XA_DNDSELECTION], - 0L, 1000000L, - False, AnyPropertyType, - &ActualType, &ActualFormat, - &Size, &RemainingBytes, - &data); - set_string_property (XA_CUT_BUFFER0, data); - XFree (data); - selection_paste (display->root, XA_CUT_BUFFER0, true); - XSetInputFocus (disp, display->root, RevertToNone, CurrentTime); } -#endif /* OFFIX_DND */ break; case MappingNotify: @@ -1507,6 +1484,8 @@ resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); } + HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); + #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ if (OPTION (Opt_transparent)) check_our_parents (); @@ -1716,7 +1695,7 @@ want_refresh = 1; } - cursor_blink_ev.start (NOW + BLINK_INTERVAL); + cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); } #endif @@ -1754,7 +1733,7 @@ #endif #if CURSOR_BLINK if (OPTION (Opt_cursorBlink)) - cursor_blink_ev.start (NOW + BLINK_INTERVAL); + cursor_blink_ev.start (NOW + CURSOR_BLINK_INTERVAL); #endif #if OFF_FOCUS_FADING if (rs[Rs_fade]) @@ -2102,9 +2081,6 @@ { scrollBar.setIdle (); scrollbar_show (0); -#ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING - refresh_type &= ~SMOOTH_REFRESH; -#endif } #ifdef SELECTION_SCROLLING @@ -2161,9 +2137,12 @@ case Button3: selection_make (ev.time); break; + case Button2: - selection_request (ev.time, ev.x, ev.y); + if (IN_RANGE_EXC (ev.x, 0, width) && IN_RANGE_EXC (ev.y, 0, height)) // inside window? + selection_request (ev.time, ev.state & ShiftMask ? Sel_Clipboard : Sel_Primary); break; + #ifdef MOUSE_WHEEL case Button4: case Button5: @@ -2800,7 +2779,7 @@ else { flag = true; - scr_refresh (refresh_type); + scr_refresh (); want_refresh = 1; } } @@ -2828,7 +2807,7 @@ // read the next character wchar_t -rxvt_term::next_char () +rxvt_term::next_char () NOTHROW { while (cmdbuf_ptr < cmdbuf_endp) { @@ -2859,20 +2838,22 @@ // read the next octet uint32_t -rxvt_term::next_octet () +rxvt_term::next_octet () NOTHROW { return cmdbuf_ptr < cmdbuf_endp ? (unsigned char)*cmdbuf_ptr++ : NOCHAR; } +static class out_of_input out_of_input; + /* rxvt_cmd_getc () - Return next input character */ /* * Return the next input character after first passing any keyboard input * to the command. */ wchar_t -rxvt_term::cmd_getc () +rxvt_term::cmd_getc () THROW ((class out_of_input)) { wchar_t c = next_char (); @@ -2883,7 +2864,7 @@ } uint32_t -rxvt_term::cmd_get8 () +rxvt_term::cmd_get8 () THROW ((class out_of_input)) { uint32_t c = next_octet (); @@ -3772,7 +3753,6 @@ void rxvt_term::process_xterm_seq (int op, const char *str, char resp) { - int changed = 0; int color; char *buf, *name; bool query = str[0] == '?' && !str[1]; @@ -3898,30 +3878,34 @@ #endif case Rxvt_Pixmap: - if (*str != ';') - { + { + if (*str != ';') + { #if XPM_BACKGROUND - scale_pixmap (""); /* reset to default scaling */ - set_bgPixmap (str); /* change pixmap */ - scr_touch (true); + scale_pixmap (""); /* reset to default scaling */ + set_bgPixmap (str); /* change pixmap */ + scr_touch (true); #endif - } + } - while ((str = strchr (str, ';')) != NULL) - { - str++; + int changed = 0; + + while ((str = strchr (str, ';')) != NULL) + { + str++; #if XPM_BACKGROUND - changed += scale_pixmap (str); + changed += scale_pixmap (str); #endif - } + } - if (changed) - { + if (changed) + { #ifdef XPM_BACKGROUND - resize_pixmap (); - scr_touch (true); + resize_pixmap (); + scr_touch (true); #endif - } + } + } break; case Rxvt_restoreFG: @@ -3977,7 +3961,7 @@ else { set_locale (str); - pty.set_utf8_mode (enc_utf8); + pty->set_utf8_mode (enc_utf8); init_xlocale (); } break; @@ -4040,7 +4024,7 @@ /* we're not using priv _yet_ */ void -rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), unsigned int nargs, const int *arg) +rxvt_term::process_terminal_mode (int mode, int priv UNUSED, unsigned int nargs, const int *arg) { unsigned int i, j; int state; @@ -4419,12 +4403,12 @@ if (HOOK_INVOKE ((this, HOOK_TT_WRITE, DT_STR_LEN, data, len, DT_END))) return; - if (pty.pty < 0) + if (pty->pty < 0) return; if (v_buflen == 0) { - ssize_t written = write (pty.pty, data, min (len, MAX_PTY_WRITE)); + ssize_t written = write (pty->pty, data, min (len, MAX_PTY_WRITE)); if ((unsigned int)written == len) return; @@ -4443,7 +4427,7 @@ void rxvt_term::pty_write () { - int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); + int written = write (pty->pty, v_buffer, min (v_buflen, MAX_PTY_WRITE)); if (written > 0) {