comparison src/w32fns.c @ 36252:a8630c63f7d5

Rename everything containing *busy_cursor* and similar to *hourglass*. (syms_of_w32fns): Rename x-busy-pointer-shape to x-hourglass-pointer-shape, display-busy-cursor to display-hourglass, busy-cursor-delay to hourglass-delay.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 21 Feb 2001 13:55:14 +0000
parents 743534626f73
children aa32e4e49d10
comparison
equal deleted inserted replaced
36251:94d6ad393a74 36252:a8630c63f7d5
144 Lisp_Object Vx_resource_name; 144 Lisp_Object Vx_resource_name;
145 145
146 /* Non nil if no window manager is in use. */ 146 /* Non nil if no window manager is in use. */
147 Lisp_Object Vx_no_window_manager; 147 Lisp_Object Vx_no_window_manager;
148 148
149 /* Non-zero means we're allowed to display a busy cursor. */ 149 /* Non-zero means we're allowed to display a hourglass pointer. */
150 150
151 int display_busy_cursor_p; 151 int display_hourglass_p;
152 152
153 /* The background and shape of the mouse pointer, and shape when not 153 /* The background and shape of the mouse pointer, and shape when not
154 over text or in the modeline. */ 154 over text or in the modeline. */
155 155
156 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; 156 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
157 Lisp_Object Vx_busy_pointer_shape, Vx_window_horizontal_drag_shape; 157 Lisp_Object Vx_hourglass_pointer_shape, Vx_window_horizontal_drag_shape;
158 158
159 /* The shape when over mouse-sensitive text. */ 159 /* The shape when over mouse-sensitive text. */
160 160
161 Lisp_Object Vx_sensitive_text_pointer_shape; 161 Lisp_Object Vx_sensitive_text_pointer_shape;
162 162
393 if (!GC_FRAMEP (frame)) 393 if (!GC_FRAMEP (frame))
394 continue; 394 continue;
395 f = XFRAME (frame); 395 f = XFRAME (frame);
396 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo) 396 if (!FRAME_W32_P (f) || FRAME_W32_DISPLAY_INFO (f) != dpyinfo)
397 continue; 397 continue;
398 if (f->output_data.w32->busy_window == wdesc) 398 if (f->output_data.w32->hourglass_window == wdesc)
399 return f; 399 return f;
400 400
401 /* TODO: Check tooltips when supported. */ 401 /* TODO: Check tooltips when supported. */
402 if (FRAME_W32_WINDOW (f) == wdesc) 402 if (FRAME_W32_WINDOW (f) == wdesc)
403 return f; 403 return f;
2029 } 2029 }
2030 else 2030 else
2031 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr); 2031 nontext_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_left_ptr);
2032 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); 2032 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
2033 2033
2034 if (!EQ (Qnil, Vx_busy_pointer_shape)) 2034 if (!EQ (Qnil, Vx_hourglass_pointer_shape))
2035 { 2035 {
2036 CHECK_NUMBER (Vx_busy_pointer_shape, 0); 2036 CHECK_NUMBER (Vx_hourglass_pointer_shape, 0);
2037 busy_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), 2037 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f),
2038 XINT (Vx_busy_pointer_shape)); 2038 XINT (Vx_hourglass_pointer_shape));
2039 } 2039 }
2040 else 2040 else
2041 busy_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch); 2041 hourglass_cursor = XCreateFontCursor (FRAME_W32_DISPLAY (f), XC_watch);
2042 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s"); 2042 x_check_errors (FRAME_W32_DISPLAY (f), "bad busy pointer cursor: %s");
2043 2043
2044 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s"); 2044 x_check_errors (FRAME_W32_DISPLAY (f), "bad nontext pointer cursor: %s");
2045 if (!EQ (Qnil, Vx_mode_pointer_shape)) 2045 if (!EQ (Qnil, Vx_mode_pointer_shape))
2046 { 2046 {
2096 &fore_color, &back_color); 2096 &fore_color, &back_color);
2097 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor, 2097 XRecolorCursor (FRAME_W32_DISPLAY (f), mode_cursor,
2098 &fore_color, &back_color); 2098 &fore_color, &back_color);
2099 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor, 2099 XRecolorCursor (FRAME_W32_DISPLAY (f), cross_cursor,
2100 &fore_color, &back_color); 2100 &fore_color, &back_color);
2101 XRecolorCursor (FRAME_W32_DISPLAY (f), busy_cursor, 2101 XRecolorCursor (FRAME_W32_DISPLAY (f), hourglass_cursor,
2102 &fore_color, &back_color); 2102 &fore_color, &back_color);
2103 } 2103 }
2104 2104
2105 if (FRAME_W32_WINDOW (f) != 0) 2105 if (FRAME_W32_WINDOW (f) != 0)
2106 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor); 2106 XDefineCursor (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), cursor);
2112 if (nontext_cursor != f->output_data.w32->nontext_cursor 2112 if (nontext_cursor != f->output_data.w32->nontext_cursor
2113 && f->output_data.w32->nontext_cursor != 0) 2113 && f->output_data.w32->nontext_cursor != 0)
2114 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor); 2114 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->nontext_cursor);
2115 f->output_data.w32->nontext_cursor = nontext_cursor; 2115 f->output_data.w32->nontext_cursor = nontext_cursor;
2116 2116
2117 if (busy_cursor != f->output_data.w32->busy_cursor 2117 if (hourglass_cursor != f->output_data.w32->hourglass_cursor
2118 && f->output_data.w32->busy_cursor != 0) 2118 && f->output_data.w32->hourglass_cursor != 0)
2119 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->busy_cursor); 2119 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->hourglass_cursor);
2120 f->output_data.w32->busy_cursor = busy_cursor; 2120 f->output_data.w32->hourglass_cursor = hourglass_cursor;
2121 2121
2122 if (mode_cursor != f->output_data.w32->modeline_cursor 2122 if (mode_cursor != f->output_data.w32->modeline_cursor
2123 && f->output_data.w32->modeline_cursor != 0) 2123 && f->output_data.w32->modeline_cursor != 0)
2124 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor); 2124 XFreeCursor (FRAME_W32_DISPLAY (f), f->output_data.w32->modeline_cursor);
2125 f->output_data.w32->modeline_cursor = mode_cursor; 2125 f->output_data.w32->modeline_cursor = mode_cursor;
12130 /*********************************************************************** 12130 /***********************************************************************
12131 Busy cursor 12131 Busy cursor
12132 ***********************************************************************/ 12132 ***********************************************************************/
12133 12133
12134 /* If non-null, an asynchronous timer that, when it expires, displays 12134 /* If non-null, an asynchronous timer that, when it expires, displays
12135 a busy cursor on all frames. */ 12135 an hourglass cursor on all frames. */
12136 12136
12137 static struct atimer *busy_cursor_atimer; 12137 static struct atimer *hourglass_atimer;
12138 12138
12139 /* Non-zero means a busy cursor is currently shown. */ 12139 /* Non-zero means an hourglass cursor is currently shown. */
12140 12140
12141 static int busy_cursor_shown_p; 12141 static int hourglass_shown_p;
12142 12142
12143 /* Number of seconds to wait before displaying a busy cursor. */ 12143 /* Number of seconds to wait before displaying an hourglass cursor. */
12144 12144
12145 static Lisp_Object Vbusy_cursor_delay; 12145 static Lisp_Object Vhourglass_delay;
12146 12146
12147 /* Default number of seconds to wait before displaying a busy 12147 /* Default number of seconds to wait before displaying an hourglass
12148 cursor. */ 12148 cursor. */
12149 12149
12150 #define DEFAULT_BUSY_CURSOR_DELAY 1 12150 #define DEFAULT_HOURGLASS_DELAY 1
12151 12151
12152 /* Function prototypes. */ 12152 /* Function prototypes. */
12153 12153
12154 static void show_busy_cursor P_ ((struct atimer *)); 12154 static void show_hourglass P_ ((struct atimer *));
12155 static void hide_busy_cursor P_ ((void)); 12155 static void hide_hourglass P_ ((void));
12156 12156
12157 12157
12158 /* Cancel a currently active busy-cursor timer, and start a new one. */ 12158 /* Cancel a currently active hourglass timer, and start a new one. */
12159 12159
12160 void 12160 void
12161 start_busy_cursor () 12161 start_hourglass ()
12162 { 12162 {
12163 #if 0 /* TODO: cursor shape changes. */ 12163 #if 0 /* TODO: cursor shape changes. */
12164 EMACS_TIME delay; 12164 EMACS_TIME delay;
12165 int secs, usecs = 0; 12165 int secs, usecs = 0;
12166 12166
12167 cancel_busy_cursor (); 12167 cancel_hourglass ();
12168 12168
12169 if (INTEGERP (Vbusy_cursor_delay) 12169 if (INTEGERP (Vhourglass_delay)
12170 && XINT (Vbusy_cursor_delay) > 0) 12170 && XINT (Vhourglass_delay) > 0)
12171 secs = XFASTINT (Vbusy_cursor_delay); 12171 secs = XFASTINT (Vhourglass_delay);
12172 else if (FLOATP (Vbusy_cursor_delay) 12172 else if (FLOATP (Vhourglass_delay)
12173 && XFLOAT_DATA (Vbusy_cursor_delay) > 0) 12173 && XFLOAT_DATA (Vhourglass_delay) > 0)
12174 { 12174 {
12175 Lisp_Object tem; 12175 Lisp_Object tem;
12176 tem = Ftruncate (Vbusy_cursor_delay, Qnil); 12176 tem = Ftruncate (Vhourglass_delay, Qnil);
12177 secs = XFASTINT (tem); 12177 secs = XFASTINT (tem);
12178 usecs = (XFLOAT_DATA (Vbusy_cursor_delay) - secs) * 1000000; 12178 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
12179 } 12179 }
12180 else 12180 else
12181 secs = DEFAULT_BUSY_CURSOR_DELAY; 12181 secs = DEFAULT_HOURGLASS_DELAY;
12182 12182
12183 EMACS_SET_SECS_USECS (delay, secs, usecs); 12183 EMACS_SET_SECS_USECS (delay, secs, usecs);
12184 busy_cursor_atimer = start_atimer (ATIMER_RELATIVE, delay, 12184 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
12185 show_busy_cursor, NULL); 12185 show_hourglass, NULL);
12186 #endif 12186 #endif
12187 } 12187 }
12188 12188
12189 12189
12190 /* Cancel the busy cursor timer if active, hide a busy cursor if 12190 /* Cancel the hourglass cursor timer if active, hide an hourglass
12191 shown. */ 12191 cursor if shown. */
12192 12192
12193 void 12193 void
12194 cancel_busy_cursor () 12194 cancel_hourglass ()
12195 { 12195 {
12196 if (busy_cursor_atimer) 12196 if (hourglass_atimer)
12197 { 12197 {
12198 cancel_atimer (busy_cursor_atimer); 12198 cancel_atimer (hourglass_atimer);
12199 busy_cursor_atimer = NULL; 12199 hourglass_atimer = NULL;
12200 } 12200 }
12201 12201
12202 if (busy_cursor_shown_p) 12202 if (hourglass_shown_p)
12203 hide_busy_cursor (); 12203 hide_hourglass ();
12204 } 12204 }
12205 12205
12206 12206
12207 /* Timer function of busy_cursor_atimer. TIMER is equal to 12207 /* Timer function of hourglass_atimer. TIMER is equal to
12208 busy_cursor_atimer. 12208 hourglass_atimer.
12209 12209
12210 Display a busy cursor on all frames by mapping the frames' 12210 Display an hourglass cursor on all frames by mapping the frames'
12211 busy_window. Set the busy_p flag in the frames' output_data.x 12211 hourglass_window. Set the hourglass_p flag in the frames'
12212 structure to indicate that a busy cursor is shown on the 12212 output_data.x structure to indicate that an hourglass cursor is
12213 frames. */ 12213 shown on the frames. */
12214 12214
12215 static void 12215 static void
12216 show_busy_cursor (timer) 12216 show_hourglass (timer)
12217 struct atimer *timer; 12217 struct atimer *timer;
12218 { 12218 {
12219 #if 0 /* TODO: cursor shape changes. */ 12219 #if 0 /* TODO: cursor shape changes. */
12220 /* The timer implementation will cancel this timer automatically 12220 /* The timer implementation will cancel this timer automatically
12221 after this function has run. Set busy_cursor_atimer to null 12221 after this function has run. Set hourglass_atimer to null
12222 so that we know the timer doesn't have to be canceled. */ 12222 so that we know the timer doesn't have to be canceled. */
12223 busy_cursor_atimer = NULL; 12223 hourglass_atimer = NULL;
12224 12224
12225 if (!busy_cursor_shown_p) 12225 if (!hourglass_shown_p)
12226 { 12226 {
12227 Lisp_Object rest, frame; 12227 Lisp_Object rest, frame;
12228 12228
12229 BLOCK_INPUT; 12229 BLOCK_INPUT;
12230 12230
12231 FOR_EACH_FRAME (rest, frame) 12231 FOR_EACH_FRAME (rest, frame)
12232 if (FRAME_W32_P (XFRAME (frame))) 12232 if (FRAME_W32_P (XFRAME (frame)))
12233 { 12233 {
12234 struct frame *f = XFRAME (frame); 12234 struct frame *f = XFRAME (frame);
12235 12235
12236 f->output_data.w32->busy_p = 1; 12236 f->output_data.w32->hourglass_p = 1;
12237 12237
12238 if (!f->output_data.w32->busy_window) 12238 if (!f->output_data.w32->hourglass_window)
12239 { 12239 {
12240 unsigned long mask = CWCursor; 12240 unsigned long mask = CWCursor;
12241 XSetWindowAttributes attrs; 12241 XSetWindowAttributes attrs;
12242 12242
12243 attrs.cursor = f->output_data.w32->busy_cursor; 12243 attrs.cursor = f->output_data.w32->hourglass_cursor;
12244 12244
12245 f->output_data.w32->busy_window 12245 f->output_data.w32->hourglass_window
12246 = XCreateWindow (FRAME_X_DISPLAY (f), 12246 = XCreateWindow (FRAME_X_DISPLAY (f),
12247 FRAME_OUTER_WINDOW (f), 12247 FRAME_OUTER_WINDOW (f),
12248 0, 0, 32000, 32000, 0, 0, 12248 0, 0, 32000, 32000, 0, 0,
12249 InputOnly, 12249 InputOnly,
12250 CopyFromParent, 12250 CopyFromParent,
12251 mask, &attrs); 12251 mask, &attrs);
12252 } 12252 }
12253 12253
12254 XMapRaised (FRAME_X_DISPLAY (f), f->output_data.w32->busy_window); 12254 XMapRaised (FRAME_X_DISPLAY (f),
12255 f->output_data.w32->hourglass_window);
12255 XFlush (FRAME_X_DISPLAY (f)); 12256 XFlush (FRAME_X_DISPLAY (f));
12256 } 12257 }
12257 12258
12258 busy_cursor_shown_p = 1; 12259 hourglass_shown_p = 1;
12259 UNBLOCK_INPUT; 12260 UNBLOCK_INPUT;
12260 } 12261 }
12261 #endif 12262 #endif
12262 } 12263 }
12263 12264
12264 12265
12265 /* Hide the busy cursor on all frames, if it is currently shown. */ 12266 /* Hide the hourglass cursor on all frames, if it is currently shown. */
12266 12267
12267 static void 12268 static void
12268 hide_busy_cursor () 12269 hide_hourglass ()
12269 { 12270 {
12270 #if 0 /* TODO: cursor shape changes. */ 12271 #if 0 /* TODO: cursor shape changes. */
12271 if (busy_cursor_shown_p) 12272 if (hourglass_shown_p)
12272 { 12273 {
12273 Lisp_Object rest, frame; 12274 Lisp_Object rest, frame;
12274 12275
12275 BLOCK_INPUT; 12276 BLOCK_INPUT;
12276 FOR_EACH_FRAME (rest, frame) 12277 FOR_EACH_FRAME (rest, frame)
12277 { 12278 {
12278 struct frame *f = XFRAME (frame); 12279 struct frame *f = XFRAME (frame);
12279 12280
12280 if (FRAME_W32_P (f) 12281 if (FRAME_W32_P (f)
12281 /* Watch out for newly created frames. */ 12282 /* Watch out for newly created frames. */
12282 && f->output_data.x->busy_window) 12283 && f->output_data.x->hourglass_window)
12283 { 12284 {
12284 XUnmapWindow (FRAME_X_DISPLAY (f), f->output_data.x->busy_window); 12285 XUnmapWindow (FRAME_X_DISPLAY (f),
12285 /* Sync here because XTread_socket looks at the busy_p flag 12286 f->output_data.x->hourglass_window);
12286 that is reset to zero below. */ 12287 /* Sync here because XTread_socket looks at the
12288 hourglass_p flag that is reset to zero below. */
12287 XSync (FRAME_X_DISPLAY (f), False); 12289 XSync (FRAME_X_DISPLAY (f), False);
12288 f->output_data.x->busy_p = 0; 12290 f->output_data.x->hourglass_p = 0;
12289 } 12291 }
12290 } 12292 }
12291 12293
12292 busy_cursor_shown_p = 0; 12294 hourglass_shown_p = 0;
12293 UNBLOCK_INPUT; 12295 UNBLOCK_INPUT;
12294 } 12296 }
12295 #endif 12297 #endif
12296 } 12298 }
12297 12299
13635 13637
13636 Vx_nontext_pointer_shape = Qnil; 13638 Vx_nontext_pointer_shape = Qnil;
13637 13639
13638 Vx_mode_pointer_shape = Qnil; 13640 Vx_mode_pointer_shape = Qnil;
13639 13641
13640 DEFVAR_LISP ("x-busy-pointer-shape", &Vx_busy_pointer_shape, 13642 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape,
13641 "The shape of the pointer when Emacs is busy.\n\ 13643 "The shape of the pointer when Emacs is busy.\n\
13642 This variable takes effect when you create a new frame\n\ 13644 This variable takes effect when you create a new frame\n\
13643 or when you set the mouse color."); 13645 or when you set the mouse color.");
13644 Vx_busy_pointer_shape = Qnil; 13646 Vx_hourglass_pointer_shape = Qnil;
13645 13647
13646 DEFVAR_BOOL ("display-busy-cursor", &display_busy_cursor_p, 13648 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p,
13647 "Non-zero means Emacs displays a busy cursor on window systems."); 13649 "Non-zero means Emacs displays an hourglass pointer on window systems.");
13648 display_busy_cursor_p = 1; 13650 display_hourglass_p = 1;
13649 13651
13650 DEFVAR_LISP ("busy-cursor-delay", &Vbusy_cursor_delay, 13652 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay,
13651 "*Seconds to wait before displaying a busy-cursor.\n\ 13653 "*Seconds to wait before displaying an hourglass pointer.\n\
13652 Value must be an integer or float."); 13654 Value must be an integer or float.");
13653 Vbusy_cursor_delay = make_number (DEFAULT_BUSY_CURSOR_DELAY); 13655 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
13654 13656
13655 DEFVAR_LISP ("x-sensitive-text-pointer-shape", 13657 DEFVAR_LISP ("x-sensitive-text-pointer-shape",
13656 &Vx_sensitive_text_pointer_shape, 13658 &Vx_sensitive_text_pointer_shape,
13657 "The shape of the pointer when over mouse-sensitive text.\n\ 13659 "The shape of the pointer when over mouse-sensitive text.\n\
13658 This variable takes effect when you create a new frame\n\ 13660 This variable takes effect when you create a new frame\n\
13931 defsubr (&Simagep); 13933 defsubr (&Simagep);
13932 defsubr (&Slookup_image); 13934 defsubr (&Slookup_image);
13933 #endif 13935 #endif
13934 #endif /* TODO */ 13936 #endif /* TODO */
13935 13937
13936 busy_cursor_atimer = NULL; 13938 hourglass_atimer = NULL;
13937 busy_cursor_shown_p = 0; 13939 hourglass_shown_p = 0;
13938 #ifdef TODO /* Tooltip support not complete. */ 13940 #ifdef TODO /* Tooltip support not complete. */
13939 defsubr (&Sx_show_tip); 13941 defsubr (&Sx_show_tip);
13940 defsubr (&Sx_hide_tip); 13942 defsubr (&Sx_hide_tip);
13941 #endif 13943 #endif
13942 tip_timer = Qnil; 13944 tip_timer = Qnil;