Jacek Caban : mshtml: Added QuickActivation support.

Alexandre Julliard julliard at winehq.org
Mon Dec 6 13:18:34 CST 2010


Module: wine
Branch: master
Commit: 410501e6c91397a91746d55e87d40acccb793e0a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=410501e6c91397a91746d55e87d40acccb793e0a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec  6 18:49:00 2010 +0100

mshtml: Added QuickActivation support.

---

 dlls/mshtml/npplugin.c   |   12 +++++++++-
 dlls/mshtml/pluginhost.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/mshtml/pluginhost.h |    2 +
 3 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c
index 1439d17..60f2125 100644
--- a/dlls/mshtml/npplugin.c
+++ b/dlls/mshtml/npplugin.c
@@ -303,8 +303,16 @@ static NPError CDECL NPP_Destroy(NPP instance, NPSavedData **save)
 
 static NPError CDECL NPP_SetWindow(NPP instance, NPWindow *window)
 {
-    FIXME("(%p %p)\n", instance, window);
-    return NPERR_GENERIC_ERROR;
+    PluginHost *host = instance->pdata;
+    RECT pos_rect = {0, 0, window->width, window->height};
+
+    TRACE("(%p %p)\n", instance, window);
+
+    if(!host)
+        return NPERR_GENERIC_ERROR;
+
+    update_plugin_window(host, window->window, &pos_rect);
+    return NPERR_NO_ERROR;
 }
 
 static NPError CDECL NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, UINT16 *stype)
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index b2f2f70..5b04399 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -36,6 +36,57 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
+static void activate_plugin(PluginHost *host)
+{
+    IClientSecurity *client_security;
+    IQuickActivate *quick_activate;
+    HRESULT hres;
+
+    if(!host->plugin_unk)
+        return;
+
+    /* Note native calls QI on plugin for an undocumented IID and CLSID_HTMLDocument */
+
+    /* FIXME: call FreezeEvents(TRUE) */
+
+    hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IClientSecurity, (void**)&client_security);
+    if(SUCCEEDED(hres)) {
+        FIXME("Handle IClientSecurity\n");
+        IClientSecurity_Release(client_security);
+        return;
+    }
+
+    hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IQuickActivate, (void**)&quick_activate);
+    if(SUCCEEDED(hres)) {
+        QACONTAINER container = {sizeof(container)};
+        QACONTROL control = {sizeof(control)};
+
+        container.pClientSite = &host->IOleClientSite_iface;
+        container.dwAmbientFlags = QACONTAINER_SUPPORTSMNEMONICS|QACONTAINER_MESSAGEREFLECT|QACONTAINER_USERMODE;
+        container.pAdviseSink = NULL; /* FIXME */
+        container.pPropertyNotifySink = NULL; /* FIXME */
+
+        hres = IQuickActivate_QuickActivate(quick_activate, &container, &control);
+        if(FAILED(hres))
+            FIXME("QuickActivate failed: %08x\n", hres);
+    }else {
+        FIXME("No IQuickActivate\n");
+    }
+}
+
+void update_plugin_window(PluginHost *host, HWND hwnd, const RECT *rect)
+{
+    if(!hwnd || (host->hwnd && host->hwnd != hwnd)) {
+        FIXME("unhandled hwnd\n");
+        return;
+    }
+
+    if(!host->hwnd) {
+        host->hwnd = hwnd;
+        activate_plugin(host);
+    }
+}
+
 static inline PluginHost *impl_from_IOleClientSite(IOleClientSite *iface)
 {
     return CONTAINING_RECORD(iface, PluginHost, IOleClientSite_iface);
diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h
index a4624e3..5d53e08 100644
--- a/dlls/mshtml/pluginhost.h
+++ b/dlls/mshtml/pluginhost.h
@@ -24,6 +24,8 @@ typedef struct {
     LONG ref;
 
     IUnknown *plugin_unk;
+    HWND hwnd;
 } PluginHost;
 
 HRESULT create_plugin_host(IUnknown*,PluginHost**);
+void update_plugin_window(PluginHost*,HWND,const RECT*);




More information about the wine-cvs mailing list