On Dec 5, 2007 1:06 AM, Gilbert Harman <[EMAIL PROTECTED]> wrote:
> I have found this sufficiently annoying to go back to the previous version
> (rc2) where I am not seeing this bug.

There were a number of changes to ns_draw_window_cursor() between rc2
and rc3 to fix various bugs relating to switching between frames and
windows.  The new bug thereby introduced doesn't show up on Tiger, and
I won't see Leopard for a while.  If anyone finds it annoying enough
to roll up their sleeves ;), I'm appending the old version of the
function below for comparison purposes.

I suspect the line (in the new version)  "if (FRAME_LAST_INACTIVE(f))"
could be at fault.

One question: are you able to observe the bug when there is only ONE
active frame with ONE active window?

thanks,
Adrian

--------------------------

void
ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
                       int x, int y, int cursor_type, int cursor_width,
                       int on_p, int active_p)
// ----------------------------------------------------------------------------
//   External call (RIF): draw cursor
// ----------------------------------------------------------------------------
{
  NSRect r,s;
  int fx, fy, h;
  struct frame *f = WINDOW_XFRAME (w);
  struct glyph *phys_cursor_glyph;
  int overspill;

  NSTRACE(dumpcursor);

  if (!on_p)
    return;  //PENDING: erase?

  w->phys_cursor_type = cursor_type;
  w->phys_cursor_on_p = 1;

  if (cursor_type == NO_CURSOR)
    {
      w->phys_cursor_width = 0;
      return;
    }

  if ((phys_cursor_glyph = get_phys_cursor_glyph (w)) == NULL)
    {
      if (glyph_row->exact_window_width_line_p
          && w->phys_cursor.hpos >= glyph_row->used[TEXT_AREA])
        {
          glyph_row->cursor_in_fringe_p = 1;
          draw_fringe_bitmap (w, glyph_row, 0);
        }
      return;
    }

  get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h);

  r.origin.x = fx, r.origin.y = fy;
  r.size.height = h;
  r.size.width = w->phys_cursor_width;

  //PENDING: if we overwrite the internal border area, it does not get erased;
  // fix by truncating cursor, but better would be to erase properly
  overspill = r.origin.x + r.size.width -
    WINDOW_TEXT_TO_FRAME_PIXEL_X(w, WINDOW_BOX_RIGHT_EDGE_X(w)
      - WINDOW_TOTAL_FRINGE_WIDTH(w) - FRAME_INTERNAL_BORDER_WIDTH(f));
  if (overspill > 0)
    r.size.width -= overspill;

  //PENDING: 23: use emacs stored f->cursor_type instead of ns-specific
  FRAME_CURSOR(f) = FRAME_NEW_CURSOR(f);
  FRAME_CURSOR_COLOR(f) = FRAME_NEW_CURSOR_COLOR(f);

  //PENDING: 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, NULL);
//  ns_focus(f, &r);

  // draw the cursor
  // needed for bar and line cursors
  [FRAME_BACKGROUND_COLOR(f) set];
  NSRectFill(r);
  [FRAME_CURSOR_COLOR(f) set];

  switch (active_p ? FRAME_CURSOR(f) : hollow_box)
    {
    case no_highlight:
      break;
    case filled_box:
      NSRectFill(r);
      break;
    case hollow_box:
      NSRectFill(r);
      [FRAME_BACKGROUND_COLOR(f) set];
      NSRectFill(NSInsetRect(r, 1, 1));
      [FRAME_CURSOR_COLOR(f) set];
      break;
    case bar:
      s = r;
      s.origin.y += 0.75 * s.size.height;
      s.size.height *= 0.25;
      NSRectFill(s);
      break;
    case line:
      s = r;
      s.size.width = 2;
      NSRectFill(s);
      break;
    }
  ns_unfocus(f);

  // draw the character under the cursor
  draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
}

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Emacs-app-dev- mailing list
Emacs-app-dev-@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emacs-app-dev-

Reply via email to