emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111504: * nsfont.m (ns_findfonts): A


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111504: * nsfont.m (ns_findfonts): Add block/unblock_input calls.
Date: Sun, 13 Jan 2013 13:05:17 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111504
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2013-01-13 13:05:17 +0100
message:
  * nsfont.m (ns_findfonts): Add block/unblock_input calls.
  Remove check for fkeys count > zero, block/unblock fixes the real bug.
  (nsfont_list_family): Add block/unblock_input calls.
  (nsfont_open): Move block_input earlier.  Add unblock_input before early
  return.
  (nsfont_draw): Add block/unblock_input calls.
modified:
  src/ChangeLog
  src/nsfont.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-01-12 06:15:12 +0000
+++ b/src/ChangeLog     2013-01-13 12:05:17 +0000
@@ -1,3 +1,12 @@
+2013-01-13  Jan Djärv  <address@hidden>
+
+       * nsfont.m (ns_findfonts): Add block/unblock_input calls.
+       Remove check for fkeys count > zero, block/unblock fixes the real bug.
+       (nsfont_list_family): Add block/unblock_input calls.
+       (nsfont_open): Move block_input earlier.  Add unblock_input before early
+       return.
+       (nsfont_draw): Add block/unblock_input calls.
+
 2013-01-12  Dmitry Antipov  <address@hidden>
 
        * indent.c (Fvertical_motion): Remove now-incorrect GCPROs

=== modified file 'src/nsfont.m'
--- a/src/nsfont.m      2013-01-02 16:13:04 +0000
+++ b/src/nsfont.m      2013-01-13 12:05:17 +0000
@@ -546,6 +546,7 @@
     NSSet *cFamilies;
     BOOL foundItal = NO;
 
+    block_input ();
     if (NSFONT_TRACE)
       {
        fprintf (stderr, "nsfont: %s for fontspec:\n    ",
@@ -560,10 +561,7 @@
     if (isMatch)
        [fkeys removeObject: NSFontFamilyAttribute];
 
-    if ([fkeys count] > 0)
-      matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
-    else
-      matchingDescs = [NSMutableArray array];
+    matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
 
     if (NSFONT_TRACE)
        NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
@@ -598,6 +596,8 @@
         [s1 release];
       }
 
+    unblock_input ();
+
     /* Return something if was a match and nothing found. */
     if (isMatch)
       return ns_fallback_entity ();
@@ -701,10 +701,12 @@
 nsfont_list_family (Lisp_Object frame)
 {
   Lisp_Object list = Qnil;
-  NSEnumerator *families =
-    [[[NSFontManager sharedFontManager] availableFontFamilies]
-      objectEnumerator];
+  NSEnumerator *families;
   NSString *family;
+
+  block_input ();
+  families = [[[NSFontManager sharedFontManager] availableFontFamilies]
+               objectEnumerator];
   while ((family = [families nextObject]))
       list = Fcons (intern ([family UTF8String]), list);
   /* FIXME: escape the name? */
@@ -713,6 +715,7 @@
     fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
             XINT (Flength (list)));
 
+  unblock_input ();
   return list;
 }
 
@@ -735,6 +738,8 @@
   Lisp_Object font_object;
   int fixLeopardBug;
 
+  block_input ();
+
   if (NSFONT_TRACE)
     {
       fprintf (stderr, "nsfont: open size %d of fontentity:\n    ", 
pixel_size);
@@ -794,13 +799,14 @@
   font_info = (struct nsfont_info *) XFONT_OBJECT (font_object);
   font = (struct font *) font_info;
   if (!font)
-    return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
+    {
+      unblock_input ();
+      return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
+    }
 
   font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
   font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
 
-  block_input ();
-
   /* for metrics */
 #ifdef NS_IMPL_COCOA
   sfont = [nsfont screenFontWithRenderingMode:
@@ -1051,6 +1057,7 @@
   char isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
   int end = isComposite ? s->cmp_to : s->nchars;
 
+  block_input ();
   /* Select face based on input flags */
   switch (ns_tmp_flags)
     {
@@ -1273,6 +1280,7 @@
   /* Draw underline, overline, strike-through. */
   ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x);
 
+  unblock_input ();
   return to-from;
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]