applying patch to consolidate non-GUI portion of hourglass implementation as posted...
authorAdrian Robert <Adrian.B.Robert@gmail.com>
Tue, 15 Jul 2008 13:04:01 +0000 (13:04 +0000)
committerAdrian Robert <Adrian.B.Robert@gmail.com>
Tue, 15 Jul 2008 13:04:01 +0000 (13:04 +0000)
src/ChangeLog
src/dispextern.h
src/macfns.c
src/w32fns.c
src/xdisp.c
src/xfns.c

index 85b81de..80eb85b 100644 (file)
@@ -1,3 +1,34 @@
+2008-07-15  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+        * dispextern.h (hourglass_shown_p, hourglass_atimer): New extern
+       variables (formerly in xxxfns.c).
+       (show_hourglass, hide_hourglass): New prototypes (same).
+       * xdisp.c (display_hourglass_p, hourglass_shown_p, hourglass_atimer)
+       (Vhourglass_delay, DEFAULT_HOURGLASS_DELAY): New variables (formerly
+       in xxxfns.c).
+       (syms_of_xdisp): Declare/initialize display-hourglass,
+       hourglass-delay.  Initialize hourglass_atimer, hourglass_shown_p.
+       (hourglass_started, start_hourglass, cancel_hourglass): New functions,
+       formerly in xxxfns.c.
+       * xfns.c (display_hourglass_p, hourglass_atimer, hourglass_shown_p)
+       (Vhourglass_delay, DEFAULT_HOURGLASS_DELAY, hourglass_started)
+       (start_hourglass, cancel_hourglass): Remove.
+       (show_hourglass, hide_hourglass): Remove prototypes and static
+       modifiers.
+       (syms_of_xfns): Remove display-hourglass, hourglass-delay,
+       hourglass_atimer, hourglass_shown_p declaration/initialization.
+       * macfns.c (display_hourglass_p, hourglass_atimer, hourglass_shown_p)
+       (Vhourglass_delay, DEFAULT_HOURGLASS_DELAY, hourglass_started)
+       (start_hourglass, cancel_hourglass): Remove.
+       (show_hourglass, hide_hourglass): Remove prototypes and static
+       modifiers.
+       (syms_of_macfns): Remove display-hourglass, hourglass-delay,
+       hourglass_atimer, hourglass_shown_p declaration/initialization.
+       * w32fns.c (display_hourglass_p, Vhourglass_delay)
+       (DEFAULT_HOURGLASS_DELAY): Remove.
+       (syms_of_w32fns): Remove display-hourglass, hourglass-delay,
+       hourglass_shown_p declaration/initialization.
+
 2008-07-14  Jason Rumney  <jasonr@gnu.org>
 
         * w32fns.c (w32_get_arg): Remove wrapper function.
index 041d54f..e606447 100644 (file)
@@ -2925,6 +2925,15 @@ extern void start_hourglass P_ ((void));
 extern void cancel_hourglass P_ ((void));
 extern int hourglass_started P_ ((void));
 extern int display_hourglass_p;
+extern int hourglass_shown_p;
+struct atimer;                 /* Defined in atimer.h.  */
+/* If non-null, an asynchronous timer that, when it expires, displays
+   an hourglass cursor on all frames.  */
+extern struct atimer *hourglass_atimer;
+
+/* Each GUI implements these.  PENDING: move into RIF. */
+extern void show_hourglass P_ ((struct atimer *));
+extern void hide_hourglass P_ ((void));
 
 /* Returns the background color of IMG, calculating one heuristically if
    necessary.  If non-zero, XIMG is an existing XImage object to use for
index 82153da..7bf50b3 100644 (file)
@@ -57,10 +57,6 @@ static Lisp_Object Vmac_carbon_version_string;
 
 #endif /* TARGET_API_MAC_CARBON */
 
-/* Non-zero means we're allowed to display an hourglass cursor.  */
-
-int display_hourglass_p;
-
 /* The background and shape of the mouse pointer, and shape when not
    over text or in the modeline.  */
 
@@ -3420,89 +3416,6 @@ value.  */)
                                Busy cursor
  ***********************************************************************/
 
