*** empty log message ***
authorpcg <pcg>
Tue, 25 Nov 2003 17:11:32 +0000 (17:11 +0000)
committerpcg <pcg>
Tue, 25 Nov 2003 17:11:32 +0000 (17:11 +0000)
reconf
src/command.C
src/init.C
src/iom.C
src/main.C
src/rxvt.h
src/scrollbar.C

diff --git a/reconf b/reconf
index fbf251482acefce917a92b3c911122de1d7ee38b..a2a7bd91dbf72b13fd1a8f1ad0539132690eb67e 100755 (executable)
--- 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
index 9c52d49a19959d11570803fa6f5e0e8ed1d557ce..4fea5cdf28d482ac6538abd9f7b11d3a7900f260 100644 (file)
@@ -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 <jdb@ukc.ac.uk>
@@ -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)) {
index 91c9d7e7bded149ac59f1a9e766fb294c3605f3b..520730d18f99d04539e42814e6ef9e75b16fee5b 100644 (file)
@@ -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 <jdb@ukc.ac.uk>
@@ -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
index 859ff9bdc47f360768bbf57d55bb369c8e9d0449..7f0939505e3caf38826c9bfb4ccda65da6670d39 100644 (file)
--- 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;
index 660afdaf1d42cff9a1afddc170345eaacd3f29d3..c4e110e62e2cbf5933560880eee891fb0dc56b1e 100644 (file)
@@ -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 <jdb@ukc.ac.uk>
@@ -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;
 }
index 63cf20c2fe8aa4626e54f84fc6ab19d1c001541d..0768bcb58869ab7548da56ccd8959899b58af959 100644 (file)
@@ -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 ();
index d3a916d60ef686ad53ba53eca35c496cc8c84089..32a3c2542ee0fc15f68e75e33ab6ac065b0f456a 100644 (file)
@@ -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 <olesen@me.QueensU.CA>
  * Copyright (c) 1998      Alfredo K. Kojima <kojima@windowmaker.org>
@@ -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