unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Patch to fix the Bar Cursor Too Narrow problem on Mac OS X
@ 2011-02-18  4:29 Ben Key
  2011-02-19 19:15 ` Chong Yidong
  0 siblings, 1 reply; 13+ messages in thread
From: Ben Key @ 2011-02-18  4:29 UTC (permalink / raw)
  To: Emacs-devel; +Cc: david+emacsformacosx

[-- Attachment #1: Type: text/plain, Size: 2469 bytes --]

Hello,

The first thing I noticed when I began using Emacs on Mac OS X was that when
Emacs is configured to use a bar cursor the cursor is difficult to see
because it is too narrow, even when the width of the bar cursor is specified
by using the (bar . WIDTH) syntax when setting the value of the cursor-type
variable.  The following patch fixes this problem.

There are three changes in this patch.

   1. The function get_specified_cursor_type in src/xdisp.c has been
   modified so that the width output parameter is always initialized.
   2. FIXME comments that are no longer valid have been removed from
the function
   ns_draw_window_cursor in nsterm.m.  The comments are no longer valid because
   they discuss the cursor_width may not be initialized problem that is
   fixed by change 1.
   3. In the BAR_CURSOR case, s.size.width is set equal to "min
   (cursor_width, w->phys_cursor_width)."  Previously it was set equal to "min
   (cursor_width, 2)" which effectively caused the user specified value for the
   cursor width to be ignored.


<patch>
=== modified file 'src/nsterm.m'
--- src/nsterm.m    2011-02-17 10:19:29 +0000
+++ src/nsterm.m    2011-02-18 03:43:28 +0000
@@ -2232,9 +2232,6 @@
 /*
--------------------------------------------------------------------------
      External call (RIF): draw cursor
      (modeled after x_draw_window_cursor
-     FIXME: cursor_width is effectively bogus -- it sometimes gets set
-     in xdisp.c set_frame_cursor_types, sometimes left uninitialized;
-     DON'T USE IT (no other terms do)

--------------------------------------------------------------------------
*/
 {
   NSRect r, s;
@@ -2335,7 +2332,7 @@
       break;
     case BAR_CURSOR:
       s = r;
-      s.size.width = min (cursor_width, 2); //FIXME(see above)
+      s.size.width = min (cursor_width, w->phys_cursor_width);

       /* If the character under cursor is R2L, draw the bar cursor
          on the right of its glyph, rather than on the left.  */

=== modified file 'src/xdisp.c'
--- src/xdisp.c    2011-02-16 18:39:46 +0000
+++ src/xdisp.c    2011-02-18 03:45:19 +0000
@@ -23201,6 +23201,12 @@
 {
   enum text_cursor_kinds type;

+  /*
+  Initialize width to a reasonable default value here to ensure that there
can
+  never be a case in which the function exits without width being
initialized.
+  */
+  *width = 2;
+
   if (NILP (arg))
     return NO_CURSOR;


</patch>

I tested these changes against revision 103325 on Mac OS X.

[-- Attachment #2: Type: text/html, Size: 2985 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-02-24 12:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18  4:29 Patch to fix the Bar Cursor Too Narrow problem on Mac OS X Ben Key
2011-02-19 19:15 ` Chong Yidong
2011-02-20  1:23   ` Ben Key
2011-02-21 17:40     ` Chong Yidong
2011-02-21 17:58     ` Chong Yidong
2011-02-21 21:15       ` Ben Key
2011-02-21 22:56         ` Ben Key
2011-02-22  0:23         ` Chong Yidong
2011-02-22  0:35           ` Chong Yidong
2011-02-22 13:09             ` Adrian Robert
2011-02-23 20:06               ` Chong Yidong
2011-02-24 12:38                 ` Jan Djärv
2011-02-23 20:45         ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).