aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-03-19 17:04:18 +0000
committerJason Rumney2008-03-19 17:04:18 +0000
commitd148e14dc586e5f94e158c7396588b8183e42ceb (patch)
treec32cad07b7b8aa8404fe26ec522db8de52b26f87 /src
parentcdf8b62f427dc64e3b70a4d5a5602a69f427f1c8 (diff)
downloademacs-d148e14dc586e5f94e158c7396588b8183e42ceb.tar.gz
emacs-d148e14dc586e5f94e158c7396588b8183e42ceb.zip
* w32fns.c (hourglass_timer, hourglass_hwnd): New variables.
(syms_of_w32fns): Initialize them. (HOURGLASS_ID): New constant. (x_window_to_frame): Don't check hourglass_window. (w32_wnd_proc) <WM_TIMER>: Handle hourglass_timer. (w32_wnd_proc) <WM_EXITMENULOOP>: Set pending hourglass cursor. (w32_wnd_proc) <WM_SETCURSOR>: Set the hourglass or current cursor. (w32_wnd_proc) <WM_EMACS_SETCURSOR>: Set frame's current_cursor. Only change the cursor if hourglass is not active. (Fx_create_frame): Initialize frame's current_cursor. (hourglass_atimer): Remove. (hourglass_started): New function. (start_hourglass, cancel_hourglass, hide_hourglass): Adapt to w32. (show_hourglass): Adapt to w32, changing argument to frame. * w32term.h (struct w32_output): Remove hourglass_window. Add current_cursor. * eval.c (call_debugger, Fsignal): * keyboard.c (recursive_edit_1, cmd_error, Ftop_level) (command_loop_1, Fread_key_sequence, Fread_key_sequence_vector) (Fexecute_extended_command, cancel_hourglass_unwind): * minibuf.c (read_minibuf): * fns.c (Fy_or_n_p): Enable hourglass when HAVE_WINDOW_SYSTEM.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog35
-rw-r--r--src/eval.c4
-rw-r--r--src/fns.c2
-rw-r--r--src/keyboard.c24
-rw-r--r--src/minibuf.c2
-rw-r--r--src/w32fns.c167
-rw-r--r--src/w32term.h7
7 files changed, 115 insertions, 126 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 875e8b79434..9fd8d692db6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,12 +1,29 @@
12008-03-19 Stefan Monnier <monnier@iro.umontreal.ca> 12008-03-19 Jason Rumney <jasonr@gnu.org>
2 2
3 * window.c (run_funs): New fun. 3 * w32fns.c (hourglass_timer, hourglass_hwnd): New variables.
4 (run_window_configuration_change_hook): Use it to run the buffer-local 4 (syms_of_w32fns): Initialize them.
5 and the global part of the hook. 5 (HOURGLASS_ID): New constant.
6 6 (x_window_to_frame): Don't check hourglass_window.
7 * xdisp.c (format_mode_line_unwind_data): Add window argument. 7 (w32_wnd_proc) <WM_TIMER>: Handle hourglass_timer.
8 (unwind_format_mode_line): Restore selected window. 8 (w32_wnd_proc) <WM_EXITMENULOOP>: Set pending hourglass cursor.
9 (x_consider_frame_title, Fformat_mode_line): Set selected window. 9 (w32_wnd_proc) <WM_SETCURSOR>: Set the hourglass or current cursor.
10 (w32_wnd_proc) <WM_EMACS_SETCURSOR>: Set frame's current_cursor.
11 Only change the cursor if hourglass is not active.
12 (Fx_create_frame): Initialize frame's current_cursor.
13 (hourglass_atimer): Remove.
14 (hourglass_started): New function.
15 (start_hourglass, cancel_hourglass, hide_hourglass): Adapt to w32.
16 (show_hourglass): Adapt to w32, changing argument to frame.
17
18 * w32term.h (struct w32_output): Remove hourglass_window.
19 Add current_cursor.
20
21 * eval.c (call_debugger, Fsignal):
22 * keyboard.c (recursive_edit_1, cmd_error, Ftop_level)
23 (command_loop_1, Fread_key_sequence, Fread_key_sequence_vector)
24 (Fexecute_extended_command, cancel_hourglass_unwind):
25 * minibuf.c (read_minibuf):
26 * fns.c (Fy_or_n_p): Enable hourglass when HAVE_WINDOW_SYSTEM.
10 27
112008-03-17 Stefan Monnier <monnier@iro.umontreal.ca> 282008-03-17 Stefan Monnier <monnier@iro.umontreal.ca>
12 29
diff --git a/src/eval.c b/src/eval.c
index 38cf87b509a..62fe01592e6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -283,7 +283,7 @@ call_debugger (arg)
283 if (SPECPDL_INDEX () + 100 > max_specpdl_size) 283 if (SPECPDL_INDEX () + 100 > max_specpdl_size)
284 max_specpdl_size = SPECPDL_INDEX () + 100; 284 max_specpdl_size = SPECPDL_INDEX () + 100;
285 285
286#ifdef HAVE_X_WINDOWS 286#ifdef HAVE_WINDOW_SYSTEM
287 if (display_hourglass_p) 287 if (display_hourglass_p)
288 cancel_hourglass (); 288 cancel_hourglass ();
289#endif 289#endif
@@ -1640,7 +1640,7 @@ See also the function `condition-case'. */)
1640 1640
1641#if 0 /* rms: I don't know why this was here, 1641#if 0 /* rms: I don't know why this was here,
1642 but it is surely wrong for an error that is handled. */ 1642 but it is surely wrong for an error that is handled. */
1643#ifdef HAVE_X_WINDOWS 1643#ifdef HAVE_WINDOW_SYSTEM
1644 if (display_hourglass_p) 1644 if (display_hourglass_p)
1645 cancel_hourglass (); 1645 cancel_hourglass ();
1646#endif 1646#endif
diff --git a/src/fns.c b/src/fns.c
index e0da65a93df..e89fbbc2801 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2600,7 +2600,7 @@ is nil and `use-dialog-box' is non-nil. */)
2600 xprompt = prompt; 2600 xprompt = prompt;
2601 GCPRO2 (prompt, xprompt); 2601 GCPRO2 (prompt, xprompt);
2602 2602
2603#ifdef HAVE_X_WINDOWS 2603#ifdef HAVE_WINDOW_SYSTEM
2604 if (display_hourglass_p) 2604 if (display_hourglass_p)
2605 cancel_hourglass (); 2605 cancel_hourglass ();
2606#endif 2606#endif
diff --git a/src/keyboard.c b/src/keyboard.c
index 16b9006b15f..cdcf4c6b608 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -935,7 +935,7 @@ recursive_edit_1 ()
935 specbind (Qstandard_input, Qt); 935 specbind (Qstandard_input, Qt);
936 } 936 }
937 937
938#ifdef HAVE_X_WINDOWS 938#ifdef HAVE_WINDOW_SYSTEM
939 /* The command loop has started an hourglass timer, so we have to 939 /* The command loop has started an hourglass timer, so we have to
940 cancel it here, otherwise it will fire because the recursive edit 940 cancel it here, otherwise it will fire because the recursive edit
941 can take some time. Do not check for display_hourglass_p here, 941 can take some time. Do not check for display_hourglass_p here,
@@ -1220,7 +1220,7 @@ cmd_error (data)
1220 Lisp_Object old_level, old_length; 1220 Lisp_Object old_level, old_length;
1221 char macroerror[50]; 1221 char macroerror[50];
1222 1222
1223#ifdef HAVE_X_WINDOWS 1223#ifdef HAVE_WINDOW_SYSTEM
1224 if (display_hourglass_p) 1224 if (display_hourglass_p)
1225 cancel_hourglass (); 1225 cancel_hourglass ();
1226#endif 1226#endif
@@ -1396,7 +1396,7 @@ DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "",
1396 doc: /* Exit all recursive editing levels. */) 1396 doc: /* Exit all recursive editing levels. */)
1397 () 1397 ()
1398{ 1398{
1399#ifdef HAVE_X_WINDOWS 1399#ifdef HAVE_WINDOW_SYSTEM
1400 if (display_hourglass_p) 1400 if (display_hourglass_p)
1401 cancel_hourglass (); 1401 cancel_hourglass ();
1402#endif 1402#endif
@@ -1519,7 +1519,7 @@ static void adjust_point_for_property P_ ((int, int));
1519 1519
1520/* Cancel hourglass from protect_unwind. 1520/* Cancel hourglass from protect_unwind.
1521 ARG is not used. */ 1521 ARG is not used. */
1522#ifdef HAVE_X_WINDOWS 1522#ifdef HAVE_WINDOW_SYSTEM
1523static Lisp_Object 1523static Lisp_Object
1524cancel_hourglass_unwind (arg) 1524cancel_hourglass_unwind (arg)
1525 Lisp_Object arg; 1525 Lisp_Object arg;
@@ -1891,7 +1891,7 @@ command_loop_1 ()
1891 /* Here for a command that isn't executed directly */ 1891 /* Here for a command that isn't executed directly */
1892 1892
1893 { 1893 {
1894#ifdef HAVE_X_WINDOWS 1894#ifdef HAVE_WINDOW_SYSTEM
1895 int scount = SPECPDL_INDEX (); 1895 int scount = SPECPDL_INDEX ();
1896 1896
1897 if (display_hourglass_p 1897 if (display_hourglass_p
@@ -1907,7 +1907,7 @@ command_loop_1 ()
1907 Fundo_boundary (); 1907 Fundo_boundary ();
1908 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); 1908 Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil);
1909 1909
1910#ifdef HAVE_X_WINDOWS 1910#ifdef HAVE_WINDOW_SYSTEM
1911 /* Do not check display_hourglass_p here, because 1911 /* Do not check display_hourglass_p here, because
1912 Fcommand_execute could change it, but we should cancel 1912 Fcommand_execute could change it, but we should cancel
1913 hourglass cursor anyway. 1913 hourglass cursor anyway.
@@ -10273,7 +10273,7 @@ will read just one key sequence. */)
10273 this_single_command_key_start = 0; 10273 this_single_command_key_start = 0;
10274 } 10274 }
10275 10275
10276#ifdef HAVE_X_WINDOWS 10276#ifdef HAVE_WINDOW_SYSTEM
10277 if (display_hourglass_p) 10277 if (display_hourglass_p)
10278 cancel_hourglass (); 10278 cancel_hourglass ();
10279#endif 10279#endif
@@ -10285,7 +10285,7 @@ will read just one key sequence. */)
10285#if 0 /* The following is fine for code reading a key sequence and 10285#if 0 /* The following is fine for code reading a key sequence and
10286 then proceeding with a lenghty computation, but it's not good 10286 then proceeding with a lenghty computation, but it's not good
10287 for code reading keys in a loop, like an input method. */ 10287 for code reading keys in a loop, like an input method. */
10288#ifdef HAVE_X_WINDOWS 10288#ifdef HAVE_WINDOW_SYSTEM
10289 if (display_hourglass_p) 10289 if (display_hourglass_p)
10290 start_hourglass (); 10290 start_hourglass ();
10291#endif 10291#endif
@@ -10333,7 +10333,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10333 this_single_command_key_start = 0; 10333 this_single_command_key_start = 0;
10334 } 10334 }
10335 10335
10336#ifdef HAVE_X_WINDOWS 10336#ifdef HAVE_WINDOW_SYSTEM
10337 if (display_hourglass_p) 10337 if (display_hourglass_p)
10338 cancel_hourglass (); 10338 cancel_hourglass ();
10339#endif 10339#endif
@@ -10342,7 +10342,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10342 prompt, ! NILP (dont_downcase_last), 10342 prompt, ! NILP (dont_downcase_last),
10343 ! NILP (can_return_switch_frame), 0); 10343 ! NILP (can_return_switch_frame), 0);
10344 10344
10345#ifdef HAVE_X_WINDOWS 10345#ifdef HAVE_WINDOW_SYSTEM
10346 if (display_hourglass_p) 10346 if (display_hourglass_p)
10347 start_hourglass (); 10347 start_hourglass ();
10348#endif 10348#endif
@@ -10465,7 +10465,7 @@ give to the command you invoke, if it asks for an argument. */)
10465 Lisp_Object saved_keys, saved_last_point_position_buffer; 10465 Lisp_Object saved_keys, saved_last_point_position_buffer;
10466 Lisp_Object bindings, value; 10466 Lisp_Object bindings, value;
10467 struct gcpro gcpro1, gcpro2, gcpro3; 10467 struct gcpro gcpro1, gcpro2, gcpro3;
10468#ifdef HAVE_X_WINDOWS 10468#ifdef HAVE_WINDOW_SYSTEM
10469 /* The call to Fcompleting_read wil start and cancel the hourglass, 10469 /* The call to Fcompleting_read wil start and cancel the hourglass,
10470 but if the hourglass was already scheduled, this means that no 10470 but if the hourglass was already scheduled, this means that no
10471 hourglass will be shown for the actual M-x command itself. 10471 hourglass will be shown for the actual M-x command itself.
@@ -10505,7 +10505,7 @@ give to the command you invoke, if it asks for an argument. */)
10505 Qt, Qnil, Qextended_command_history, Qnil, 10505 Qt, Qnil, Qextended_command_history, Qnil,
10506 Qnil); 10506 Qnil);
10507 10507
10508#ifdef HAVE_X_WINDOWS 10508#ifdef HAVE_WINDOW_SYSTEM
10509 if (hstarted) start_hourglass (); 10509 if (hstarted) start_hourglass ();
10510#endif 10510#endif
10511 10511
diff --git a/src/minibuf.c b/src/minibuf.c
index 86dd095fa21..724de3fc713 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -497,7 +497,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
497 if (EQ (Vminibuffer_completing_file_name, Qlambda)) 497 if (EQ (Vminibuffer_completing_file_name, Qlambda))
498 Vminibuffer_completing_file_name = Qnil; 498 Vminibuffer_completing_file_name = Qnil;
499 499
500#ifdef HAVE_X_WINDOWS 500#ifdef HAVE_WINDOW_SYSTEM
501 if (display_hourglass_p) 501 if (display_hourglass_p)
502 cancel_hourglass (); 502 cancel_hourglass ();
503#endif 503#endif
diff --git a/src/w32fns.c b/src/w32fns.c
index d88e86d54f6..ed5decdc868 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -154,6 +154,11 @@ Lisp_Object Vx_no_window_manager;
154 154
155int display_hourglass_p; 155int display_hourglass_p;
156 156
157/* If non-zero, a w32 timer that, when it expires, displays an
158 hourglass cursor on all frames. */
159static unsigned hourglass_timer = 0;
160static HWND hourglass_hwnd = NULL;
161
157/* The background and shape of the mouse pointer, and shape when not 162/* The background and shape of the mouse pointer, and shape when not
158 over text or in the modeline. */ 163 over text or in the modeline. */
159 164
@@ -304,6 +309,7 @@ unsigned int msh_mousewheel = 0;
304#define MOUSE_BUTTON_ID 1 309#define MOUSE_BUTTON_ID 1
305#define MOUSE_MOVE_ID 2 310#define MOUSE_MOVE_ID 2
306#define MENU_FREE_ID 3 311#define MENU_FREE_ID 3
312#define HOURGLASS_ID 4
307/* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP 313/* The delay (milliseconds) before a menu is freed after WM_EXITMENULOOP
308 is received. */ 314 is received. */
309#define MENU_FREE_DELAY 1000 315#define MENU_FREE_DELAY 1000
@@ -335,6 +341,11 @@ static HWND w32_visible_system_caret_hwnd;
335extern HMENU current_popup_menu; 341extern HMENU current_popup_menu;
336static int menubar_in_use = 0; 342static int menubar_in_use = 0;
337 343
344/* Function prototypes for hourglass support. */
345static void show_hourglass P_ ((struct frame *));
346static void hide_hourglass P_ ((void));
347
348
338 349
339/* Error if we are not connected to MS-Windows. */ 350/* Error if we are not connected to MS-Windows. */
340void 351void
@@ -423,8 +434,6 @@ x_window_to_frame (dpyinfo, wdesc)
423 f = XFRAME (frame); 434 f = XFRAME (frame);
424 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) 435 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
425 continue; 436 continue;
426 if (f->output_data.w32->hourglass_window == wdesc)
427 return f;
428 437
429 if (FRAME_W32_WINDOW (f) == wdesc) 438 if (FRAME_W32_WINDOW (f) == wdesc)
430 return f; 439 return f;
@@ -3525,6 +3534,12 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3525 menubar_in_use = 0; 3534 menubar_in_use = 0;
3526 } 3535 }
3527 } 3536 }
3537 else if (wParam == hourglass_timer)
3538 {
3539 KillTimer (hwnd, hourglass_timer);
3540 hourglass_timer = 0;
3541 show_hourglass (x_window_to_frame (dpyinfo, hwnd));
3542 }
3528 return 0; 3543 return 0;
3529 3544
3530 case WM_NCACTIVATE: 3545 case WM_NCACTIVATE:
@@ -3590,6 +3605,11 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3590 */ 3605 */
3591 if (f && menubar_in_use && current_popup_menu == NULL) 3606 if (f && menubar_in_use && current_popup_menu == NULL)
3592 menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL); 3607 menu_free_timer = SetTimer (hwnd, MENU_FREE_ID, MENU_FREE_DELAY, NULL);
3608
3609 /* If hourglass cursor should be displayed, display it now. */
3610 if (f && f->output_data.w32->hourglass_p)
3611 SetCursor (f->output_data.w32->hourglass_cursor);
3612
3593 goto dflt; 3613 goto dflt;
3594 3614
3595 case WM_MENUSELECT: 3615 case WM_MENUSELECT:
@@ -3858,15 +3878,27 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3858 3878
3859 case WM_SETCURSOR: 3879 case WM_SETCURSOR:
3860 if (LOWORD (lParam) == HTCLIENT) 3880 if (LOWORD (lParam) == HTCLIENT)
3861 return 0; 3881 {
3862 3882 f = x_window_to_frame (dpyinfo, hwnd);
3883 if (f->output_data.w32->hourglass_p && !menubar_in_use
3884 && !current_popup_menu)
3885 SetCursor (f->output_data.w32->hourglass_cursor);
3886 else
3887 SetCursor (f->output_data.w32->current_cursor);
3888 return 0;
3889 }
3863 goto dflt; 3890 goto dflt;
3864 3891
3865 case WM_EMACS_SETCURSOR: 3892 case WM_EMACS_SETCURSOR:
3866 { 3893 {
3867 Cursor cursor = (Cursor) wParam; 3894 Cursor cursor = (Cursor) wParam;
3868 if (cursor) 3895 f = x_window_to_frame (dpyinfo, hwnd);
3869 SetCursor (cursor); 3896 if (f && cursor)
3897 {
3898 f->output_data.w32->current_cursor = cursor;
3899 if (!f->output_data.w32->hourglass_p)
3900 SetCursor (cursor);
3901 }
3870 return 0; 3902 return 0;
3871 } 3903 }
3872 3904
@@ -4528,6 +4560,8 @@ This function is an internal primitive--use `make-frame' instead. */)
4528 f->output_data.w32->hourglass_cursor = w32_load_cursor (IDC_WAIT); 4560 f->output_data.w32->hourglass_cursor = w32_load_cursor (IDC_WAIT);
4529 f->output_data.w32->horizontal_drag_cursor = w32_load_cursor (IDC_SIZEWE); 4561 f->output_data.w32->horizontal_drag_cursor = w32_load_cursor (IDC_SIZEWE);
4530 4562
4563 f->output_data.w32->current_cursor = f->output_data.w32->nontext_cursor;
4564
4531 window_prompting = x_figure_window_size (f, parameters, 1); 4565 window_prompting = x_figure_window_size (f, parameters, 1);
4532 4566
4533 tem = w32_get_arg (parameters, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 4567 tem = w32_get_arg (parameters, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
@@ -7216,11 +7250,6 @@ value. */)
7216 Busy cursor 7250 Busy cursor
7217 ***********************************************************************/ 7251 ***********************************************************************/
7218 7252
7219/* If non-null, an asynchronous timer that, when it expires, displays
7220 an hourglass cursor on all frames. */
7221
7222static struct atimer *hourglass_atimer;
7223
7224/* Non-zero means an hourglass cursor is currently shown. */ 7253/* Non-zero means an hourglass cursor is currently shown. */
7225 7254
7226static int hourglass_shown_p; 7255static int hourglass_shown_p;
@@ -7234,20 +7263,22 @@ static Lisp_Object Vhourglass_delay;
7234 7263
7235#define DEFAULT_HOURGLASS_DELAY 1 7264#define DEFAULT_HOURGLASS_DELAY 1
7236 7265
7237/* Function prototypes. */ 7266/* Return non-zero if houglass timer has been started or hourglass is shown. */
7238
7239static void show_hourglass P_ ((struct atimer *));
7240static void hide_hourglass P_ ((void));
7241 7267
7268int
7269hourglass_started ()
7270{
7271 return hourglass_shown_p || hourglass_timer;
7272}
7242 7273
7243/* Cancel a currently active hourglass timer, and start a new one. */ 7274/* Cancel a currently active hourglass timer, and start a new one. */
7244 7275
7245void 7276void
7246start_hourglass () 7277start_hourglass ()
7247{ 7278{
7248#if 0 /* TODO: cursor shape changes. */ 7279 DWORD delay;
7249 EMACS_TIME delay; 7280 int secs, msecs = 0;
7250 int secs, usecs = 0; 7281 struct frame * f = SELECTED_FRAME ();
7251 7282
7252 cancel_hourglass (); 7283 cancel_hourglass ();
7253 7284
@@ -7260,15 +7291,14 @@ start_hourglass ()
7260 Lisp_Object tem; 7291 Lisp_Object tem;
7261 tem = Ftruncate (Vhourglass_delay, Qnil); 7292 tem = Ftruncate (Vhourglass_delay, Qnil);
7262 secs = XFASTINT (tem); 7293 secs = XFASTINT (tem);
7263 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000; 7294 msecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000;
7264 } 7295 }
7265 else 7296 else
7266 secs = DEFAULT_HOURGLASS_DELAY; 7297 secs = DEFAULT_HOURGLASS_DELAY;
7267 7298
7268 EMACS_SET_SECS_USECS (delay, secs, usecs); 7299 delay = secs * 1000 + msecs;
7269 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, 7300 hourglass_hwnd = FRAME_W32_WINDOW (f);
7270 show_hourglass, NULL); 7301 hourglass_timer = SetTimer (hourglass_hwnd, HOURGLASS_ID, delay, NULL);
7271#endif
7272} 7302}
7273 7303
7274 7304
@@ -7278,10 +7308,10 @@ start_hourglass ()
7278void 7308void
7279cancel_hourglass () 7309cancel_hourglass ()
7280{ 7310{
7281 if (hourglass_atimer) 7311 if (hourglass_timer)
7282 { 7312 {
7283 cancel_atimer (hourglass_atimer); 7313 KillTimer (hourglass_hwnd, hourglass_timer);
7284 hourglass_atimer = NULL; 7314 hourglass_timer = 0;
7285 } 7315 }
7286 7316
7287 if (hourglass_shown_p) 7317 if (hourglass_shown_p)
@@ -7289,62 +7319,22 @@ cancel_hourglass ()
7289} 7319}
7290 7320
7291 7321
7292/* Timer function of hourglass_atimer. TIMER is equal to 7322/* Timer function of hourglass_timer.
7293 hourglass_atimer.
7294 7323
7295 Display an hourglass cursor on all frames by mapping the frames' 7324 Display an hourglass cursor. Set the hourglass_p flag in display info
7296 hourglass_window. Set the hourglass_p flag in the frames' 7325 to indicate that an hourglass cursor is shown. */
7297 output_data.x structure to indicate that an hourglass cursor is
7298 shown on the frames. */
7299 7326
7300static void 7327static void
7301show_hourglass (timer) 7328show_hourglass (f)
7302 struct atimer *timer; 7329 struct frame *f;
7303{ 7330{
7304#if 0 /* TODO: cursor shape changes. */
7305 /* The timer implementation will cancel this timer automatically
7306 after this function has run. Set hourglass_atimer to null
7307 so that we know the timer doesn't have to be canceled. */
7308 hourglass_atimer = NULL;
7309
7310 if (!hourglass_shown_p) 7331 if (!hourglass_shown_p)
7311 { 7332 {
7312 Lisp_Object rest, frame; 7333 f->output_data.w32->hourglass_p = 1;
7313 7334 if (!menubar_in_use && !current_popup_menu)
7314 BLOCK_INPUT; 7335 SetCursor (f->output_data.w32->hourglass_cursor);
7315
7316 FOR_EACH_FRAME (rest, frame)
7317 if (FRAME_W32_P (XFRAME (frame)))
7318 {
7319 struct frame *f = XFRAME (frame);
7320
7321 f->output_data.w32->hourglass_p = 1;
7322
7323 if (!f->output_data.w32->hourglass_window)
7324 {
7325 unsigned long mask = CWCursor;
7326 XSetWindowAttributes attrs;
7327
7328 attrs.cursor = f->output_data.w32->hourglass_cursor;
7329
7330 f->output_data.w32->hourglass_window
7331 = XCreateWindow (FRAME_X_DISPLAY (f),
7332 FRAME_OUTER_WINDOW (f),
7333 0, 0, 32000, 32000, 0, 0,
7334 InputOnly,
7335 CopyFromParent,
7336 mask, &attrs);
7337 }
7338
7339 XMapRaised (FRAME_X_DISPLAY (f),
7340 f->output_data.w32->hourglass_window);
7341 XFlush (FRAME_X_DISPLAY (f));
7342 }
7343
7344 hourglass_shown_p = 1; 7336 hourglass_shown_p = 1;
7345 UNBLOCK_INPUT;
7346 } 7337 }
7347#endif
7348} 7338}
7349 7339
7350 7340
@@ -7353,33 +7343,15 @@ show_hourglass (timer)
7353static void 7343static void
7354hide_hourglass () 7344hide_hourglass ()
7355{ 7345{
7356#if 0 /* TODO: cursor shape changes. */
7357 if (hourglass_shown_p) 7346 if (hourglass_shown_p)
7358 { 7347 {
7359 Lisp_Object rest, frame; 7348 struct frame *f = x_window_to_frame (&one_w32_display_info,
7360 7349 hourglass_hwnd);
7361 BLOCK_INPUT;
7362 FOR_EACH_FRAME (rest, frame)
7363 {
7364 struct frame *f = XFRAME (frame);
7365
7366 if (FRAME_W32_P (f)
7367 /* Watch out for newly created frames. */
7368 && f->output_data.x->hourglass_window)
7369 {
7370 XUnmapWindow (FRAME_X_DISPLAY (f),
7371 f->output_data.x->hourglass_window);
7372 /* Sync here because XTread_socket looks at the
7373 hourglass_p flag that is reset to zero below. */
7374 XSync (FRAME_X_DISPLAY (f), False);
7375 f->output_data.x->hourglass_p = 0;
7376 }
7377 }
7378 7350
7351 f->output_data.w32->hourglass_p = 0;
7352 SetCursor (f->output_data.w32->current_cursor);
7379 hourglass_shown_p = 0; 7353 hourglass_shown_p = 0;
7380 UNBLOCK_INPUT;
7381 } 7354 }
7382#endif
7383} 7355}
7384 7356
7385 7357
@@ -9323,7 +9295,8 @@ versions of Windows) characters. */);
9323 check_window_system_func = check_w32; 9295 check_window_system_func = check_w32;
9324 9296
9325 9297
9326 hourglass_atimer = NULL; 9298 hourglass_timer = 0;
9299 hourglass_hwnd = NULL;
9327 hourglass_shown_p = 0; 9300 hourglass_shown_p = 0;
9328 defsubr (&Sx_show_tip); 9301 defsubr (&Sx_show_tip);
9329 defsubr (&Sx_hide_tip); 9302 defsubr (&Sx_hide_tip);
diff --git a/src/w32term.h b/src/w32term.h
index d6b20bce910..5af3eac8ade 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -361,13 +361,12 @@ struct w32_output
361 Cursor hourglass_cursor; 361 Cursor hourglass_cursor;
362 Cursor horizontal_drag_cursor; 362 Cursor horizontal_drag_cursor;
363 363
364 /* Window whose cursor is hourglass_cursor. This window is
365 temporarily mapped to display an hourglass cursor. */
366 Window hourglass_window;
367
368 /* Non-zero means hourglass cursor is currently displayed. */ 364 /* Non-zero means hourglass cursor is currently displayed. */
369 unsigned hourglass_p : 1; 365 unsigned hourglass_p : 1;
370 366
367 /* Non-hourglass cursor that is currently active. */
368 Cursor current_cursor;
369
371 /* Flag to set when the window needs to be completely repainted. */ 370 /* Flag to set when the window needs to be completely repainted. */
372 int needs_exposure; 371 int needs_exposure;
373 372