2

I need to create a NPAPI browser plugin to show a picture. Till now, I have create that and draw a picture in plugin with GDK successfully, I catch the event in "NPP_HandleEvent()" function and get a GdkDrawable object with method "gdk_pixmap_lookup", just like the following codes:

int16_t NPP_HandleEvent(NPP instance, void* event) {

    XGraphicsExposeEvent *expose = &nativeEvent->xgraphicsexpose;

    instanceData->window.window = (void*)(expose->drawable);

    GdkNativeWindow nativeWinId = (XID)(instanceData->window.window);

    GdkDrawable* gdkWindow = GDK_DRAWABLE(gdk_pixmap_lookup(xid));

    NPSetWindowCallbackStruct *ws_info = (NPSetWindowCallbackStruct*)(instanceData->window.ws_info);

    GdkVisual* gdkVisual = gdkx_visual_get(ws_info->visual ? XVisualIDFromVisual(ws_info->visual) : 0);

    GdkColormap* gdkColormap = gdk_x11_colormap_foreign_new(gdkVisual, ws_info->colormap);

    gdk_drawable_set_colormap(gdkWindow, gdkColormap);

    // another method, to use GdkWindow to draw picture.
    drawWindow(instanceData, gdkWindow);

}

so now, I'm wondering how to use QT methods draw a picture in this plugin ? any ways just use QT and X11 releated stubs to implement this ?

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
darkwind
  • 43
  • 3

0 Answers0