changeset 97584:06f7d5858c5a

* nsfns.m (ns-read-file-name): Add casts to avoid warning. (ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly. * nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil. * nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration. (EmacsApp-cursor_blink_handler): Remove declaration. * nsterm.m (ns_draw_glyph_string): Update first conditional body to match 01 Feb 2008 changes in xterm.c. (ns_read_socket): Add cast to avoid warning. (EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on GNUstep.
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Thu, 21 Aug 2008 02:48:58 +0000
parents 2b25a461fcb0
children 6e4c30da411f
files src/ChangeLog src/nsfns.m src/nsfont.m src/nsterm.h src/nsterm.m
diffstat 5 files changed, 54 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Aug 21 02:31:45 2008 +0000
+++ b/src/ChangeLog	Thu Aug 21 02:48:58 2008 +0000
@@ -1,3 +1,16 @@
+2008-08-20  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* nsfns.m (ns-read-file-name): Add casts to avoid warning.
+	(ns-convert-utf8-nfd-to-nfc): Warn if cannot execute correctly.
+	* nsfont.m (nsfont_draw): Compare indexed colors to 0, not nil.
+	* nsterm.h (EmacsView-unlockFocusNeedsFlush:): Add declaration.
+	(EmacsApp-cursor_blink_handler): Remove declaration.
+	* nsterm.m (ns_draw_glyph_string): Update first conditional body to
+	match 01 Feb 2008 changes in xterm.c.
+	(ns_read_socket): Add cast to avoid warning.
+	(EmacsApp-application:openFiles:): Don't call replyToOpenOrPrint: on
+	GNUstep.
+
 2008-08-20  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xselect.c (x_get_foreign_selection): Return nil if desired
--- a/src/nsfns.m	Thu Aug 21 02:31:45 2008 +0000
+++ b/src/nsfns.m	Thu Aug 21 02:48:58 2008 +0000
@@ -1440,7 +1440,7 @@
     dirS = [dirS stringByExpandingTildeInPath];
 
   panel = NILP (isLoad) ?
-    [EmacsSavePanel savePanel] : [EmacsOpenPanel openPanel];
+    (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel];
 
   [panel setTitle: promptS];
 
@@ -1988,11 +1988,21 @@
     (str)
     Lisp_Object str;
 {
+/* TODO: If GNUstep ever implements precomposedStringWithCanonicalMapping,
+         remove this. */
   NSString *utfStr;
 
   CHECK_STRING (str);
-  utfStr = [[NSString stringWithUTF8String: SDATA (str)]
-             precomposedStringWithCanonicalMapping];
+  utfStr = [NSString stringWithUTF8String: SDATA (str)];
+  if (![utfStr respondsToSelector:
+                 @selector (precomposedStringWithCanonicalMapping)])
+    {
+      message1
+        ("Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.\n");
+      return Qnil;
+    }
+  else
+    utfStr = [utfStr precomposedStringWithCanonicalMapping];
   return build_string ([utfStr UTF8String]);
 }
 
--- a/src/nsfont.m	Thu Aug 21 02:31:45 2008 +0000
+++ b/src/nsfont.m	Thu Aug 21 02:48:58 2008 +0000
@@ -1016,13 +1016,13 @@
     /* do underline */
     if (face->underline_p)
       {
-        if (face->underline_color != nil)
+        if (face->underline_color != 0)
           [ns_lookup_indexed_color (face->underline_color, s->f) set];
         else
           [col set];
         DPSmoveto (context, r.origin.x, r.origin.y + font->underpos);
         DPSlineto (context, r.origin.x+r.size.width, r.origin.y+font->underpos);
-        if (face->underline_color != nil)
+        if (face->underline_color != 0)
           [col set];
       }
     else
--- a/src/nsterm.h	Thu Aug 21 02:31:45 2008 +0000
+++ b/src/nsterm.h	Thu Aug 21 02:48:58 2008 +0000
@@ -41,7 +41,6 @@
 - (void)showPreferencesWindow: (id)sender;
 - (BOOL) openFile: (NSString *)fileName;
 - (void)fd_handler: (NSTimer *) fdEntry;
-- (void)cursor_blink_handler: (NSTimer *)cursorEntry;
 - (void)timeout_handler: (NSTimer *)timedEntry;
 - (BOOL)fulfillService: (NSString *)name withArg: (NSString *)arg;
 @end
@@ -83,6 +82,11 @@
 - (void) setWindowClosing: (BOOL)closing;
 - (EmacsToolbar *) toolbar;
 - (void) deleteWorkingText;
+
+#ifdef NS_IMPL_GNUSTEP
+/* Not declared, but useful. */
+- (void) unlockFocusNeedsFlush: (BOOL)needs;
+#endif
 @end
 
 
--- a/src/nsterm.m	Thu Aug 21 02:31:45 2008 +0000
+++ b/src/nsterm.m	Thu Aug 21 02:48:58 2008 +0000
@@ -2273,7 +2273,7 @@
   struct frame *f = WINDOW_XFRAME (w);
   struct glyph *phys_cursor_glyph;
   int overspill;
-  unsigned char drawGlyph = 0, cursorType, oldCursorType;
+  char drawGlyph = 0, cursorType, oldCursorType;
   int new_cursor_type;
   int new_cursor_width;
   int active_cursor;
@@ -2928,13 +2928,21 @@
 
   NSTRACE (ns_draw_glyph_string);
 
-  if (s->next && s->right_overhang && !s->for_overlaps && s->hl != DRAW_CURSOR)
+  if (s->next && s->right_overhang && !s->for_overlaps/* && s->hl != DRAW_CURSOR*/)
     {
-      xassert (s->next->img == NULL);
-      n = ns_get_glyph_string_clip_rect (s->next, r);
-      ns_focus (s->f, r, n);
-      ns_maybe_dumpglyphs_background (s->next, 1);
-      ns_unfocus (s->f);
+      int width;
+      struct glyph_string *next;
+
+      for (width = 0, next = s->next; next;
+	   width += next->width, next = next->next)
+	if (next->first_glyph->type != IMAGE_GLYPH)
+          {
+            n = ns_get_glyph_string_clip_rect (s->next, r);
+            ns_focus (s->f, r, n);
+            ns_maybe_dumpglyphs_background (s->next, 1);
+            ns_unfocus (s->f);
+            next->num_clips = 0;
+          }
     }
 
   if (!s->for_overlaps && s->face->box != FACE_NO_BOX
@@ -3044,6 +3052,7 @@
       ns_unfocus (s->f);
     }
 
+  s->num_clips = 0;
 }
 
 
@@ -3149,7 +3158,7 @@
 
   /* If have pending open-file requests, attend to the next one of those. */
   if (ns_pending_files && [ns_pending_files count] != 0
-      && [NSApp openFile: [ns_pending_files objectAtIndex: 0]])
+      && [(EmacsApp *)NSApp openFile: [ns_pending_files objectAtIndex: 0]])
     {
       [ns_pending_files removeObjectAtIndex: 0];
     }
@@ -4194,11 +4203,11 @@
   while ((file = [files nextObject]) != nil)
     [ns_pending_files addObject: file];
 
-#ifdef NS_IMPL_GNUSTEP
-  [self replyToOpenOrPrint: 0];
-#else
+/* TODO: when GNUstep implements this (and we require that version of
+         GNUstep), remove. */
+#ifndef NS_IMPL_GNUSTEP
   [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess];
-#endif /* NS_IMPL_GNUSTEP */
+#endif /* !NS_IMPL_GNUSTEP */
 
 }