]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/webview_ie.cpp
adapting char event handling to msw / gtk, see #13415, see #14197
[wxWidgets.git] / src / msw / webview_ie.cpp
index 439d37dd642f1959577dded01e81c7083d9aaf33..c42c1a00eacdf34a0604d8b13fa0a95419000b23 100644 (file)
@@ -560,6 +560,7 @@ bool wxWebViewIE::CanCopy() const
 {
     return CanExecCommand("Copy");
 }
+
 bool wxWebViewIE::CanPaste() const
 {
     return CanExecCommand("Paste");
@@ -584,6 +585,7 @@ bool wxWebViewIE::CanUndo() const
 {
     return CanExecCommand("Undo");
 }
+
 bool wxWebViewIE::CanRedo() const
 {
     return CanExecCommand("Redo");
@@ -872,12 +874,13 @@ void wxWebViewIE::ExecCommand(wxString command)
 
 IHTMLDocument2* wxWebViewIE::GetDocument() const
 {
-    IDispatch* dispatch;
+    IDispatch* dispatch = NULL;
     HRESULT result = m_webBrowser->get_Document(&dispatch);
-    if(SUCCEEDED(result))
+    if(dispatch && SUCCEEDED(result))
     {
         IHTMLDocument2* document;
         dispatch->QueryInterface(IID_IHTMLDocument2, (void**)&document);
+        dispatch->Release();
         //document is set to null automatically if the interface isn't supported
         return document;
     }
@@ -892,8 +895,8 @@ bool wxWebViewIE::EnableControlFeature(long flag, bool enable)
 #if wxUSE_DYNLIB_CLASS
 
     wxDynamicLibrary urlMon(wxT("urlmon.dll"));
-    if( urlMon.IsLoaded() && 
-        urlMon.HasSymbol("CoInternetSetFeatureEnabled") && 
+    if( urlMon.IsLoaded() &&
+        urlMon.HasSymbol("CoInternetSetFeatureEnabled") &&
         urlMon.HasSymbol("CoInternetIsFeatureEnabled"))
     {
         typedef HRESULT (WINAPI *CoInternetSetFeatureEnabled_t)(DWORD, DWORD, BOOL);
@@ -1296,7 +1299,7 @@ STDMETHODIMP ClassFactory::LockServer(BOOL fLock)
     return S_OK;
 }
 
-wxIEContainer::wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk, 
+wxIEContainer::wxIEContainer(wxWindow *parent, REFIID iid, IUnknown *pUnk,
                              DocHostUIHandler* uiHandler) :
     wxActiveXContainer(parent,iid,pUnk)
 {
@@ -1307,7 +1310,7 @@ wxIEContainer::~wxIEContainer()
 {
 }
 
-bool wxIEContainer::QueryClientSiteInterface(REFIID iid, void **_interface, 
+bool wxIEContainer::QueryClientSiteInterface(REFIID iid, void **_interface,
                                              const char *&desc)
 {
     if (m_uiHandler && IsEqualIID(iid, wxIID_IDocHostUIHandler))
@@ -1319,8 +1322,8 @@ bool wxIEContainer::QueryClientSiteInterface(REFIID iid, void **_interface,
     return false;
 }
 
-HRESULT DocHostUIHandler::ShowContextMenu(DWORD dwID, POINT *ppt, 
-                                          IUnknown *pcmdtReserved, 
+HRESULT DocHostUIHandler::ShowContextMenu(DWORD dwID, POINT *ppt,
+                                          IUnknown *pcmdtReserved,
                                           IDispatch *pdispReserved)
 {
     wxUnusedVar(dwID);
@@ -1332,13 +1335,13 @@ HRESULT DocHostUIHandler::ShowContextMenu(DWORD dwID, POINT *ppt,
 
 HRESULT DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO *pInfo)
 {
-    //don't show 3d border and ebales themes.
+    //don't show 3d border and enable themes.
     pInfo->dwFlags = pInfo->dwFlags | DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME;
     return S_OK;
 }
 
 HRESULT DocHostUIHandler::ShowUI(DWORD dwID,
-                                 IOleInPlaceActiveObject *pActiveObject, 
+                                 IOleInPlaceActiveObject *pActiveObject,
                                  IOleCommandTarget *pCommandTarget,
                                  IOleInPlaceFrame *pFrame,
                                  IOleInPlaceUIWindow *pDoc)
@@ -1379,7 +1382,7 @@ HRESULT DocHostUIHandler::OnFrameWindowActivate(BOOL fActivate)
     return E_NOTIMPL;
 }
 
-HRESULT DocHostUIHandler::ResizeBorder(LPCRECT prcBorder, 
+HRESULT DocHostUIHandler::ResizeBorder(LPCRECT prcBorder,
                                        IOleInPlaceUIWindow *pUIWindow,
                                        BOOL fFrameWindow)
 {
@@ -1389,7 +1392,7 @@ HRESULT DocHostUIHandler::ResizeBorder(LPCRECT prcBorder,
     return E_NOTIMPL;
 }
 
-HRESULT DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg, 
+HRESULT DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg,
                                                const GUID *pguidCmdGroup,
                                                DWORD nCmdID)
 {
@@ -1398,10 +1401,15 @@ HRESULT DocHostUIHandler::TranslateAccelerator(LPMSG lpMsg,
         //control is down?
         if((GetKeyState(VK_CONTROL) & 0x8000 ))
         {
-            //skip CTRL-N, CTRL-F and CTRL-P
-            if(lpMsg->wParam == 'N' || lpMsg->wParam == 'P' || lpMsg->wParam == 'F')
+            //skip the accelerators used by the control
+            switch(lpMsg->wParam)
             {
-                return S_OK;
+                case 'F':
+                case 'L':
+                case 'N':
+                case 'O':
+                case 'P':
+                    return S_OK;
             }
         }
         //skip F5