Florian Balmer
2013-04-23 18:11:44 UTC
Dear Scintilla Community
The issue described below has been reproduced with Scintilla 3.2.3 through
3.3.1.
There have been reports about the latest beta versions of Notepad2 showing
a black rectangle instead of the normal text, in certain siutations. The
problem only appears on Windows Vista and above with Direct2D enabled (can
be disabled in the Notepad2.ini file). The most reliable way to reproduce
the issue is to lock Windows (Windows Key+L) while Notepad2 is in the
foreground, then the black rectangle appears right after logging on. It can
also be triggered through an UAC prompt, sometimes.
I've tracked down the issue to ScintillaWin::WndPaint(), where Scintilla
discards the allocated Direct2D objects in response to the
D2DERR_RECREATE_TARGET error. If FullPaint() is called after this error,
the black rectangle won't appear.
I'm not familiar with Direct2D at all, but somehow this makes sense to me.
The MSDN tutorial [1] does not explicitly mention that (see section "The
Direct2D Render Loop"), but maybe implicitly in step 3 by saying "Repeat
step 2 whenever you need to update or redraw the scene". The question is:
is there a need to redraw if the render target has been lost, or not?
[1]
http://msdn.microsoft.com/en-us/library/windows/desktop/ff684174(v=vs.85).aspx
The problem does not appear with SciTE, but I suspect this is due to some
housekeeping (such as showing/hiding the selection upon a focus change)
causing a full repaint if the SciTE window is reactivated after logon.
Also, with Direct2D, the caret does not appear when setting the focus to
Scintilla, if there's no text (empty document), unless some keyboard or
mouse input has arrived to Scintilla. Forcing the full repaint as outlined
above partially fixes this issue (but not for the initial display of the
caret in a newly opened Notepad2 window with an empty document), that's why
I think this may be a somehow related issue. Again, no problem here in
SciTE, but maybe some action being taken on WM_ACTIVATE or WM_ACTIVATEAPP
causes a full repaint, and reinitialization of the caret.
Has anybody experienced similar problems with Direct2D turning Scintilla
into a black rectangle? Is my suggested fix reasonable, or did I miss the
point about Direct2D completely? Has anybody else noted the behaviour with
the caret, and found out if it's also linked to Direct2D?
--Florian
The issue described below has been reproduced with Scintilla 3.2.3 through
3.3.1.
There have been reports about the latest beta versions of Notepad2 showing
a black rectangle instead of the normal text, in certain siutations. The
problem only appears on Windows Vista and above with Direct2D enabled (can
be disabled in the Notepad2.ini file). The most reliable way to reproduce
the issue is to lock Windows (Windows Key+L) while Notepad2 is in the
foreground, then the black rectangle appears right after logging on. It can
also be triggered through an UAC prompt, sometimes.
I've tracked down the issue to ScintillaWin::WndPaint(), where Scintilla
discards the allocated Direct2D objects in response to the
D2DERR_RECREATE_TARGET error. If FullPaint() is called after this error,
the black rectangle won't appear.
I'm not familiar with Direct2D at all, but somehow this makes sense to me.
The MSDN tutorial [1] does not explicitly mention that (see section "The
Direct2D Render Loop"), but maybe implicitly in step 3 by saying "Repeat
step 2 whenever you need to update or redraw the scene". The question is:
is there a need to redraw if the render target has been lost, or not?
[1]
http://msdn.microsoft.com/en-us/library/windows/desktop/ff684174(v=vs.85).aspx
The problem does not appear with SciTE, but I suspect this is due to some
housekeeping (such as showing/hiding the selection upon a focus change)
causing a full repaint if the SciTE window is reactivated after logon.
Also, with Direct2D, the caret does not appear when setting the focus to
Scintilla, if there's no text (empty document), unless some keyboard or
mouse input has arrived to Scintilla. Forcing the full repaint as outlined
above partially fixes this issue (but not for the initial display of the
caret in a newly opened Notepad2 window with an empty document), that's why
I think this may be a somehow related issue. Again, no problem here in
SciTE, but maybe some action being taken on WM_ACTIVATE or WM_ACTIVATEAPP
causes a full repaint, and reinitialization of the caret.
Has anybody experienced similar problems with Direct2D turning Scintilla
into a black rectangle? Is my suggested fix reasonable, or did I miss the
point about Direct2D completely? Has anybody else noted the behaviour with
the caret, and found out if it's also linked to Direct2D?
--Florian
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.