[webkit-help] emulate click

scostas scostas at det.uvigo.es
Mon Feb 1 11:28:45 PST 2010


Hi all:

I'm developing an embedded browser with webkit, but I have problems when 
emulating the mouse click. I'm using the code posted at the end of this 
message. It works fine in all cases, except when I open a SELECT input: 
in that case it opens, but fails when I click the option I want. I 
suspect that is a problem with windows, but I don't know how to fix it.

Is there another way of emulating the mouse click?

Thanks.

Current code:

    XEvent event;

    Display *display;

    display=XOpenDisplay(NULL);

    memset(&event, 0x00, sizeof(event));

    event.type = ButtonPress;
    event.xbutton.button = button;
    event.xbutton.same_screen = True;

    XQueryPointer(display, RootWindow(display, DefaultScreen(display)), 
&event.xbutton.root, &event.xbutton.window, &event.xbutton.x_root, 
&event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, 
&event.xbutton.state);
    event.xbutton.subwindow = event.xbutton.window;

    while(event.xbutton.subwindow) {
        event.xbutton.window = event.xbutton.subwindow;
        XQueryPointer(display, event.xbutton.window, 
&event.xbutton.root, &event.xbutton.subwindow, &event.xbutton.x_root, 
&event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, 
&event.xbutton.state);
    }

    XSendEvent(display, PointerWindow, True, 0xfff, &event);
    XFlush(display);
    usleep(100000);
    event.type = ButtonRelease;
    event.xbutton.state = 0x100;
    XSendEvent(display, PointerWindow, True, 0xfff, &event);
    XFlush(display);




More information about the webkit-help mailing list