[Development] Exception to source compatibility: adding AA_CompressHighFrequencyEvents flag

Shawn Rutledge Shawn.Rutledge at qt.io
Tue Apr 26 14:08:12 CEST 2016


In 5.6.0, an event compression feature was added to the xcb platform plugin, to fix QTBUG-40889 and QTBUG-47069.  That is here: https://codereview.qt-project.org/#/c/126136/  Qt 4 had a similar feature, and then it was possible to turn it on or off, using widget attribute WA_NoX11EventCompression.  Using a widget attribute doesn’t make sense now, because you might not be using widgets, and the platform plugin isn’t necessarily aware of them even if you are.  This time the compression was done with no way to turn it off, and QTBUG-44964 was written up as a task to come up with a way to enable/disable the compression.  If the application does not handle high-frequency events (mouse movements and window moves/resizes) quickly enough, some events will be dropped.  So, sufficiently responsive applications shouldn’t experience any event compression.

This causes some trouble for drawing-tablet applications like Krita though.  It’s not right to compress move events from tablet devices by default, because the application may be using some complex brush-painting algorithm, but nevertheless the artist using it expects to get smooth brush strokes, not jagged piecewise ones.  So maybe the XCB plugin simply shouldn’t compress those; but then we’d have a behavior change in 5.6.1 relative to 5.6.0, and anyway the decision to compress or not doesn’t pay attention to which device it’s coming from, so far.  It might be possible though.

Personally I think event compression should be a cross-platform feature if we’re going to have it.  The event-pileup problem can happen also on Windows for example, but it seems that we never implemented event compression on any platform other than X11.  I’m not sure why.  But we don’t plan to do that in the 5.6 series, anyway.

https://codereview.qt-project.org/#/c/156755 makes it possible to turn off the compression feature by setting an env variable; that works OK, but it’s meant as a short-term hack: we know that we need proper public API eventually.  The question is whether we should be adding API in a patch release like 5.6.1.  Of course this time it’s an LTS release, so it seems reasonable to expect long-term solutions to problems like this, rather than short-term hacks.  And it was brought up that env variables are inherited by child processes, so if for some reason your paint program starts child processes, you might need to unset the env variable first.  And as usual, env variables which affect behavior in platform plugins need to be set before the QGuiApplication is created, because the platform plugin reads it at static-initialization time, when it is loaded.

https://codereview.qt-project.org/#/c/157011 adds an application attribute, 
AA_CompressHighFrequencyEvents, which is true by default on X11, and you can unset it to disable the compression.  The advantage of doing it this way is that you can control it dynamically: maybe you want to have compression only some of the time, depending on what the application is doing with the events.  But it requires an exception to the source compatibility rule: if you have used that flag in your application, then you won’t be able to compile it with 5.6.0 anymore.  (You could ifdef it though.)  Of course forward compatibility shouldn’t be a problem.  And even if we implement compression as a cross-platform feature eventually, we can still use that flag to enable/disable it.

I was told to request this exception on the mailing list, because we usually try to maintain source compatibility between releases.

So, any objections?



More information about the Development mailing list