[PATCH 2/2] shell32: Add IInputObject stub to IExplorerBrowser.

David Hedberg david.hedberg at gmail.com
Tue Dec 21 19:20:48 CST 2010


---
 dlls/shell32/ebrowser.c       |   67 ++++++++++++++++++++++++++++
 dlls/shell32/tests/ebrowser.c |   98 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c
index 50e5a4f..ea44337 100644
--- a/dlls/shell32/ebrowser.c
+++ b/dlls/shell32/ebrowser.c
@@ -58,6 +58,7 @@ typedef struct _ExplorerBrowserImpl {
     ICommDlgBrowser3  ICommDlgBrowser3_iface;
     IObjectWithSite   IObjectWithSite_iface;
     INameSpaceTreeControlEvents INameSpaceTreeControlEvents_iface;
+    IInputObject      IInputObject_iface;
     LONG ref;
     BOOL destroyed;
 
@@ -790,6 +791,10 @@ static HRESULT WINAPI IExplorerBrowser_fnQueryInterface(IExplorerBrowser *iface,
     {
         *ppvObject = &This->IObjectWithSite_iface;
     }
+    else if(IsEqualIID(riid, &IID_IInputObject))
+    {
+        *ppvObject = &This->IInputObject_iface;
+    }
 
     if(*ppvObject)
     {
@@ -1971,6 +1976,67 @@ const INameSpaceTreeControlEventsVtbl vt_INameSpaceTreeControlEvents =  {
     NSTCEvents_fnOnGetDefaultIconIndex
 };
 
+/**************************************************************************
+ * IInputObject Implementation
+ */
+
+static inline ExplorerBrowserImpl *impl_from_IInputObject(IInputObject *iface)
+{
+    return CONTAINING_RECORD(iface, ExplorerBrowserImpl, IInputObject_iface);
+}
+
+static HRESULT WINAPI IInputObject_fnQueryInterface(IInputObject *iface,
+                                                    REFIID riid, void **ppvObject)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    TRACE("%p\n", This);
+    return IUnknown_QueryInterface((IUnknown*)This, riid, ppvObject);
+}
+
+static ULONG WINAPI IInputObject_fnAddRef(IInputObject *iface)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    TRACE("%p\n", This);
+    return IUnknown_AddRef((IUnknown*)This);
+}
+
+static ULONG WINAPI IInputObject_fnRelease(IInputObject *iface)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    TRACE("%p\n", This);
+    return IUnknown_Release((IUnknown*)This);
+}
+
+static HRESULT WINAPI IInputObject_fnUIActivateIO(IInputObject *iface, BOOL fActivate, MSG *pMsg)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    FIXME("stub, %p (%d, %p)\n", This, fActivate, pMsg);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IInputObject_fnHasFocusIO(IInputObject *iface)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    FIXME("stub, %p\n", This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IInputObject_fnTranslateAcceleratorIO(IInputObject *iface, MSG *pMsg)
+{
+    ExplorerBrowserImpl *This = impl_from_IInputObject(iface);
+    FIXME("stub, %p (%p)\n", This, pMsg);
+    return E_NOTIMPL;
+}
+
+static IInputObjectVtbl vt_IInputObject = {
+    IInputObject_fnQueryInterface,
+    IInputObject_fnAddRef,
+    IInputObject_fnRelease,
+    IInputObject_fnUIActivateIO,
+    IInputObject_fnHasFocusIO,
+    IInputObject_fnTranslateAcceleratorIO
+};
+
 HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
 {
     ExplorerBrowserImpl *eb;
@@ -1990,6 +2056,7 @@ HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, voi
     eb->ICommDlgBrowser3_iface.lpVtbl = &vt_ICommDlgBrowser3;
     eb->IObjectWithSite_iface.lpVtbl  = &vt_IObjectWithSite;
     eb->INameSpaceTreeControlEvents_iface.lpVtbl = &vt_INameSpaceTreeControlEvents;
+    eb->IInputObject_iface.lpVtbl     = &vt_IInputObject;
 
     /* Default settings */
     eb->navpane.width = 150;
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 15c2cb4..caaab05 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -1607,6 +1607,103 @@ static void test_GetCurrentView(void)
     IExplorerBrowser_Release(peb);
 }
 
+static void test_InputObject(void)
+{
+    IExplorerBrowser *peb;
+    IShellFolder *psf;
+    IInputObject *pio;
+    HRESULT hr;
+    RECT rc;
+    UINT i;
+    WPARAM supported_key_accels[] = { /* Win7 */
+        VK_RETURN, VK_PRIOR, VK_NEXT, VK_END, VK_HOME, VK_LEFT, VK_UP, VK_RIGHT,
+        VK_DOWN, VK_F10, 0 };
+    MSG msg_a = {
+        hwnd,
+        supported_key_accels[1],
+        0,0,
+        GetTickCount(),
+        {5, 2}
+    };
+
+    ebrowser_instantiate(&peb);
+    hr = IExplorerBrowser_QueryInterface(peb, &IID_IInputObject, (void**)&pio);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    if(FAILED(hr))
+    {
+        win_skip("IInputObject not supported.\n");
+        return;
+    }
+
+    /* Before initializing */
+    hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_HasFocusIO(pio);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_UIActivateIO(pio, TRUE, &msg_a);
+    todo_wine ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_HasFocusIO(pio);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    rc.left = 0; rc.top = 0; rc.right = 100; rc.bottom = 100;
+    hr = IExplorerBrowser_Initialize(peb, hwnd, &rc, NULL);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_HasFocusIO(pio);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
+    todo_wine ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+
+    /* Browse to the desktop */
+    SHGetDesktopFolder(&psf);
+    hr = IExplorerBrowser_BrowseToObject(peb, (IUnknown*)psf, SBSP_DEFBROWSER);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    IShellFolder_Release(psf);
+
+    hr = IInputObject_UIActivateIO(pio, TRUE, &msg_a);
+    todo_wine ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_HasFocusIO(pio);
+    todo_wine ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_UIActivateIO(pio, FALSE, &msg_a);
+    todo_wine ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    hr = IInputObject_HasFocusIO(pio);
+    todo_wine ok(hr == S_OK, "Got 0x%08x\n", hr);
+
+    for(i = 0; i < 0x100; i++)
+    {
+        BOOL found = FALSE;
+        UINT j;
+        for(j = 0; supported_key_accels[j] != 0; j++)
+            if(supported_key_accels[j] == i)
+            {
+                found = TRUE;
+                break;
+            }
+
+        msg_a.wParam = i;
+        process_msgs();
+        hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
+        todo_wine ok(hr == (found ? S_OK : S_FALSE) || broken(hr == S_FALSE) /* Vista, W2k8 */,
+                     "Got 0x%08x (%04x)\n", hr, i);
+    }
+
+    process_msgs();
+
+    IInputObject_Release(pio);
+    IExplorerBrowser_Destroy(peb);
+    IExplorerBrowser_Release(peb);
+}
+
 static BOOL test_instantiate_control(void)
 {
     IExplorerBrowser *peb;
@@ -1658,6 +1755,7 @@ START_TEST(ebrowser)
     test_navigation();
     test_GetCurrentView();
     test_SetSite();
+    test_InputObject();
 
     DestroyWindow(hwnd);
     OleUninitialize();
-- 
1.7.3.4




More information about the wine-patches mailing list