[immodule-qt] receiving order inversion between QKeyEvent and QIMEvent (Re: [SCIM] scim-qtimm 0.7 released)
YamaKen
yamaken at bp.iij4u.or.jp
Tue Sep 7 17:53:05 EEST 2004
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt-x11-immodule-unified-qt3.3.3-20040819-event-inversion-20040907.diff
Type: application/octet-stream
Size: 4053 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/immodule-qt/attachments/20040907/e455d505/attachment.obj
More information about the immodule-qt
mailing list