#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.

6 views
Skip to first unread message

wxTrac

unread,
Nov 22, 2010, 4:59:31 PM11/22/10
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------
I have some flickering in wxStyledTextCtrl with syntax highlighting in
wxGTK. To avoid this problem is enough to use wxBufferedPaintDC in
wxPaintEvent handler:
{{{
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
#ifdef __WXGTK__
wxBufferedPaintDC dc(this);
#else
wxPaintDC dc(this);
#endif
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}
}}}


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704>

wxTrac

unread,
Nov 22, 2010, 6:16:36 PM11/22/10
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:1>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new

Priority: normal | Milestone: 2.9.2

Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------

Changes (by ruslanch):

* milestone: => 2.9.2

--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:1>

wxTrac

unread,
Nov 22, 2010, 6:59:36 PM11/22/10
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:2>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------

Changes (by vadz):

* milestone: 2.9.2 =>


Comment:

Very strange, GTK+ 2.0 is supposed to perform its own double buffering (as
most of the other modern systems, i.e. OS X and Windows since Vista). Does
anybody know if STC do something to deactivate GTK+ double buffering by
chance?


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:2>

wxTrac

unread,
Nov 23, 2010, 12:08:03 AM11/23/10
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:3>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------

Comment(by robind):

Replying to [comment:2 vadz]:


> Does anybody know if STC do something to deactivate GTK+ double
buffering by chance?

It doesn't. wxSTC is all fairly generic wx code at the bottom level.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:3>

wxTrac

unread,
Nov 23, 2010, 3:21:06 AM11/23/10
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:4>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------

Comment(by ruslanch):

I have not dug far, but if you comment out:
{{{
style | = wxVSCROLL | wxHSCROLL;
}}}
in wxStyledTextCtrl::Create, the problem disappears. But will not work
scrollbars.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:4>

wxTrac

unread,
Nov 13, 2012, 7:40:11 PM11/13/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:5>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------
Changes (by arondobos):

* milestone: => 2.9.5


Comment:

I am also encountering very significant flickering on wxGTK2 using the
current SVN ( r72947 ). It happens as I am typing, even on a line without
any syntax highlighting (lexer is turned on). I experience the same
behavior on Fedora 16 and Slackware 14, using a similarly configured
wxWidgets:

./configure --prefix=/usr/local/wx3-svn --enable-stl --enable-shared=no
--enable-debug=no --with-libjpeg=builtin --with-libpng=builtin --with-
zlib=builtin --with-expat=builtin --with-libtiff=builtin --disable-
precomp-headers


I tried many things, including wxWindow::SetDoubleBuffered(true) (forcibly
enables gtk2 double buffering), and
wxStyledTextCtrl::SetBufferedDraw(true), but neither was sufficient. The
only thing I tried that worked to eliminate flickering during typing was
the patch suggested above by ruslanch.

I hope this patch can be integrated, or an alternate resolution resolved.
I have spent quite some time tracking through the wxStyledTextCtrl and
scintilla code, and cannot clearly define the cause of the flickering
problem... I do not see this behavior on MSW or OSX-Cocoa.

Thank you!


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:5>

wxTrac

unread,
Nov 14, 2012, 1:24:30 PM11/14/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:6>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
--------------------------+-------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: wxStyledText | Version: 2.9-svn
Keywords: flickering | Blockedby:
Patch: 1 | Blocking:
--------------------------+-------------------------------------------------

Comment(by jens):

We use the wxBufferedPaintDC in the wxScintilla we use for Code::Blocks
since 3 years, because we also received bug-reports about the flickering.

As far as I can see, there are no drawbacks.

The patch was provided by Eran Ifrah the developer of CodeLite.

Jens


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:6>

wxTrac

unread,
Nov 23, 2012, 7:33:48 PM11/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:7>

#12704: Some flickering in wxStyledTextCtrl with syntax highlighting in wxGTK.
---------------------------+------------------------------------------------
Reporter: ruslanch | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: wxStyledText | Version: 2.9-svn
Resolution: fixed | Keywords: flickering
Blockedby: | Patch: 1
Blocking: |
---------------------------+------------------------------------------------
Changes (by VZ):

* status: new => closed
* resolution: => fixed


Comment:

(In [73001]) Use wxBufferedPaintDC for wxStyledTextCtrl drawing in wxGTK.

GTK+ doesn't seem to use double buffering for Scintilla window for some
reason, resulting in bad flicker when it's updated, e.g. when the user
types
into it.

Force the use of double buffering at wxWidgets level by using
wxBufferedPaintDC for painting it. This may be inefficient if GTK+ does
double
buffer it in some cases but at least it gets rid of the flicker.

Closes #12704, #14828.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/12704#comment:7>
Reply all
Reply to author
Forward
0 new messages