[immodule-qt] Re: how about use postEvent instead of sendEvent in qt-immodule implementation?

Lars Knoll lars at trolltech.com
Fri Jul 2 19:12:41 EEST 2004


Hi

On Thursday 01 July 2004 18:03, LiuCougar wrote:
> Anyone there has any comments about this?
>
> Do you think this is possible and whether it will break BC?

It doesn't break BC. However posting the event implies that the event will 
only be delivered the next time the application reaches the event loop. If 
your code requires immediate delivery it might not work as you expect it to. 
It will also not solve the flickering problem without also implementing event 
compression for QIMEvents, something we currently don't have in Qt. I also 
don't know if IM event compression is desirable at all.

I would rather try to look for the source of the flickering in the widget that 
has the problems. It can usually be solved using double buffering there.

Regards,
Lars

>
> On Tue, 29 Jun 2004 23:39:42 +0000, LiuCougar <liucougar at gmail.com> wrote:
> > Hi,
> >
> > I have just implemented most functions for qt-immodule support of
> > scim: it connected to skim to display the input window (including
> > pre-edit string, candidates lookup table), maintool bar and icon
> > indicator in the systray.
> >
> > I just found in my box, when I am typing very fast, the preedit string
> > ( IMCompose event is used to draw these preedit strings) will flicker
> > somehow.
> >
> > ----------quoted from Qt doc--------------
> > sendEvent() processes the event immediately - when sendEvent()
> > returns, (the event filters and) the object have already processed the
> > event. For many event classes there is a function called isAccepted()
> > that tells you whether the event was accepted or rejected by the last
> > handler that was called.
> >
> > postEvent() posts the event on a queue for later dispatch. The next
> > time Qt's main event loop runs, it dispatches all posted events, with
> > some optimization. For example, if there are several resize events,
> > they are are compacted into one. The same applies to paint events:
> > QWidget::update() calls postEvent(), which minimizes flickering and
> > increases speed by avoiding multiple repaints.
> > ------------------end--------------------------
> >
> > Based up the doc, I think if postEvent is used we can implement some
> > "optimization." just as qt does for  paint events: QWidget::update():
> > if the user types very fast and generates several IMCompose before
> > entering the next event loop, we can just abandon all of them except
> > the last one.
> >
> > Just a thought. Eager to hear your view about this.
> >
> > Regards,
> > Cougar
>
> _______________________________________________
> Immodule-qt mailing list
> Immodule-qt at freedesktop.org
> http://freedesktop.org/mailman/listinfo/immodule-qt




More information about the immodule-qt mailing list