[immodule-qt] Re: receiving order inversion between QKeyEvent and QIMEvent (Re: [SCIM] scim-qtimm 0.7 released)
Kazuki Ohta
mover at hct.zaq.ne.jp
Wed Sep 8 01:49:18 EEST 2004
Hi, Yamaken.
Your patch looks OK to me, too.
# This patch also resolved the uim-skk's segfault bug.
# Great job!:-)
On Tuesday 07 September 2004 23:53, YamaKen wrote:
> Hi Cougar, Kazuki,
>
> At Mon, 6 Sep 2004 16:26:49 +0000,
>
> liucougar at gmail.com wrote:
> > On Tue, 07 Sep 2004 01:07:53 +0900, YamaKen <yamaken at bp.iij4u.or.jp>
wrote:
> > > In addition, QApplication::postIMEvent() is inappropriate place
> > > to implement such functionality. The implementation violates
> > > abstract event queue interface and prevents the possible change
> > > of internal event queue implementation. Keep in mind following
> > > issues to modify Qt.
> > >
> > > - What is proper way?
> > > - What is intention of author?
> > > - Which part of code is responsible for the functionality?
> >
> > It seems to me that your new patch can not solve the issue raised in
> > this thread. Do you have any other ideas to solve this problem?
>
> I've written a patch for the problem. It performs almost as same
> as yours and Kazuki's, but in proper way that I think.
>
> It differs as follows.
>
> - thread safe
> - remove IMCompose only when IMEnd is sent
> - remove IMCompose by QApplication::removePostedEvents() as
> proper responsibility separation (new overloading method has
> been added)
>
> The patch is prepared as supplement to the unified patch
> 20040819. Anyone, try it. I'll add it to our download page if it
> raises no problem.
>
> The patch also contains another fix for QIMEvent compression bug
> that posted by me yesterday.
>
> > At Mon, 6 Sep 2004 15:39:23 +0900,
> >
> > mover at hct.zaq.ne.jp wrote:
> > > More refactored version is here.
> > > This code is based on the code of QApplication::notify.
> > > I think this code is more cleaner.
> > >
> > > void QApplication::postIMEvent( QObject *receiver, QIMEvent *event )
> > > {
> > > if( event->type() == QEvent::IMCompose )
> > > postEvent( receiver, event );
> > > else {
> > > if (receiver->postedEvents) {
> > > //get rid of IMCompose event posted before
> > > QPostEventList * l = receiver->postedEvents;
> > > QPostEvent * pe;
> > > l->first();
> > > while( ( pe = l->current()) != 0 ) {
> > > if ( pe->event && pe->receiver == receiver &&
> > > pe->event->type() == QEvent::IMCompose ) {
> > > pe->event->posted = FALSE;
> > > delete pe->event;
> > > pe->event = 0;
> > > l->remove();
> > > continue;
> > > }
> > > l->next();
> > > }
> > > sendEvent( receiver, event );
> > > delete event;
> > > }
> > > }
> > > }
> > >
> > > On Monday 06 September 2004 12:34, LiuCougar wrote:
> > > > On Mon, 6 Sep 2004 11:27:26 +0800, Zhe Su <james.su at gmail.com> wrote:
> > > > > Hi,
> > > > > I just read though this new code, and found that there is no exit
> > > > > point in the for (;;) {...} loop. Is it correct?
> > > >
> > > > Oops, sorry about that, the rectified version is:
> > > > void QApplication::postIMEvent( QObject *receiver, QIMEvent *event )
> > > > {
> > > > if( event->type() == QEvent::IMCompose )
> > > > postEvent( receiver, event );
> > > > else {
> > > > QPostEventList * l = receiver->postedEvents;
> > > >
> > > > //get rid of IMCompose event posted before
> > > > if ( event->type() == QEvent::IMCompose ) {
> > > > l->first();
> > > > QPostEvent * cur = 0;
> > > > for ( ;; ) {
> > > > while ( (cur=l->current()) != 0 &&
> > > > ( cur->receiver != receiver ||
> > > > cur->event == 0 ||
> > > > cur->event->type() != event->type() ) )
> > > > l->next();
> > > > if ( l->current() != 0 ) {
> > > > if ( cur->event->type() == QEvent::IMCompose ) {
> > > > delete cur->event;
> > > > l->remove(cur);
> > > > }
> > > > } else
> > > > break;
> > > > }
> > > > }
> > > > sendEvent( receiver, event );
> > > > delete event;
> > > > }
> > > > }
> > > >
> > > > Thanks for correcting me ;)
>
> -------------------------------
> YamaKen yamaken at bp.iij4u.or.jp
--
---------------------------------
Move the worl:D!
Kazuki Ohta : mover at hct.zaq.ne.jp
More information about the immodule-qt
mailing list