Mutiple selection is not possible with Motif 2.2

We have just ported our application from Solaris to Linux. Ours is a 32-bit application built with C++, Xwindows and Unix and is running on x86 platform. Everything works fine in Redhat Linux. But the problem is with multiple selection. Multiple selection of components using Ctrl Key is not working in Redhat Linux.

While debugging it has been found that the Button press event after a Key Press event( Ctrl Key + Mouse click) cannot be handled correctly.

Here is the code flow for recognizing and handling the events

Quote:

while (*loop)
{
count++;
XtAppNextEvent( gui.app_context, &xevent );
Dispatch = True;
// Event types defined in X.h
switch(xevent.type)
{
case KeyPress:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " state " << xevent.xkey.state
<< " kcode " << xevent.xkey.keycode << endl;
#endif
case KeyRelease:
case ButtonPress:
case ButtonRelease:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
#endif
case MotionNotify:
// cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
if(GuiTimerRestart != 0)
{
GuiTimerRestart();
}
break;

case ClientMessage:
#ifdef guixtTRACK_EVENTS
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
#endif
/* printing sync with opening and closing windows */
if (xevent.xclient.data.b[0] == guixtDEFINE_P)
{
XFlush( xevent.xany.display );
guixtPrintFptr();
Dispatch = False;
}
/* indirectly set wait for last expose */
else
if (xevent.xclient.data.b[0] == guixtDEFINE_Q)
{
XClientMessageEvent msg;
XFlush( xevent.xany.display );
msg.type = ClientMessage;
msg.format = 8;
msg.display = xevent.xexpose.display;
msg.window = xevent.xexpose.window;
strcpy(msg.data.b,guixtDEFINE_P_STRING);
XSendEvent(msg.display, msg.window,
FALSE, 0, (XEvent *)&msg);
Dispatch = False;

}
break;

#ifdef guixtTRACK_EVENTS

case ConfigureNotify:
{
XConfigureEvent* cfg = (XConfigureEvent*) &xevent;

cout << eloop << " " << count << guixtEvents[xevent.type]
<< " Event (win) " << cfg->event
<< " Window " << cfg->window << endl;
}
break;

case Expose:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << xevent.xexpose.count << endl;
break;

case GraphicsExpose:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << xevent.xgraphicsexpose.count << endl;
break;

case MapNotify:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << (void*)(xevent.xmap.window) << endl;
break;

case UnmapNotify:
cout << eloop << " " << count << guixtEvents[xevent.type]
<< " " << (void*) (xevent.xunmap.window) << endl;
break;
#endif
default:
#ifdef guixtTRACK_EVENTS
if (xevent.type < LASTEvent)
cout << eloop << " " << count << guixtEvents[xevent.type] << endl;
else
cout << eloop << " " << count << " User defined " << xevent.type << endl;
#endif
break;
}
XtDispatchEvent( &xevent );
}
eloop--;
}

Each event is recognized and is handled by the XtDispatchEvent( &xevent ) Xwindow call. When a button press event arrives after a key press event, XtDispatchEvent( &xevent ) function is not handling that properly. This function is not sending the Button press event to the function written by us for handling the events. Only Button Release event is passed by the function. As a result multiple selection fails.

The motif version that we use is 2.2 and the OS is Redhat Enterprise Linux 4.4.

Please help me to solve this issue..