Skip to content

Commit fdf2772

Browse files
committed
Yet another fix to the problem with DoVerb (David Manura)
1 parent 3913335 commit fdf2772

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

luacom/tLuaControl.cpp

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
extern "C"
2020
{
2121
#include "..\lua.h"
22-
#include "..\lauxlib.h"
22+
#include "..\lualib.h"
2323
#include "LuaCompat.h"
2424
}
2525

@@ -36,6 +36,7 @@ const OLEVERB verbs[] = {
3636
{ OLEIVERB_PRIMARY, 0, 0, 0},
3737
{ OLEIVERB_UIACTIVATE, 0, 0, 0}
3838
};
39+
//unused: OLEIVERB_PRIMARY, OLEIVERB_OPEN, OLEIVERB_DISCARDUNDOSTATE
3940

4041
#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
4142
const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
@@ -742,46 +743,32 @@ STDMETHODIMP tLuaControl::GetClipboardData(DWORD dwReserved, IDataObject** ppDat
742743
STDMETHODIMP tLuaControl::DoVerb(LONG lVerb, LPMSG pMsg, IOleClientSite *pActiveSite,
743744
LONG lIndex, HWND hwndParent, LPCRECT prcPosRect)
744745
{
745-
HRESULT hr = OLEOBJ_S_INVALIDVERB; // See Lua mailing list (NJG)
746+
HRESULT hr;
746747

747748
switch (lVerb) {
748749
case OLEIVERB_SHOW:
749750
case OLEIVERB_INPLACEACTIVATE:
750751
case OLEIVERB_UIACTIVATE:
751-
hr = InPlaceActivate(lVerb==OLEIVERB_UIACTIVATE);
752-
return (hr);
753-
752+
hr = InPlaceActivate(lVerb == OLEIVERB_UIACTIVATE);
753+
return hr;
754+
//FIX: handle cases for in-place activatable v.s. nonactivatable objects?
755+
// e.g. for OLEIVERB_UIACTIVATE, "If the object does not support in-place
756+
// activation, it should return E_NOTIMPL" (msdn)
754757
case OLEIVERB_HIDE:
755758
UIDeactivate();
756759
if (m_fInPlaceVisible) SetInPlaceVisible(FALSE);
757760
return S_OK;
758-
759761
default:
760-
// if it's a derived-control defined verb, pass it on to them
761-
//
762-
if (lVerb > 0) {
763-
764-
// FIX-TODO!!! hr is undefined here.
765-
// http://lua-users.org/lists/lua-l/2006-09/msg00030.html
766-
// #pragma message("FIX - luacom bug http://lua-users.org/lists/lua-l/2006-09/msg00030.html")
767-
// FAIL("FIX - luacom bug lua-l/2006-09/msg00030.html");
768-
769-
if (hr == OLEOBJ_S_INVALIDVERB) {
770-
// unrecognised verb -- just do the primary verb and
771-
// activate the sucker.
772-
//
773-
hr = InPlaceActivate(0);
774-
return (FAILED(hr)) ? hr : OLEOBJ_S_INVALIDVERB;
775-
} else
776-
return hr;
777-
} else {
778-
FAIL("Unrecognized Negative verb in DoVerb(). bad.");
762+
if (lVerb > 0) { // derived control defined verb
763+
// treat unrecognized verb as OLEIVERB_PRIMARY (i.e. just activate in some way)
764+
hr = InPlaceActivate(0);
765+
return FAILED(hr) ? hr : OLEOBJ_S_INVALIDVERB;
766+
} else { // unrecognized negative verb
779767
return E_NOTIMPL;
780768
}
781769
break;
782770
}
783771

784-
// dead code
785772
FAIL("this should be dead code!");
786773
}
787774

0 commit comments

Comments
 (0)