Sven:
> we use Scintilla in TortoiseGit. In some previous versions we had
> enabled Direct2D and experienced several issues:
>
> * Background blinks/flashes black/white
Maybe this is the same sort of problem as discussed here, as the black
screen was occasionally reported to be white, and the temporary
visibility of the cached window contents after logon can make it look
like flashing.
> * Redraw issues in mstsc Remote Desktop session
Only problems with the "TeamViewer" remote control software have been
reported for Notepad2, by now.
> * Text cursor is often invisible
Something like this has also been reported for Notepad2, but only on
Windows Vista. The caret disappeared on certain positions when using the
arrow keys to move it right or left. The problem could be fixed by
setting a caret size (width) of at least 2 pixels or by enabling the
block caret style. That's why I suppose this is some kind of sub-pixel
rounding bug in the Windows Vista Direct2D engine. The problem has not
been reported on Windows 7 or Windows 8, up to now.
> * Random crashes
Fortunately, this didn't happen, so far.
Neil:
> I'd prefer a loop around the drawing code for a second attempt when
> receiving D2DERR_RECREATE_TARGET. FullPaint is for other situations
> and lumping this one in may make it harder to maintain.
> A modification has been pushed that tries to paint another time after
> receiving D2DERR_RECREATE_TARGET.
I was just making up the code in my mind today, but was not sure where
to put the loop, whether it was safe to reuse the Scintilla GDI objects,
and so on ... and here's the solution, already!
The issue is solved for all the situations I can test myself. If I get
feedback about the error persisting in some (weird, not used by me)
situations, I will post a follow up. Thank you very much for your help!
> Are you sure Scintilla is receiving focus? Its in the handling of
> WM_SETFOCUS that ShowCaretAtCurrentPosition is called and caret
> ticking is turned on. Can't see any reason for a blank document to be
> treated differently to one with text here.
>
> To see if it has focus try typing and try using the tab key to see if
> the focus highlight is anywhere on screen.
Yes, Scintilla has the focus, and everything works as expected with
Direct2D disabled. Even if I move the SetFocus()'ing of Scintilla to
WM_ACTIVATE(APP) as in SciTE, the problem remains the same.
I can fix this by post-messaging SCI_CHARLEFT on the initial activation
of Scintilla, if there's an emypt document. This is no longer necessary
once the caret has been displayed, i.e. for subsequent activations,
and also not required if the initially loaded document is not empty.
--Florian