[cairo] How to test the gl backend?

Russell Shaw rjshaw at netspace.net.au
Fri Jun 4 06:50:32 PDT 2010


Petr Kobalíček wrote:
> 
> On Fri, Jun 4, 2010 at 3:28 PM, Russell Shaw <rjshaw at netspace.net.au> wrote:
>> Bill Spitzak wrote:
>>> On 06/04/2010 05:53 AM, Russell Shaw wrote:
>>>
>>>> If gtk only uses top-level X windows, that means gtk has to register
>>>> for always-on mouse-motion events. Urgh...
>>> I think you are seriously in error about guessing what is inefficient!
>>>
>>> Believe me, creating and managing a hundred X windows requires ORDERS OF
>>> MAGNITUDE more communication to the server than an event every time the
>>> mouse moves 1 pixel. Besides it probably turned on mouse tracking for those
>>> individual windows anyway!
>> In a properly done widget tool kit, no events are emitted from the X server
>> unless the mouse or keyboard button is pressed, or if the mouse crosses the
>> border of a window (only if the widget registered for those events).
>> Continuous mouse-motion events are usually only used in drag operations
>> when a mouse button is held down.
>>
>> Continuous mouse-motion emission of events from the X server will make
>> networked applications utterly unuseable on all but the fastest (ie local)
>> networks.

 > On the other side using only top-level window means that you also save
 > some events:
 >
 > - Expose events (you have ideally only few or one expose)
 > - Mouse Enter / Leave events (you get only Mouse Motion)
 >
 > And window can be paint using one blit call which efficiently removes all
 > flickering caused by repainting tens of child x-windows.

In a toolkit that runs at a decent efficiency of cpu cycles, forcibly repainting
10 X windows such as in response to a scrollbar drag, does not show flicker
on average current PCs, and probably not on much older PCs.

The architecture of the widget toolkit can be the problem,

If you drag a scrollbar which then moves windows, and you wait for
expose events to come from the X server, and then repaint the windows
in response to that, you're guaranteed to get flicker.

Some toolkits are just real cpu hogs and are just plain slow to
react to events anyway.


More information about the cairo mailing list