-/* If non-null, an asynchronous timer that, when it expires, displays
-   an hourglass cursor on all frames.  */
-
-static struct atimer *hourglass_atimer;
-
-/* Non-zero means an hourglass cursor is currently shown.  */
-
-static int hourglass_shown_p;
-
-/* Number of seconds to wait before displaying an hourglass cursor.  */
-
-static Lisp_Object Vhourglass_delay;
-
-/* Default number of seconds to wait before displaying an hourglass
-   cursor.  */
-
-#define DEFAULT_HOURGLASS_DELAY 1
-
-/* Function prototypes.  */
-
-static void show_hourglass P_ ((struct atimer *));
-static void hide_hourglass P_ ((void));
-
-/* Return non-zero if houglass timer has been started or hourglass is shown.  */
-
-int
-hourglass_started ()
-{
-  return hourglass_shown_p || hourglass_atimer != NULL;
-}
-
-
-/* Cancel a currently active hourglass timer, and start a new one.  */
-
-void
-start_hourglass ()
-{
-#ifdef MAC_OSX
-  EMACS_TIME delay;
-  int secs, usecs = 0;
-
-  cancel_hourglass ();
-
-  if (INTEGERP (Vhourglass_delay)
-      && XINT (Vhourglass_delay) > 0)
-    secs = XFASTINT (Vhourglass_delay);
-  else if (FLOATP (Vhourglass_delay)
-          && XFLOAT_DATA (Vhourglass_delay) > 0)
-    {
-      Lisp_Object tem;
-      tem = Ftruncate (Vhourglass_delay, Qnil);
-      secs = XFASTINT (tem);
-      usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
-    }
-  else
-    secs = DEFAULT_HOURGLASS_DELAY;
-
-  EMACS_SET_SECS_USECS (delay, secs, usecs);
-  hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
-                                    show_hourglass, NULL);
-#endif /* MAC_OSX */
-}
-
-
-/* Cancel the hourglass cursor timer if active, hide a busy cursor if
-   shown.  */
-
-void
-cancel_hourglass ()
-{
-#ifdef MAC_OSX
-  if (hourglass_atimer)
-    {
-      cancel_atimer (hourglass_atimer);
-      hourglass_atimer = NULL;
-    }
-
-  if (hourglass_shown_p)
-    hide_hourglass ();
-#endif /* MAC_OSX */
-}
-
-
 /* Timer function of hourglass_atimer.  TIMER is equal to
    hourglass_atimer.
 
@@ -3510,7 +3423,7 @@ cancel_hourglass ()
    arrows) at the upper-right corner of each frame instead of the
    hourglass pointer.  */
 
-static void
+void
 show_hourglass (timer)
      struct atimer *timer;
 {
@@ -3545,7 +3458,7 @@ show_hourglass (timer)
 /* Hide the progress indicators on all frames, if it is currently
    shown.  */
 
-static void
+void
 hide_hourglass ()
 {
 #if TARGET_API_MAC_CARBON
@@ -4379,15 +4292,6 @@ This variable takes effect when you create a new frame
 or when you set the mouse color.  */);
   Vx_hourglass_pointer_shape = Qnil;
 
-  DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
-    doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);
-  display_hourglass_p = 1;
-
-  DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
-    doc: /* *Seconds to wait before displaying an hourglass pointer.
-Value must be an integer or float.  */);
-  Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
-
 #if 0 /* This doesn't really do anything.  */
   DEFVAR_LISP ("x-mode-pointer-shape", &Vx_mode_pointer_shape,
     doc: /* The shape of the pointer when over the mode line.
index eba776f..f01d7a5 100644 (file)
@@ -151,10 +151,6 @@ static int w32_pass_multimedia_buttons_to_system;
 /* Non nil if no window manager is in use.  */
 Lisp_Object Vx_no_window_manager;
 
-/* Non-zero means we're allowed to display a hourglass pointer.  */
-
-int display_hourglass_p;
-
 /* If non-zero, a w32 timer that, when it expires, displays an
    hourglass cursor on all frames.  */
 static unsigned hourglass_timer = 0;
@@ -5233,20 +5229,9 @@ value.  */)
                                Busy cursor
  ***********************************************************************/
 
-/* Non-zero means an hourglass cursor is currently shown.  */
-
-static int hourglass_shown_p;
-
-/* Number of seconds to wait before displaying an hourglass cursor.  */
-
-static Lisp_Object Vhourglass_delay;
-
-/* Default number of seconds to wait before displaying an hourglass
-   cursor.  */
-
-#define DEFAULT_HOURGLASS_DELAY 1
-
 /* Return non-zero if houglass timer has been started or hourglass is shown.  */
+/* PENDING: if W32 can use atimers (atimer.[hc]) then the common impl in
+           xdisp.c could be used. */
 
 int
 hourglass_started ()
