#1567 Display is flashing when scrolling with Gtk+ 3


The way drawing is handled has changed between Gtk+ 2 and Gtk+ 3. Scintilla is good with Gtk+ 2 but quite bad using Gtk+ 3.

One annoying point is the display flashing when the window is redrawn. It's especially annoying when moving in the text using the cursor keys.


Bugs: #1625
Bugs: #1681
Bugs: #1949


<< < 1 2 3 4 > >> (Page 2 of 4)
  • Sébastien Granjoux

    Thank, I will try to reproduce it here, I have mint 13 at the moment.

    • Neil Hodgson

      Neil Hodgson - 2014-01-06

      One possibility is that the redraw requested for the new buffer is being abandoned or is ineffective. SciTE reuses the Scintilla instance for the new empty document but your application may create a new instance for each document. Tracing all calls for Redraw/RedrawRect/AbandonPaint along with the draw callback may help find the problem.

  • Colomban Wendling

    By the way, I must say I do not experience flickering in Geany with GTK3. I do not know if it is because of decent hardware or something, but it's worth noting that this issue isn't affecting me.

  • Sébastien Granjoux

    I have tried on OpenSuse 13.1 (Gtk 3.10.4) and my patch works fine and fix a flickering in both Anjuta and Geany. I will reproduce the missing redraw.

  • Sébastien Granjoux

    I have tried in a virtual machine running Mint 16. It seems that it doesn't flicker but the patch doesn't break anything.

    • Neil Hodgson

      Neil Hodgson - 2014-02-02

      When you say "doesn't break anything", does SciTE redraw correctly for you?

      • Sébastien Granjoux


  • Sébastien Granjoux

    The flickering is not always obvious, it's easier to see it when the system is loaded. By example under valgrind, loading a big file with syntax highlight, visible whitespace, end of line and line numbers, and scrolling with the down cursor key.

  • Sébastien Granjoux

    I have more explanations about this.

    In GTK3, there is a change in the drawing model. Now Widgets can be transparent which means that they are drawn on top of the other starting from the parent widget (=from back to front). By default a double buffer is used so all these operations don't appear on the screen.

    Each widget can have a GdkWindow or not and this GdkWindow can be "native" or not. I think a "native" window is one handled by the windows manager. Most of the time only the top widget has a native GdkWindow. So it get the expose event and call the draw function of all its children in order.

    • Why it flicker?

    Scintilla uses two windows: the top window with a custom draw function which doesn't draw the text window. And the text window which has its own GdkWindow but not a native one.

    I think the new version of GTK draws first the top window overwriting all the text area with a gray background and then call the draw function of the text widget to display the right content.

    • Why nothing is displayed when double_buffer is kept enable on the text window?

    There is some code in gtkmain.c which discards expose event on double buffered, non native window which is the case of the text window. That's why in my patch, I need to remove the custom draw function.

    There is a note, which appear in the version 3.10 of Gtk documentation, saying that gtk_widget_set_double_buffer works only on native window. Indeed we see that doing this lead to a flickering window.

    So, another way to fix this flickering is to call gdk_window_ensure_native in the realize callback of the text widget. In this case both the top and the text window are handled by the window manager who is taking care of not overwriting the text area with the top window background.

    I can provide a patch for that but I don't think it's the right solution. It's still not the common way to draw widget and the documentation mentions that some backend cannot support child native window which is our case.

    I still don't know why my patch breaks on some system. Based on this, it looks right. As I cannot reproduce it here, it's difficult to know what's happen. I guess that it can be a bug in older versions of GTK. Perhaps with those explanations you can understand the issue better than me.

    I will send a new patch drawing the text window in the custom draw function of the Scintilla window. It should work fine on my system and perhaps could fix the issue in the other cases.

  • Sébastien Granjoux

    Here is a new patch, keeping the custom draw function of the Scintilla widget. Could you check if it's working on your system?

    If yes, it probably means that there was a bug in the draw function of GtkContainer.

<< < 1 2 3 4 > >> (Page 2 of 4)

Log in to post a comment.