Subject: Re: 23/NS: redraws according to mouse-face are slow

From: Chong Yidong <[email-masked]>
Date: Mon, 04 May 2009 21:53:10 -0400

Thanks for debugging this.

> Now, in NS (or at least in Cocoa), there seem to be screen updates
> every time we draw a glyph string.

I see.  It seems ns_draw_glyph_string is a lot more expensive that
x_draw_glyph_string.  The show_mouse_face function assumes that the
*_draw_glyph_string operation is relatively cheap, which is why it's
called inside a loop.

My guess is that the problem lies in the calls to ns_focus and
ns_unfocus in ns_draw_glyph_string.

> If we wrap the code in show_mouse_face in NS[Dis|En]ableScreen, the
> problem goes away for me (and it's not just delayed).  Same for the
> header-line/overlay issues I reported in #2530.

If possible, we should minimize the amount of platform-dependent code
inside xdisp.c.  Could you experiment with putting these calls somewhere
in nsterm.m, say surrounding the calls to note_mouse_highlight?

Also, could it be ns_update_begin and ns_update_end that you want to
call, instead of NSDisableScreen and NSEnableScreen?