@@ -7150,15 +7135,6 @@ This variable takes effect when you create a new frame
 or when you set the mouse color.  */);
   Vx_hourglass_pointer_shape = Qnil;
 
-  DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
-              doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);
-  display_hourglass_p = 1;
-
-  DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
-              doc: /* *Seconds to wait before displaying an hourglass pointer.
-Value must be an integer or float.  */);
-  Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
-
   DEFVAR_LISP ("x-sensitive-text-pointer-shape",
               &Vx_sensitive_text_pointer_shape,
               doc: /* The shape of the pointer when over mouse-sensitive text.
@@ -7274,7 +7250,7 @@ only be necessary if the default setting causes problems.  */);
 
   hourglass_timer = 0;
   hourglass_hwnd = NULL;
-  hourglass_shown_p = 0;
+
   defsubr (&Sx_show_tip);
   defsubr (&Sx_hide_tip);
   tip_timer = Qnil;
index f5dfd54..f6d0d85 100644 (file)
@@ -852,6 +852,25 @@ Lisp_Object previous_help_echo_string;
 
 static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
 
+/* Platform-independent portion of hourglass implementation. */
+
+/* Non-zero means we're allowed to display a hourglass pointer.  */
+int display_hourglass_p;
+
+/* Non-zero means an hourglass cursor is currently shown.  */
+int hourglass_shown_p;
+
+/* If non-null, an asynchronous timer that, when it expires, displays
+    an hourglass cursor on all frames.  */
+struct atimer *hourglass_atimer;
+
+/* Number of seconds to wait before displaying an hourglass cursor.  */
+static Lisp_Object Vhourglass_delay;
+
+/* Default number of seconds to wait before displaying an hourglass
+   cursor.  */
+#define DEFAULT_HOURGLASS_DELAY 1
+
 \f
 /* Function prototypes.  */
 
