From: pcg Date: Tue, 25 Nov 2003 17:11:32 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=4725e59b4b2b347d62077bbc7ad01c25e98ae8e0;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/reconf b/reconf index fbf25148..a2a7bd91 100755 --- a/reconf +++ b/reconf @@ -3,5 +3,4 @@ --with-term=xterm --enable-keepscrolling --enable-xft \ --enable-frills --disable-swapscreen \ --with-codesets=eu,jp \ - --enable-cursor-blink - #--enable-pointer-blank --enable-cursor-blink + --enable-cursor-blink --enable-pointer-blank --enable-cursor-blink diff --git a/src/command.C b/src/command.C index 9c52d49a..4fea5cdf 100644 --- a/src/command.C +++ b/src/command.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: command.c *----------------------------------------------------------------------* - * $Id: command.C,v 1.5 2003-11-25 15:44:38 pcg Exp $ + * $Id: command.C,v 1.6 2003-11-25 17:11:33 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey, University of Kent at Canterbury @@ -668,28 +668,31 @@ rxvt_term::process_x_events () #if defined(CURSOR_BLINK) if ((Options & Opt_cursorBlink) - && xev.type == KeyPress) { - if (hidden_cursor) { + && xev.type == KeyPress) + { + if (hidden_cursor) + { hidden_cursor = 0; want_refresh = 1; - } + } + blink_ev.start (NOW + BLINK_INTERVAL); - } + } #endif #if defined(POINTER_BLANK) if ((Options & Opt_pointerBlank) - && (pointerBlankDelay > 0)) { + && (pointerBlankDelay > 0)) + { if (xev.type == MotionNotify || xev.type == ButtonPress - || xev.type == ButtonRelease) { - if (hidden_pointer) - rxvt_pointer_unblank(aR); - want_motion_time = 1; - } + || xev.type == ButtonRelease) + if (hidden_pointer) + pointer_unblank (); + if (xev.type == KeyPress && hidden_pointer == 0) - rxvt_pointer_blank (this); - } + pointer_blank (); + } #endif #ifdef USE_XIM @@ -945,6 +948,7 @@ rxvt_cmd_getc(pR) fcntl (R->cmd_fd, F_SETFL, O_NONBLOCK); } +#if 0 #define TIMEOUT_USEC 5000 fd_set readfds; int quick_timeout, select_res; @@ -960,46 +964,6 @@ rxvt_cmd_getc(pR) if (R->v_bufstr < R->v_bufptr) /* output any pending chars */ rxvt_tt_write(aR_ NULL, 0); -#if defined(POINTER_BLANK) || defined(CURSOR_BLINK) - tp.tv_sec = 0; /* presume == 0 implies time not yet retrieved */ -#endif -#if defined(CURSOR_BLINK) - want_keypress_time = 0; -#endif -#if defined(POINTER_BLANK) - want_motion_time = 0; -#endif - - if (XPending (R->Xdisplay)) - { - R->process_x_events (); - - /* in case button actions pushed chars to cmdbuf */ - if (R->cmdbuf_ptr < R->cmdbuf_endp) - return *R->cmdbuf_ptr++; - } - -#if defined(CURSOR_BLINK) - if (want_keypress_time) { - (void)gettimeofday(&tp, NULL); - R->lastcursorchange.tv_sec = tp.tv_sec; - R->lastcursorchange.tv_usec = tp.tv_usec; - } -#endif -#if defined(POINTER_BLANK) - if (want_motion_time) { - if (!tp.tv_sec) - (void)gettimeofday(&tp, NULL); - R->lastmotion.tv_sec = tp.tv_sec; - R->lastmotion.tv_usec = tp.tv_usec; - } -#endif - -/* - * the command input buffer is empty and we have no pending X events - */ - quick_timeout = 0; - #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) if (R->mouse_slip_wheel_speed) { quick_timeout = 1; @@ -1038,114 +1002,44 @@ rxvt_cmd_getc(pR) } #endif /* NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING */ - FD_ZERO(&readfds); - FD_SET(R->cmd_fd, &readfds); - FD_SET(R->Xfd, &readfds); - value.tv_usec = TIMEOUT_USEC; - value.tv_sec = 0; - - if (!R->TermWin.mapped) - quick_timeout = 0; - else { - quick_timeout |= R->want_refresh; #ifdef TRANSPARENT quick_timeout |= R->want_full_refresh; #endif - } - -#if defined(POINTER_BLANK) || defined(CURSOR_BLINK) - { - int set_quick_timeout = 0; - long csdiff, psdiff; - -#define BLINK_TIME 500000L - csdiff = psdiff = 60000000L; /* or, say, LONG_MAX */ -# if defined(CURSOR_BLINK) - if (R->Options & Opt_cursorBlink) { - if (!tp.tv_sec) /* didn't get it before so get it now */ - (void)gettimeofday(&tp, NULL); - - csdiff = (tp.tv_sec - R->lastcursorchange.tv_sec) * 1000000L - + tp.tv_usec - R->lastcursorchange.tv_usec; - if (csdiff > BLINK_TIME) { /* XXX: settable blink times */ - R->lastcursorchange.tv_sec = tp.tv_sec; - R->lastcursorchange.tv_usec = tp.tv_usec; - R->hidden_cursor = !R->hidden_cursor; - csdiff = 0; - } else - csdiff = BLINK_TIME - csdiff; - set_quick_timeout = 1; - } -# endif -# if defined(POINTER_BLANK) - /* - * If we haven't moved the pointer for a while - */ - if ((R->Options & Opt_pointerBlank) - && (R->pointerBlankDelay > 0) - && (R->hidden_pointer == 0)) { - long pdelay; - - if (!tp.tv_sec) /* didn't get it before so get it now */ - (void)gettimeofday(&tp, NULL); - psdiff = (tp.tv_sec - R->lastmotion.tv_sec) * 1000000L - + tp.tv_usec - R->lastmotion.tv_usec; - pdelay = R->pointerBlankDelay * 1000000L; - if (psdiff >= pdelay) - rxvt_pointer_blank(aR); - else { - set_quick_timeout = 1; - psdiff = pdelay - psdiff; - } - } -# endif - if (!quick_timeout && set_quick_timeout) { - MIN_IT(csdiff, psdiff); - value.tv_sec = csdiff / 1000000L; - value.tv_usec = csdiff % 1000000L; - quick_timeout = 1; - } - } #endif +} - if ((select_res = select(R->num_fds, &readfds, NULL, NULL, - (quick_timeout ? &value : NULL))) == 0) { - /* select statement timed out - we're not hard and fast scrolling */ - R->refresh_limit = 1; - } -#if defined(CURSOR_BLINK) - if (R->Options & Opt_cursorBlink) - R->want_refresh = 1; -#endif - } +#ifdef POINTER_BLANK +void +rxvt_term::pointer_unblank () +{ + if (!(Options & Opt_pointerBlank)) + return; + + XDefineCursor (Xdisplay, TermWin.vt, TermWin_cursor); + rxvt_recolour_cursor (this); + hidden_pointer = 0; + + pointer_ev.start (NOW + pointerBlankDelay); } -/* EXTPROTO */ void -rxvt_pointer_unblank(pR) +rxvt_term::pointer_blank () { - XDefineCursor(R->Xdisplay, R->TermWin.vt, R->TermWin_cursor); - rxvt_recolour_cursor(aR); -#ifdef POINTER_BLANK - R->hidden_pointer = 0; - if (R->pointerBlankDelay > 0) { - struct timeval tp; + pointer_ev.stop (); - (void)gettimeofday(&tp, NULL); - R->lastmotion.tv_sec = tp.tv_sec; - R->lastmotion.tv_usec = tp.tv_usec; - } -#endif + if (!(Options & Opt_pointerBlank)) + return; + + XDefineCursor (Xdisplay, TermWin.vt, blank_cursor); + XFlush (Xdisplay); + + hidden_pointer = 1; } -#ifdef POINTER_BLANK -/* INTPROTO */ void -rxvt_pointer_blank(pR) +rxvt_term::pointer_cb (time_watcher &w) { - XDefineCursor(R->Xdisplay, R->TermWin.vt, R->pointer_blank); - XFlush(R->Xdisplay); - R->hidden_pointer = 1; + pointer_blank (); } #endif @@ -1558,7 +1452,7 @@ rxvt_process_x_event(pR_ XEvent *ev) case MotionNotify: #ifdef POINTER_BLANK if (R->hidden_pointer) - rxvt_pointer_unblank(aR); + R->pointer_unblank (); #endif #if MENUBAR if (isMenuBarWindow(ev->xany.window)) { diff --git a/src/init.C b/src/init.C index 91c9d7e7..520730d1 100644 --- a/src/init.C +++ b/src/init.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: init.c *----------------------------------------------------------------------* - * $Id: init.C,v 1.5 2003-11-25 15:44:38 pcg Exp $ + * $Id: init.C,v 1.6 2003-11-25 17:11:33 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey, University of Kent at Canterbury @@ -1079,10 +1079,6 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv) XCMAP = DefaultColormap(R->Xdisplay, Xscreen); XVISUAL = DefaultVisual(R->Xdisplay, Xscreen); -#ifdef POINTER_BLANK - static rxvt_color blackcolour; - blackcolour.set (r, 0, 0, 0); -#endif if (R->Options & Opt_transparent) { XGetWindowAttributes(R->Xdisplay, RootWindow(R->Xdisplay, Xscreen), &gattr); @@ -1166,13 +1162,20 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv) #if defined(HAVE_SCROLLBARS) || defined(MENUBAR) /* cursor (menuBar/scrollBar): Black-on-White */ - R->pointer_leftptr = XCreateFontCursor(R->Xdisplay, XC_left_ptr); + R->leftptr_cursor = XCreateFontCursor(R->Xdisplay, XC_left_ptr); #endif #ifdef POINTER_BLANK - R->pointer_blank = XCreateGlyphCursor(R->Xdisplay, R->TermWin.font->fid, - R->TermWin.font->fid, ' ', ' ', - &blackcolour, &blackcolour); + { + XColor blackcolour; + blackcolour.red = 0; + blackcolour.green = 0; + blackcolour.blue = 0; + Font f = XLoadFont (R->Xdisplay, "fixed"); + R->blank_cursor = XCreateGlyphCursor (R->Xdisplay, f, f, ' ', ' ', + &blackcolour, &blackcolour); + XUnloadFont (R->Xdisplay, f); + } #endif /* the vt window */ @@ -1186,7 +1189,9 @@ rxvt_Create_Windows(pR_ int argc, const char *const *argv) #ifdef DEBUG_X XStoreName(R->Xdisplay, R->TermWin.vt, "vt window"); #endif - rxvt_pointer_unblank(aR); + + R->pointer_unblank (); + vt_emask = (ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask); #ifdef POINTER_BLANK diff --git a/src/iom.C b/src/iom.C index 859ff9bd..7f093950 100644 --- a/src/iom.C +++ b/src/iom.C @@ -41,6 +41,8 @@ time_watcher::~time_watcher () { if (iom_valid) iom.unreg (this); + + at = TSTAMP_CANCEL; } io_watcher::~io_watcher () @@ -102,9 +104,8 @@ void io_manager::loop () // call it w->call (*w); - // re-add it if necessary - if (w->at >= 0) - reg (w); + if (w->at < 0) + unreg (w); } struct timeval to; diff --git a/src/main.C b/src/main.C index 660afdaf..c4e110e6 100644 --- a/src/main.C +++ b/src/main.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: main.c *----------------------------------------------------------------------* - * $Id: main.C,v 1.5 2003-11-25 15:44:38 pcg Exp $ + * $Id: main.C,v 1.6 2003-11-25 17:11:33 pcg Exp $ * * All portions of code are copyright by their respective author/s. * Copyright (c) 1992 John Bovey, University of Kent at Canterbury @@ -60,11 +60,14 @@ rxvt_term::operator delete (void *p, size_t s) } rxvt_term::rxvt_term () -: pty_ev (this, &rxvt_term::pty_cb), +: pty_ev (this, &rxvt_term::pty_cb), #ifdef CURSOR_BLINK - blink_ev (this, &rxvt_term::blink_cb), + blink_ev (this, &rxvt_term::blink_cb), #endif - x_ev (this, &rxvt_term::x_cb) +#ifdef POINTER_BLANK + pointer_ev (this, &rxvt_term::pointer_cb), +#endif + x_ev (this, &rxvt_term::x_cb) { cmdbuf_ptr = cmdbuf_endp = cmdbuf_base; } diff --git a/src/rxvt.h b/src/rxvt.h index 63cf20c2..0768bcb5 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1,5 +1,5 @@ /* - * $Id: rxvt.h,v 1.5 2003-11-25 15:44:39 pcg Exp $ + * $Id: rxvt.h,v 1.6 2003-11-25 17:11:33 pcg Exp $ */ #ifndef _RXVT_H_ /* include once only */ @@ -1020,9 +1020,9 @@ struct rxvt_term : rxvt_vars { gid_t egid; #endif /* ---------- */ - Cursor pointer_leftptr; + Cursor leftptr_cursor; #ifdef POINTER_BLANK - Cursor pointer_blank; + Cursor blank_cursor; #endif /* ---------- */ const char *ttydev; /* pty/tty name */ @@ -1122,6 +1122,12 @@ struct rxvt_term : rxvt_vars { void blink_cb (time_watcher &w); time_watcher blink_ev; #endif +#ifdef POINTER_BLANK + void pointer_cb (time_watcher &w); time_watcher pointer_ev; + void pointer_blank (); + void pointer_unblank (); +#endif + void flush (); rxvt_term (); diff --git a/src/scrollbar.C b/src/scrollbar.C index d3a916d6..32a3c254 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -1,7 +1,7 @@ /*--------------------------------*-C-*---------------------------------* * File: scrollbar.c *----------------------------------------------------------------------* - * $Id: scrollbar.C,v 1.3 2003-11-25 11:52:42 pcg Exp $ + * $Id: scrollbar.C,v 1.4 2003-11-25 17:11:33 pcg Exp $ * * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1998 Alfredo K. Kojima @@ -107,7 +107,7 @@ rxvt_Resize_scrollBar(pR) #ifdef DEBUG_X XStoreName(R->Xdisplay, R->scrollBar.win, "scrollbar"); #endif - XDefineCursor(R->Xdisplay, R->scrollBar.win, R->pointer_leftptr); + XDefineCursor(R->Xdisplay, R->scrollBar.win, R->leftptr_cursor); XSelectInput(R->Xdisplay, R->scrollBar.win, (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask