David Hedberg : shell32: Add IInputObject stub to ExplorerBrowser.

Alexandre Julliard julliard at winehq.org
Thu Dec 23 11:28:06 CST 2010


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

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Thu Dec 23 14:52:30 2010 +0100

shell32: Add IInputObject stub to ExplorerBrowser.

---

 dlls/shell32/ebrowser.c       |   67 +++++++++++++++++++++++++
 dlls/shell32/tests/ebrowser.c |  109 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 176 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..a221f97 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -1607,6 +1607,114 @@ 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_mode1[] = {
+        VK_BACK, VK_TAB, VK_RETURN, VK_PRIOR, VK_NEXT, VK_END, VK_HOME,
+        VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_DELETE, VK_F1, VK_F2,
+        VK_F5, VK_F6, VK_F10, 0 };
+    WPARAM supported_key_accels_mode2[] = {
+        VK_RETURN, VK_PRIOR, VK_NEXT, VK_END, VK_HOME,
+        VK_LEFT, VK_UP, VK_RIGHT, VK_DOWN, VK_DELETE, VK_F1, VK_F2,
+        VK_F10, 0 };
+    WPARAM *key_accels;
+    MSG msg_a = {
+        hwnd,
+        WM_KEYDOWN,
+        VK_F5, 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);
+
+    hr = IInputObject_TranslateAcceleratorIO(pio, &msg_a);
+    if(hr == S_OK)
+        key_accels = supported_key_accels_mode1;
+    else
+        key_accels = supported_key_accels_mode2;
+
+    for(i = 0; i < 0x100; i++)
+    {
+        BOOL found = FALSE;
+        UINT j;
+        for(j = 0; key_accels[j] != 0; j++)
+            if(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), "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 +1766,7 @@ START_TEST(ebrowser)
     test_navigation();
     test_GetCurrentView();
     test_SetSite();
+    test_InputObject();
 
     DestroyWindow(hwnd);
     OleUninitialize();




More information about the wine-cvs mailing list