emacs-devel
[Top][All Lists]
Advanced

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

Re: Cursor in non-selected windows is 1 pixel too small


From: YAMAMOTO Mitsuharu
Subject: Re: Cursor in non-selected windows is 1 pixel too small
Date: Sat, 11 Mar 2006 22:17:17 +0900 (JST)

>>>>> On Sat, 11 Mar 2006 14:09:22 +0200, Eli Zaretskii <address@hidden> said:

> Yes, and then all the callers of mac_draw_rectangle except
> x_draw_hollow_cursor need to subtract 1 from width and height.
> Funny.

> I modified mac_draw_rectangle to not add 1 to these two dimensions,
> and then removed the decrements from its callers.

Hmm, I'd rather prefer to keep the arguments compatible with the X11
version so as to make synchronization easy.

>> By the way, Quartz 2D (as opposed to QuickDraw above) needs another
>> kind of adjustment to get the same result:
>> 
>> CGContextStrokeRect (context, CGRectMake (x + 0.5f, y + 0.5f, width, 
>> height));

> I cannot find this code in Emacs.

Not installed yet.  I was planning to make the change like this:

  /* Mac replacement for XDrawRectangle: dest is a window.  */
  
  static void
  mac_draw_rectangle (f, gc, x, y, width, height)
       struct frame *f;
       GC gc;
       int x, y;
       unsigned int width, height;
  {
  #if USE_CG_DRAWING
    CGContextRef context;

    context = mac_begin_cg_clip (f, gc);
    CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
    CGContextStrokeRect (context,
                         CGRectMake (x + 0.5f, y + 0.5f, width, height));
    mac_end_cg_clip (f);
  #else
    Rect r;

    SetPortWindowPort (FRAME_MAC_WINDOW (f));

    RGBForeColor (GC_FORE_COLOR (gc));
    SetRect (&r, x, y, x + width + 1, y + height + 1);

    mac_begin_clip (gc);
    FrameRect (&r); /* using foreground color of gc */
    mac_end_clip (gc);
  #endif
  }

So, if the callers does not subtract 1 from width and height, then the
callee need to do so when USE_CG_DRAWING == 1.  That's another reason
why I'd prefer to keep the meaning of the arguments.

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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