aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorAndrew Choi2003-04-14 17:12:17 +0000
committerAndrew Choi2003-04-14 17:12:17 +0000
commitd243e605a05e28cfd0d68fee5d28b05593ec6969 (patch)
tree44b3a2c0b475a06383352dc8cffabe391961dbce /src/macterm.c
parent052797a781ea6b826efbd62dc0dad94b71c7efe8 (diff)
downloademacs-d243e605a05e28cfd0d68fee5d28b05593ec6969.tar.gz
emacs-d243e605a05e28cfd0d68fee5d28b05593ec6969.zip
* macterm.c (mac_check_for_quit_char): Don't check more often than
once a second.
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 7396cdca1b7..9e4e567ecbe 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -132,6 +132,10 @@ static int any_help_event_p;
132 132
133int x_autoselect_window_p; 133int x_autoselect_window_p;
134 134
135/* Non-zero means make use of UNDERLINE_POSITION font properties. */
136
137int x_use_underline_position_properties;
138
135/* Non-zero means draw block and hollow cursor as wide as the glyph 139/* Non-zero means draw block and hollow cursor as wide as the glyph
136 under it. For example, if a block cursor is over a tab, it will be 140 under it. For example, if a block cursor is over a tab, it will be
137 drawn as wide as that tab on the display. */ 141 drawn as wide as that tab on the display. */
@@ -8571,34 +8575,47 @@ quit_char_comp (EventRef inEvent, void *inCompData)
8571} 8575}
8572 8576
8573void 8577void
8574mac_check_for_quit_char() 8578mac_check_for_quit_char ()
8575{ 8579{
8576 EventRef event; 8580 EventRef event;
8577 /* If windows are not initialized, return immediately (keep it bouncin')*/ 8581 static EMACS_TIME last_check_time = { 0, 0 };
8582 static EMACS_TIME one_second = { 1, 0 };
8583 EMACS_TIME now, t;
8584
8585 /* If windows are not initialized, return immediately (keep it bouncin'). */
8578 if (!mac_quit_char_modifiers) 8586 if (!mac_quit_char_modifiers)
8579 return; 8587 return;
8580 8588
8589 /* Don't check if last check is less than a second ago. */
8590 EMACS_GET_TIME (now);
8591 EMACS_SUB_TIME (t, now, last_check_time);
8592 if (EMACS_TIME_LT (t, one_second))
8593 return;
8594 last_check_time = now;
8595
8581 /* Redetermine modifiers because they are based on lisp variables */ 8596 /* Redetermine modifiers because they are based on lisp variables */
8582 mac_determine_quit_char_modifiers(); 8597 mac_determine_quit_char_modifiers ();
8583 8598
8584 /* Fill the queue with events */ 8599 /* Fill the queue with events */
8585 ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event); 8600 ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event);
8586 event = FindSpecificEventInQueue (GetMainEventQueue(), quit_char_comp, NULL); 8601 event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp,
8602 NULL);
8587 if (event) 8603 if (event)
8588 { 8604 {
8589 struct input_event e; 8605 struct input_event e;
8590 struct mac_output *mwp = (mac_output*) GetWRefCon (FrontNonFloatingWindow ()); 8606 struct mac_output *mwp =
8607 (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
8591 /* Use an input_event to emulate what the interrupt handler does. */ 8608 /* Use an input_event to emulate what the interrupt handler does. */
8592 e.kind = ASCII_KEYSTROKE_EVENT; 8609 e.kind = ASCII_KEYSTROKE_EVENT;
8593 e.code = quit_char; 8610 e.code = quit_char;
8594 e.arg = NULL; 8611 e.arg = NULL;
8595 e.modifiers = NULL; 8612 e.modifiers = NULL;
8596 e.timestamp = EventTimeToTicks(GetEventTime(event))*(1000/60); 8613 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
8597 XSETFRAME(e.frame_or_window, mwp->mFP); 8614 XSETFRAME (e.frame_or_window, mwp->mFP);
8598 /* Remove event from queue to prevent looping. */ 8615 /* Remove event from queue to prevent looping. */
8599 RemoveEventFromQueue(GetMainEventQueue(), event); 8616 RemoveEventFromQueue (GetMainEventQueue (), event);
8600 ReleaseEvent(event); 8617 ReleaseEvent (event);
8601 kbd_buffer_store_event(&e); 8618 kbd_buffer_store_event (&e);
8602 } 8619 }
8603} 8620}
8604 8621
@@ -8767,6 +8784,14 @@ syms_of_macterm ()
8767 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 8784 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
8768 Vx_toolkit_scroll_bars = Qt; 8785 Vx_toolkit_scroll_bars = Qt;
8769 8786
8787 DEFVAR_BOOL ("x-use-underline-position-properties",
8788 &x_use_underline_position_properties,
8789 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
8790nil means ignore them. If you encounter fonts with bogus
8791UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
8792to 4.1, set this to nil. */);
8793 x_use_underline_position_properties = 0;
8794
8770 staticpro (&last_mouse_motion_frame); 8795 staticpro (&last_mouse_motion_frame);
8771 last_mouse_motion_frame = Qnil; 8796 last_mouse_motion_frame = Qnil;
8772 8797