Based on my current experience, all GTK+ apps can respond to iLiad buttons without any problem. But I found that I can't make QT based app (djview4) and wxWidgets based app (xCHM) respond to iLiad button, even though I can control iLiad led flash and use touch-pen as mouse in these apps.
My current understanding is:
Contentlister will grab all iLiad button-events by calling button driver. Then, a button-event will be translated to an X event and transferred to the foreground x-client using the following function in programManager.c:
Code:
void pm_SendKey(KeySym keysym)
{
XKeyEvent xev;
Display *display;
Window window, root;
int screen;
display = gdk_x11_display_get_xdisplay(gdk_display_get_default());
root = gdk_x11_get_default_root_xwindow();
window = pm_getWinOnTop();
if (window == -1)
{
CL_ERRORPRINTF("Failed: no valid window found");
return;
}
if (window == g_myWin)
{
CL_PMPRINTF("ContentLister window 0x%x", (unsigned int)window);
display = XOpenDisplay(NULL);
screen = DefaultScreen(display);
root = RootWindow(display, screen);
}
// create and send a keypress event followed by a keyrelease event
xev.type = KeyPress;
xev.display = display;
xev.root = root;
xev.window = window;
xev.subwindow = None;
xev.time = pm_fake_timestamp();
xev.x = 1;
xev.y = 1;
xev.x_root = 1;
xev.y_root = 1;
xev.same_screen = 1;
xev.state = 0;
xev.keycode = XKeysymToKeycode(display, keysym);
// CL_ERRORPRINTF("Sending keypress....");
XSendEvent(xev.display, window, 1, KeyPressMask, (XEvent *) & xev);
// We check to see if this is the UP key
// so we don't send the release event for that, because it
// can crash the contentLister with a BadWindow error (req.code 25)
if ( keysym == GDK_F5 )
{
CL_ERRORPRINTF("NOT Sending keyrelease for UP key....");
}
else
{
// usleep(2000); // MvdW: this usleep doesn't seem to be nescessary
xev.type = KeyRelease;
xev.time = pm_fake_timestamp();
XSendEvent(xev.display, window, 1, KeyReleaseMask, (XEvent *) & xev);
}
//XSync(xev.display, 1);
XSync(xev.display, FALSE);
if (window == g_myWin)
{
CL_PMPRINTF("Before XCloseDisplay()");
XCloseDisplay(display);
}
}
I just can't figure out why do these x apps can't respond to iLiad button event. Does anybody have an idea how to solve or trace the problem?