emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102676: Handle invisible cursor (bg


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102676: Handle invisible cursor (bg same as cursor color) for Nextstep.
Date: Thu, 16 Dec 2010 20:37:13 +0100
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102676
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Thu 2010-12-16 20:37:13 +0100
message:
  Handle invisible cursor (bg same as cursor color) for Nextstep.
  
  * nsterm.m (ns_draw_window_cursor): If the cursor color is the
  same as the background, use the face forground as cursor.
modified:
  src/ChangeLog
  src/nsterm.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-12-13 15:27:36 +0000
+++ b/src/ChangeLog     2010-12-16 19:37:13 +0000
@@ -1,3 +1,8 @@
+2010-12-16  Jan Djärv  <address@hidden>
+
+       * nsterm.m (ns_draw_window_cursor): If the cursor color is the
+       same as the background, use the face forground as cursor.
+
 2010-12-13  Eli Zaretskii  <address@hidden>
 
        * fileio.c (Fexpand_file_name): Doc fix.  (Bug#7617)

=== modified file 'src/nsterm.m'
--- a/src/nsterm.m      2010-12-13 15:27:36 +0000
+++ b/src/nsterm.m      2010-12-16 19:37:13 +0000
@@ -2301,6 +2301,8 @@
   struct glyph *phys_cursor_glyph;
   int overspill;
   struct glyph *cursor_glyph;
+  struct face *face;
+  NSColor *hollow_color = FRAME_BACKGROUND_COLOR (f);
 
   /* If cursor is out of bounds, don't draw garbage.  This can happen
      in mini-buffer windows when switching between echo area glyphs
@@ -2310,7 +2312,7 @@
 //fprintf(stderr, "drawcursor (%d,%d) activep = %d\tonp = %d\tc_type = 
%d\twidth = %d\n",x,y, active_p,on_p,cursor_type,cursor_width);
 
   if (!on_p)
-       return;
+    return;
 
   w->phys_cursor_type = cursor_type;
   w->phys_cursor_on_p = on_p;
@@ -2349,7 +2351,17 @@
   /* TODO: only needed in rare cases with last-resort font in HELLO..
      should we do this more efficiently? */
   ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */
-  [FRAME_CURSOR_COLOR (f) set];
+
+
+  face = FACE_FROM_ID (f, phys_cursor_glyph->face_id);
+  if (face && NS_FACE_BACKGROUND (face)
+      == ns_index_color (FRAME_CURSOR_COLOR (f), f))
+    {
+      [ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), f) set];
+      hollow_color = FRAME_CURSOR_COLOR (f);
+    }
+  else
+    [FRAME_CURSOR_COLOR (f) set];
 
 #ifdef NS_IMPL_COCOA
   /* TODO: This makes drawing of cursor plus that of phys_cursor_glyph
@@ -2369,7 +2381,7 @@
       break;
     case HOLLOW_BOX_CURSOR:
       NSRectFill (r);
-      [FRAME_BACKGROUND_COLOR (f) set];
+      [hollow_color set];
       NSRectFill (NSInsetRect (r, 1, 1));
       [FRAME_CURSOR_COLOR (f) set];
       break;


reply via email to

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