Subject: 23.0.91; [PATCH] Cocoa Port Doesn't Honor cursor-in-non-selected-windows

From: Peter Jones <[email-masked]>
Date: Fri, 13 Mar 2009 08:36:14 -0600

Attached is a patch that changes the Cocoa (Nextstep) port so that it
correctly respects the setting of cursor-in-non-selected-windows.

Currently, the Objective-C code forces the cursor in non-selected
windows to a hollow box, although the function is called with the
correct cursor to draw.

--- src/nsterm.m.orig	2009-03-11 13:17:10.000000000 -0600
+++ src/nsterm.m	2009-03-12 17:18:26.000000000 -0600
@@ -2351,7 +2351,7 @@
   int fx, fy, h;
   struct frame *f = WINDOW_XFRAME (w);
   struct glyph *phys_cursor_glyph;
-  int overspill, cursorToDraw;
+  int overspill;
 
   NSTRACE (dumpcursor);
 //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);
@@ -2407,8 +2407,7 @@
   NSDisableScreenUpdates ();
 #endif
 
-  cursorToDraw = active_p ? cursor_type : HOLLOW_BOX_CURSOR;
-  switch (cursorToDraw)
+  switch (cursor_type)
     {
     case NO_CURSOR:
       break;
@@ -2425,7 +2424,7 @@
       s = r;
       s.origin.y += lrint (0.75 * s.size.height);
       s.size.width = min (FRAME_COLUMN_WIDTH (f), s.size.width);
-      s.size.height = lrint (s.size.height * 0.25);
+      s.size.height = min (cursor_width, 2); //FIXME(see above)
       NSRectFill (s);
       break;
     case BAR_CURSOR:
@@ -2437,7 +2436,7 @@
   ns_unfocus (f);
 
   /* draw the character under the cursor */
-  if (cursorToDraw != NO_CURSOR)
+  if (cursor_type != NO_CURSOR)
     draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
 
 #ifdef NS_IMPL_COCOA

In GNU Emacs 23.0.91.4 (i386-apple-darwin9.6.0, NS apple-appkit-949.43)
 of 2009-03-12 on beefy.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x RET r e p o r t <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> C-g C-g M-x r e 
p o r t - b <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
call-interactively: Text is read-only
Quit [2 times]
Quit