@@ -25143,6 +25162,18 @@ particularly when using variable `x-use-underline-position-properties'
 with fonts that specify an UNDERLINE_POSITION relatively close to the
 baseline.  The default value is 1.  */);
   underline_minimum_offset = 1;
+
+  DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
+              doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);
+  display_hourglass_p = 1;
+
+  DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
+              doc: /* *Seconds to wait before displaying an hourglass pointer.
+Value must be an integer or float.  */);
+  Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
+
+  hourglass_atimer = NULL;
+  hourglass_shown_p = 0;
 }
 
 
@@ -25198,6 +25229,64 @@ init_xdisp ()
   help_echo_showing_p = 0;
 }
 
+/* Platform-independent portion of hourglass implementation. */
+
+/* Return non-zero if houglass timer has been started or hourglass is shown.  */
+int
+hourglass_started ()
+{
+  return hourglass_shown_p || hourglass_atimer != NULL;
+}
+
+
+/* Cancel a currently active hourglass timer, and start a new one.  */
+void
+start_hourglass ()
+{
+#if defined (HAVE_WINDOW_SYSTEM)
+  EMACS_TIME delay;
+  int secs, usecs = 0;
+
+  cancel_hourglass ();
+
+  if (INTEGERP (Vhourglass_delay)
+      && XINT (Vhourglass_delay) > 0)
+    secs = XFASTINT (Vhourglass_delay);
+  else if (FLOATP (Vhourglass_delay)
+          && XFLOAT_DATA (Vhourglass_delay) > 0)
+    {
+      Lisp_Object tem;
+      tem = Ftruncate (Vhourglass_delay, Qnil);
+      secs = XFASTINT (tem);
+      usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
+    }
+  else
+    secs = DEFAULT_HOURGLASS_DELAY;
+
+  EMACS_SET_SECS_USECS (delay, secs, usecs);
+  hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
+                                  show_hourglass, NULL);
+#endif
+}
+
+
+/* Cancel the hourglass cursor timer if active, hide a busy cursor if
+   shown.  */
+void
+cancel_hourglass ()
+{
+#if defined (HAVE_WINDOW_SYSTEM)
+  if (hourglass_atimer)
+    {
+      cancel_atimer (hourglass_atimer);
+      hourglass_atimer = NULL;
+    }
+
+  if (hourglass_shown_p)
+    hide_hourglass ();
+#endif
+}
+
 
 /* arch-tag: eacc864d-bb6a-4b74-894a-1a4399a1358b
    (do not change this comment) */
index 80e6f8d..6aeb04b 100644 (file)
@@ -149,10 +149,6 @@ int gray_bitmap_width = gray_width;
 int gray_bitmap_height = gray_height;
 char *gray_bitmap_bits = gray_bits;
 
-/* Non-zero means we're allowed to display an hourglass cursor.  */
-
-int display_hourglass_p;
-
 /* Non-zero means prompt with the old GTK file selection dialog.  */
 
 int x_gtk_use_old_file_dialog;
@@ -4472,85 +4468,6 @@ no value of TYPE.  */)
                                Busy cursor
  ***********************************************************************/
 
-/* If non-null, an asynchronous timer that, when it expires, displays
-   an hourglass cursor on all frames.  */
-
-static struct atimer *hourglass_atimer;
-
-/* Non-zero means an hourglass cursor is currently shown.  */
-
-static int hourglass_shown_p;
-
-/* Number of seconds to wait before displaying an hourglass cursor.  */
-
-static Lisp_Object Vhourglass_delay;
-
-/* Default number of seconds to wait before displaying an hourglass
-   cursor.  */
-
-#define DEFAULT_HOURGLASS_DELAY 1
-
-/* Function prototypes.  */
-
-static void show_hourglass P_ ((struct atimer *));
-static void hide_hourglass P_ ((void));
-
-/* Return non-zero if houglass timer has been started or hourglass is shown.  */
-
-int
-hourglass_started ()
-{
-  return hourglass_shown_p || hourglass_atimer != NULL;
-}
-
-
-/* Cancel a currently active hourglass timer, and start a new one.  */
-
-void
-start_hourglass ()
-{
-  EMACS_TIME delay;
-  int secs, usecs = 0;
-
-  cancel_hourglass ();
-
-  if (INTEGERP (Vhourglass_delay)
-      && XINT (Vhourglass_delay) > 0)
-    secs = XFASTINT (Vhourglass_delay);
-  else if (FLOATP (Vhourglass_delay)
-          && XFLOAT_DATA (Vhourglass_delay) > 0)
-    {
-      Lisp_Object tem;
-      tem = Ftruncate (Vhourglass_delay, Qnil);
-      secs = XFASTINT (tem);
-      usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
-    }
-  else
-    secs = DEFAULT_HOURGLASS_DELAY;
-
-  EMACS_SET_SECS_USECS (delay, secs, usecs);
-  hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
-                                    show_hourglass, NULL);
-}
-
-
-/* Cancel the hourglass cursor timer if active, hide a busy cursor if
-   shown.  */
-
-void
-cancel_hourglass ()
-{
-  if (hourglass_atimer)
-    {
-      cancel_atimer (hourglass_atimer);
-      hourglass_atimer = NULL;
-    }
-
-  if (hourglass_shown_p)
-    hide_hourglass ();
-}
-
-
 /* Timer function of hourglass_atimer.  TIMER is equal to
    hourglass_atimer.
 
@@ -4559,7 +4476,7 @@ cancel_hourglass ()
    output_data.x structure to indicate that an hourglass cursor is
    shown on the frames.  */
 
-static void
+void
 show_hourglass (timer)
      struct atimer *timer;
 {
@@ -4624,7 +4541,7 @@ show_hourglass (timer)
 /* Hide the hourglass pointer on all frames, if it is currently
    shown.  */
 
-static void
+void
 hide_hourglass ()
 {
   if (hourglass_shown_p)
@@ -5905,15 +5822,6 @@ This variable takes effect when you create a new frame
 or when you set the mouse color.  */);
   Vx_hourglass_pointer_shape = Qnil;
 
-  DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
-    doc: /* Non-zero means Emacs displays an hourglass pointer on window systems.  */);
-  display_hourglass_p = 1;
-
-  DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
-    doc: /* *Seconds to wait before displaying an hourglass pointer.
-Value must be an integer or float.  */);
-  Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
-
 #if 0 /* This doesn't really do anything.  */
   DEFVAR_LISP ("x-mode-pointer-shape", &Vx_mode_pointer_shape,
     doc: /* The shape of the pointer when over the mode line.
@@ -6053,9 +5961,6 @@ the tool bar buttons.  */);
   /* Setting callback functions for fontset handler.  */
   check_window_system_func = check_x;
 
-  hourglass_atimer = NULL;
-  hourglass_shown_p = 0;
-
   defsubr (&Sx_show_tip);
   defsubr (&Sx_hide_tip);
   tip_timer = Qnil;