comparison src/macterm.c @ 50591:12b66952af3a

* macterm.c (mac_check_for_quit_char): Don't check more often than once a second.
author Andrew Choi <akochoi@shaw.ca>
date Mon, 14 Apr 2003 17:12:17 +0000
parents 0cebe62850bc
children cb5f0a5d5b36
comparison
equal deleted inserted replaced
50590:0a31ec45f727 50591:12b66952af3a
130 130
131 /* Non-zero means autoselect window with the mouse cursor. */ 131 /* Non-zero means autoselect window with the mouse cursor. */
132 132
133 int x_autoselect_window_p; 133 int x_autoselect_window_p;
134 134
135 /* Non-zero means make use of UNDERLINE_POSITION font properties. */
136
137 int 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. */
138 142
139 143
8569 } 8573 }
8570 return true; 8574 return true;
8571 } 8575 }
8572 8576
8573 void 8577 void
8574 mac_check_for_quit_char() 8578 mac_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
8605 #endif /* MAC_OSX */ 8622 #endif /* MAC_OSX */
8606 8623
8765 8782
8766 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 8783 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
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.
8790 nil means ignore them. If you encounter fonts with bogus
8791 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
8792 to 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
8773 DEFVAR_LISP ("mac-command-key-is-meta", &Vmac_command_key_is_meta, 8798 DEFVAR_LISP ("mac-command-key-is-meta", &Vmac_command_key_is_meta,
8774 doc: /* Non-nil means that the command key is used as the Emacs meta key. 8799 doc: /* Non-nil means that the command key is used as the Emacs meta key.