comparison src/keyboard.c @ 9618:9fe4987e4896

(do_mouse_tracking): Now a FRAME_PTR. (EVENT_QUEUES_EMPTY, Ftrack_mouse, tracking_off): Changed accordingly. (kbd_buffer_get_event): Let do_mouse_tracking specify the display for mouse tracking.
author Richard M. Stallman <rms@gnu.org>
date Thu, 20 Oct 1994 05:33:22 +0000
parents 081040eb1863
children 13a13988685a
comparison
equal deleted inserted replaced
9617:3ea6ce042453 9618:9fe4987e4896
372 372
373 Why not just have a flag set and cleared by the enqueuing and 373 Why not just have a flag set and cleared by the enqueuing and
374 dequeuing functions? Such a flag could be screwed up by interrupts 374 dequeuing functions? Such a flag could be screwed up by interrupts
375 at inopportune times. */ 375 at inopportune times. */
376 376
377 /* If this flag is non-zero, we check mouse_moved to see when the 377 /* If this flag is a frame, we check mouse_moved to see when the
378 mouse moves, and motion events will appear in the input stream. If 378 mouse moves, and motion events will appear in the input stream.
379 it is zero, mouse motion is ignored. */ 379 Otherwise, mouse motion is ignored. */
380 static int do_mouse_tracking; 380 static Lisp_Object do_mouse_tracking;
381 381
382 /* The window system handling code should set this if the mouse has 382 /* The window system handling code should set this if the mouse has
383 moved since the last call to the mouse_position_hook. Calling that 383 moved since the last call to the mouse_position_hook. Calling that
384 hook should clear this. Code assumes that if this is set, it can 384 hook should clear this. Code assumes that if this is set, it can
385 call mouse_position_hook to get the promised position, so don't set 385 call mouse_position_hook to get the promised position, so don't set
390 enabled and there is a new mouse position in the mouse movement 390 enabled and there is a new mouse position in the mouse movement
391 buffer. Note that if this is false, that doesn't mean that there 391 buffer. Note that if this is false, that doesn't mean that there
392 is readable input; all the events in the queue might be button-up 392 is readable input; all the events in the queue might be button-up
393 events, and do_mouse_tracking might be off. */ 393 events, and do_mouse_tracking might be off. */
394 #define EVENT_QUEUES_EMPTY \ 394 #define EVENT_QUEUES_EMPTY \
395 ((kbd_fetch_ptr == kbd_store_ptr) && (!do_mouse_tracking || !mouse_moved)) 395 ((kbd_fetch_ptr == kbd_store_ptr) \
396 && (! FRAMEP (do_mouse_tracking) || !mouse_moved))
396 397
397 398
398 /* Symbols to head events. */ 399 /* Symbols to head events. */
399 Lisp_Object Qmouse_movement; 400 Lisp_Object Qmouse_movement;
400 Lisp_Object Qscroll_bar_movement; 401 Lisp_Object Qscroll_bar_movement;
1887 } 1888 }
1888 1889
1889 1890
1890 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use 1891 /* Restore mouse tracking enablement. See Ftrack_mouse for the only use
1891 of this function. */ 1892 of this function. */
1893
1892 static Lisp_Object 1894 static Lisp_Object
1893 tracking_off (old_value) 1895 tracking_off (old_value)
1894 Lisp_Object old_value; 1896 Lisp_Object old_value;
1895 { 1897 {
1896 if (! XFASTINT (old_value)) 1898 if (! XFASTINT (old_value))
1897 { 1899 {
1898 do_mouse_tracking = 0; 1900 do_mouse_tracking = Qnil;
1899 1901
1900 /* Redisplay may have been preempted because there was input 1902 /* Redisplay may have been preempted because there was input
1901 available, and it assumes it will be called again after the 1903 available, and it assumes it will be called again after the
1902 input has been processed. If the only input available was 1904 input has been processed. If the only input available was
1903 the sort that we have just disabled, then we need to call 1905 the sort that we have just disabled, then we need to call
1920 Lisp_Object args; 1922 Lisp_Object args;
1921 { 1923 {
1922 int count = specpdl_ptr - specpdl; 1924 int count = specpdl_ptr - specpdl;
1923 Lisp_Object val; 1925 Lisp_Object val;
1924 1926
1925 XSETINT (val, do_mouse_tracking); 1927 record_unwind_protect (tracking_off, do_mouse_tracking);
1926 record_unwind_protect (tracking_off, val);
1927 1928
1928 if (!input_pending && !detect_input_pending ()) 1929 if (!input_pending && !detect_input_pending ())
1929 prepare_menu_bars (); 1930 prepare_menu_bars ();
1930 1931
1931 do_mouse_tracking = 1; 1932 XSETFRAME (do_mouse_tracking, selected_frame);
1932 1933
1933 val = Fprogn (args); 1934 val = Fprogn (args);
1934 return unbind_to (count, val); 1935 return unbind_to (count, val);
1935 } 1936 }
1936 1937
2198 kbd_fetch_ptr = event + 1; 2199 kbd_fetch_ptr = event + 1;
2199 } 2200 }
2200 } 2201 }
2201 } 2202 }
2202 /* Try generating a mouse motion event. */ 2203 /* Try generating a mouse motion event. */
2203 else if (do_mouse_tracking && mouse_moved) 2204 else if (FRAMEP (do_mouse_tracking) && mouse_moved)
2204 { 2205 {
2205 FRAME_PTR f = 0; 2206 FRAME_PTR f = XFRAME (do_mouse_tracking);
2206 Lisp_Object bar_window; 2207 Lisp_Object bar_window;
2207 enum scroll_bar_part part; 2208 enum scroll_bar_part part;
2208 Lisp_Object x, y; 2209 Lisp_Object x, y;
2209 unsigned long time; 2210 unsigned long time;
2210 2211
5875 unread_command_char = -1; 5876 unread_command_char = -1;
5876 total_keys = 0; 5877 total_keys = 0;
5877 recent_keys_index = 0; 5878 recent_keys_index = 0;
5878 kbd_fetch_ptr = kbd_buffer; 5879 kbd_fetch_ptr = kbd_buffer;
5879 kbd_store_ptr = kbd_buffer; 5880 kbd_store_ptr = kbd_buffer;
5880 do_mouse_tracking = 0; 5881 do_mouse_tracking = Qnil;
5881 input_pending = 0; 5882 input_pending = 0;
5882 5883
5883 #ifdef MULTI_FRAME 5884 #ifdef MULTI_FRAME
5884 /* This means that command_loop_1 won't try to select anything the first 5885 /* This means that command_loop_1 won't try to select anything the first
5885 time through. */ 5886 time through. */