changeset 71065:380e4a856f30

(font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. (mac_font_panel_visible_p, mac_show_hide_font_panel) [USE_MAC_FONT_PANEL]: New functions. [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return immediately if font panel is not visible.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Mon, 29 May 2006 09:43:03 +0000
parents 30ac4bc8f8f7
children 8e0c06f079c2
files src/macterm.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macterm.c	Mon May 29 09:42:41 2006 +0000
+++ b/src/macterm.c	Mon May 29 09:43:03 2006 +0000
@@ -8338,6 +8338,25 @@
 }
 
 #if USE_MAC_FONT_PANEL
+/* The first call to font panel functions (FPIsFontPanelVisible,
+   SetFontInfoForSelection) is slow.  This variable is used for
+   deferring such a call as much as possible.  */
+static int font_panel_shown_p = 0;
+
+int
+mac_font_panel_visible_p ()
+{
+  return font_panel_shown_p && FPIsFontPanelVisible ();
+}
+
+OSStatus
+mac_show_hide_font_panel ()
+{
+  font_panel_shown_p = 1;
+
+  return FPShowHideFontPanel ();
+}
+
 OSStatus
 mac_set_font_info_for_selection (f, face_id, c)
      struct frame *f;
@@ -8347,6 +8366,9 @@
   EventTargetRef target = NULL;
   XFontStruct *font = NULL;
 
+  if (!mac_font_panel_visible_p ())
+    return noErr;
+
   if (f)
     {
       target = GetWindowEventTarget (FRAME_MAC_WINDOW (f));