[PATCH 3/6] riched20: Add ITextHost2 support and use it to get the window for WM_CONTEXTMENU.

Huw Davies huw at codeweavers.com
Fri Mar 26 04:08:02 CDT 2021


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/riched20/editor.c  |  60 ++++++-----
 dlls/riched20/editor.h  |  17 +++-
 dlls/riched20/editstr.h |   3 +-
 dlls/riched20/paint.c   |   2 +-
 dlls/riched20/txthost.c | 221 ++++++++++++++++++++++++++++++----------
 5 files changed, 222 insertions(+), 81 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 4eb90a4c300..4ac78f3d3cb 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2906,20 +2906,24 @@ static LONG ME_GetSelectionType(ME_TextEditor *editor)
 
 static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
 {
-  CHARRANGE selrange;
-  HMENU menu;
-  int seltype;
-
-  if(!editor->lpOleCallback || !editor->hWnd)
-    return FALSE;
-  ME_GetSelectionOfs(editor, &selrange.cpMin, &selrange.cpMax);
-  seltype = ME_GetSelectionType(editor);
-  if(SUCCEEDED(IRichEditOleCallback_GetContextMenu(editor->lpOleCallback, seltype, NULL, &selrange, &menu)))
-  {
-    TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, editor->hwndParent, NULL);
-    DestroyMenu(menu);
-  }
-  return TRUE;
+    CHARRANGE selrange;
+    HMENU menu;
+    int seltype;
+    HWND hwnd, parent;
+
+    if (!editor->lpOleCallback || !editor->have_texthost2) return FALSE;
+    if (FAILED( ITextHost2_TxGetWindow( editor->texthost, &hwnd ))) return FALSE;
+    parent = GetParent( hwnd );
+    if (!parent) parent = hwnd;
+
+    ME_GetSelectionOfs( editor, &selrange.cpMin, &selrange.cpMax );
+    seltype = ME_GetSelectionType( editor );
+    if (SUCCEEDED( IRichEditOleCallback_GetContextMenu( editor->lpOleCallback, seltype, NULL, &selrange, &menu ) ))
+    {
+        TrackPopupMenu( menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, parent, NULL );
+        DestroyMenu( menu );
+    }
+    return TRUE;
 }
 
 ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
@@ -2932,16 +2936,26 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
   ed->hWnd = NULL;
   ed->hwndParent = NULL;
   ed->sizeWindow.cx = ed->sizeWindow.cy = 0;
-  ed->texthost = texthost;
+  if (ITextHost_QueryInterface( texthost, &IID_ITextHost2, (void **)&ed->texthost ) == S_OK)
+  {
+    ITextHost_Release( texthost );
+    ed->have_texthost2 = TRUE;
+  }
+  else
+  {
+    ed->texthost = (ITextHost2 *)texthost;
+    ed->have_texthost2 = FALSE;
+  }
+
   ed->reOle = NULL;
   ed->bEmulateVersion10 = bEmulateVersion10;
   ed->in_place_active = FALSE;
   ed->total_rows = 0;
-  ITextHost_TxGetPropertyBits( texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY |
+  ITextHost_TxGetPropertyBits( ed->texthost, TXTBIT_RICHTEXT | TXTBIT_MULTILINE | TXTBIT_READONLY |
                                TXTBIT_USEPASSWORD | TXTBIT_HIDESELECTION | TXTBIT_SAVESELECTION |
                                TXTBIT_AUTOWORDSEL | TXTBIT_VERTICAL | TXTBIT_WORDWRAP | TXTBIT_DISABLEDRAG,
                                &ed->props );
-  ITextHost_TxGetScrollBars( texthost, &ed->scrollbars );
+  ITextHost_TxGetScrollBars( ed->texthost, &ed->scrollbars );
   ed->pBuffer = ME_MakeText();
   ed->nZoomNumerator = ed->nZoomDenominator = 0;
   ed->nAvailWidth = 0; /* wrap to client area */
@@ -3000,7 +3014,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
 
   ed->password_char = 0;
   if (ed->props & TXTBIT_USEPASSWORD)
-    ITextHost_TxGetPasswordChar( texthost, &ed->password_char );
+    ITextHost_TxGetPasswordChar( ed->texthost, &ed->password_char );
 
   ed->bWordWrap = (ed->props & TXTBIT_WORDWRAP) && (ed->props & TXTBIT_MULTILINE);
 
@@ -3025,20 +3039,20 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
   {
       if (ed->scrollbars & WS_VSCROLL)
       {
-          ITextHost_TxSetScrollRange( texthost, SB_VERT, 0, 1, TRUE );
-          ITextHost_TxEnableScrollBar( texthost, SB_VERT, ESB_DISABLE_BOTH );
+          ITextHost_TxSetScrollRange( ed->texthost, SB_VERT, 0, 1, TRUE );
+          ITextHost_TxEnableScrollBar( ed->texthost, SB_VERT, ESB_DISABLE_BOTH );
       }
       if (ed->scrollbars & WS_HSCROLL)
       {
-          ITextHost_TxSetScrollRange( texthost, SB_HORZ, 0, 1, TRUE );
-          ITextHost_TxEnableScrollBar( texthost, SB_HORZ, ESB_DISABLE_BOTH );
+          ITextHost_TxSetScrollRange( ed->texthost, SB_HORZ, 0, 1, TRUE );
+          ITextHost_TxEnableScrollBar( ed->texthost, SB_HORZ, ESB_DISABLE_BOTH );
       }
   }
 
   ed->wheel_remain = 0;
 
   ed->back_style = TXTBACK_OPAQUE;
-  ITextHost_TxGetBackStyle( texthost, &ed->back_style );
+  ITextHost_TxGetBackStyle( ed->texthost, &ed->back_style );
 
   list_init( &ed->reobj_list );
   OleInitialize(NULL);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index bf713880f8f..e923f35ed94 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -321,8 +321,8 @@ static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
 
 /* txthost.c */
 #ifdef __ASM_USE_THISCALL_WRAPPER
-extern const struct ITextHostVtbl text_host_stdcall_vtbl DECLSPEC_HIDDEN;
-#define TXTHOST_VTABLE(This) (&text_host_stdcall_vtbl)
+extern const struct ITextHost2Vtbl text_host2_stdcall_vtbl DECLSPEC_HIDDEN;
+#define TXTHOST_VTABLE(This) (&text_host2_stdcall_vtbl)
 #else
 #define TXTHOST_VTABLE(This) (This)->lpVtbl
 #endif
@@ -366,6 +366,19 @@ extern const struct ITextHostVtbl text_host_stdcall_vtbl DECLSPEC_HIDDEN;
 #define ITextHost_TxImmGetContext(This) TXTHOST_VTABLE(This)->TxImmGetContext(This)
 #define ITextHost_TxImmReleaseContext(This,a) TXTHOST_VTABLE(This)->TxImmReleaseContext(This,a)
 #define ITextHost_TxGetSelectionBarWidth(This,a) TXTHOST_VTABLE(This)->TxGetSelectionBarWidth(This,a)
+/* ITextHost2 */
+#define ITextHost2_TxIsDoubleClickPending(This) TXTHOST_VTABLE(This)->TxIsDoubleClickPending(This)
+#define ITextHost2_TxGetWindow(This,a) TXTHOST_VTABLE(This)->TxGetWindow(This,a)
+#define ITextHost2_TxSetForegroundWindow(This) TXTHOST_VTABLE(This)->TxSetForegroundWindow(This)
+#define ITextHost2_TxGetPalette(This) TXTHOST_VTABLE(This)->TxGetPalette(This)
+#define ITextHost2_TxGetEastAsianFlags(This,a) TXTHOST_VTABLE(This)->TxGetEastAsianFlags(This,a)
+#define ITextHost2_TxSetCursor2(This,a,b) TXTHOST_VTABLE(This)->TxSetCursor2(This,a,b)
+#define ITextHost2_TxFreeTextServicesNotification(This) TXTHOST_VTABLE(This)->TxFreeTextServicesNotification(This)
+#define ITextHost2_TxGetEditStyle(This,a,b) TXTHOST_VTABLE(This)->TxGetEditStyle(This,a,b)
+#define ITextHost2_TxGetWindowStyles(This,a,b) TXTHOST_VTABLE(This)->TxGetWindowStyles(This,a,b)
+#define ITextHost2_TxShowDropCaret(This,a,b,c) TXTHOST_VTABLE(This)->TxShowDropCaret(This,a,b,c)
+#define ITextHost2_TxDestroyCaret(This) TXTHOST_VTABLE(This)->TxDestroyCaret(This)
+#define ITextHost2_TxGetHorzExtent(This,a) TXTHOST_VTABLE(This)->TxGetHorzExtent(This,a)
 
 /* undo.c */
 BOOL add_undo_insert_run( ME_TextEditor *, int pos, const WCHAR *str, int len, int flags, ME_Style *style ) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h
index 6bf60748f7e..ffafa794015 100644
--- a/dlls/riched20/editstr.h
+++ b/dlls/riched20/editstr.h
@@ -378,10 +378,11 @@ typedef struct tagME_InStream ME_InStream;
 typedef struct tagME_TextEditor
 {
   HWND hWnd, hwndParent;
-  ITextHost *texthost;
+  ITextHost2 *texthost;
   IUnknown *reOle;
   unsigned int bEmulateVersion10 : 1;
   unsigned int in_place_active : 1;
+  unsigned int have_texthost2 : 1;
   ME_TextBuffer *pBuffer;
   ME_Cursor *pCursors;
   DWORD props;
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index 7b7882be2b7..979eb3e7365 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1071,7 +1071,7 @@ static void enable_show_scrollbar( ME_TextEditor *editor, INT bar, BOOL enable )
         ITextHost_TxShowScrollBar( editor->texthost, bar, enable );
 }
 
-static void set_scroll_range_pos( ITextHost *host, INT bar, SCROLLINFO *info, BOOL set_range )
+static void set_scroll_range_pos( ITextHost2 *host, INT bar, SCROLLINFO *info, BOOL set_range )
 {
     LONG max_pos = info->nMax, pos = info->nPos;
 
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index b624fcd377c..0618d6031ef 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
 
 struct host
 {
-    ITextHost ITextHost_iface;
+    ITextHost2 ITextHost_iface;
     LONG ref;
     ITextServices *text_srv;
     ME_TextEditor *editor; /* to be removed */
@@ -52,7 +52,7 @@ struct host
     WCHAR password_char;
 };
 
-static const ITextHostVtbl textHostVtbl;
+static const ITextHost2Vtbl textHostVtbl;
 
 static BOOL listbox_registered;
 static BOOL combobox_registered;
@@ -124,34 +124,34 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
     return texthost;
 }
 
-static inline struct host *impl_from_ITextHost( ITextHost *iface )
+static inline struct host *impl_from_ITextHost( ITextHost2 *iface )
 {
     return CONTAINING_RECORD( iface, struct host, ITextHost_iface );
 }
 
-static HRESULT WINAPI ITextHostImpl_QueryInterface( ITextHost *iface, REFIID riid, void **obj )
+static HRESULT WINAPI ITextHostImpl_QueryInterface( ITextHost2 *iface, REFIID iid, void **obj )
 {
     struct host *host = impl_from_ITextHost( iface );
 
-    if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextHost))
+    if (IsEqualIID( iid, &IID_IUnknown ) || IsEqualIID( iid, &IID_ITextHost ) || IsEqualIID( iid, &IID_ITextHost2 ))
     {
         *obj = &host->ITextHost_iface;
         ITextHost_AddRef( (ITextHost *)*obj );
         return S_OK;
     }
 
-    FIXME("Unknown interface: %s\n", debugstr_guid(riid));
+    FIXME( "Unknown interface: %s\n", debugstr_guid( iid ) );
     return E_NOINTERFACE;
 }
 
-static ULONG WINAPI ITextHostImpl_AddRef(ITextHost *iface)
+static ULONG WINAPI ITextHostImpl_AddRef( ITextHost2 *iface )
 {
     struct host *host = impl_from_ITextHost( iface );
     ULONG ref = InterlockedIncrement( &host->ref );
     return ref;
 }
 
-static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
+static ULONG WINAPI ITextHostImpl_Release( ITextHost2 *iface )
 {
     struct host *host = impl_from_ITextHost( iface );
     ULONG ref = InterlockedDecrement( &host->ref );
@@ -166,35 +166,35 @@ static ULONG WINAPI ITextHostImpl_Release(ITextHost *iface)
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4)
-DECLSPEC_HIDDEN HDC __thiscall ITextHostImpl_TxGetDC(ITextHost *iface)
+DECLSPEC_HIDDEN HDC __thiscall ITextHostImpl_TxGetDC( ITextHost2 *iface )
 {
     struct host *host = impl_from_ITextHost( iface );
     return GetDC( host->window );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8)
-DECLSPEC_HIDDEN INT __thiscall ITextHostImpl_TxReleaseDC(ITextHost *iface, HDC hdc)
+DECLSPEC_HIDDEN INT __thiscall ITextHostImpl_TxReleaseDC( ITextHost2 *iface, HDC hdc )
 {
     struct host *host = impl_from_ITextHost( iface );
     return ReleaseDC( host->window, hdc );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowScrollBar( ITextHost *iface, INT bar, BOOL show )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowScrollBar( ITextHost2 *iface, INT bar, BOOL show )
 {
     struct host *host = impl_from_ITextHost( iface );
     return ShowScrollBar( host->window, bar, show );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxEnableScrollBar,12)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxEnableScrollBar( ITextHost *iface, INT bar, INT arrows )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxEnableScrollBar( ITextHost2 *iface, INT bar, INT arrows )
 {
     struct host *host = impl_from_ITextHost( iface );
     return EnableScrollBar( host->window, bar, arrows );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollRange,20)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost *iface, INT bar, LONG min_pos, INT max_pos, BOOL redraw )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost2 *iface, INT bar, LONG min_pos, INT max_pos, BOOL redraw )
 {
     struct host *host = impl_from_ITextHost( iface );
     SCROLLINFO info = { .cbSize = sizeof(info), .fMask = SIF_PAGE | SIF_RANGE };
@@ -219,7 +219,7 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollRange( ITextHost *iface
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetScrollPos,16)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost *iface, INT bar, INT pos, BOOL redraw )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost2 *iface, INT bar, INT pos, BOOL redraw )
 {
     struct host *host = impl_from_ITextHost( iface );
     DWORD style = GetWindowLongW( host->window, GWL_STYLE );
@@ -244,28 +244,28 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetScrollPos( ITextHost *iface,
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxInvalidateRect,12)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxInvalidateRect( ITextHost *iface, const RECT *rect, BOOL mode )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxInvalidateRect( ITextHost2 *iface, const RECT *rect, BOOL mode )
 {
     struct host *host = impl_from_ITextHost( iface );
     InvalidateRect( host->window, rect, mode );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxViewChange,8)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxViewChange( ITextHost *iface, BOOL update )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxViewChange( ITextHost2 *iface, BOOL update )
 {
     struct host *host = impl_from_ITextHost( iface );
     if (update) UpdateWindow( host->window );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxCreateCaret,16)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxCreateCaret( ITextHost *iface, HBITMAP bitmap, INT width, INT height )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxCreateCaret( ITextHost2 *iface, HBITMAP bitmap, INT width, INT height )
 {
     struct host *host = impl_from_ITextHost( iface );
     return CreateCaret( host->window, bitmap, width, height );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowCaret,8)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost *iface, BOOL show )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost2 *iface, BOOL show )
 {
     struct host *host = impl_from_ITextHost( iface );
     if (show) return ShowCaret( host->window );
@@ -273,27 +273,27 @@ DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxShowCaret( ITextHost *iface, BOO
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCaretPos,12)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetCaretPos( ITextHost *iface, INT x, INT y )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetCaretPos( ITextHost2 *iface, INT x, INT y )
 {
     return SetCaretPos(x, y);
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetTimer,12)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetTimer( ITextHost *iface, UINT id, UINT timeout )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxSetTimer( ITextHost2 *iface, UINT id, UINT timeout )
 {
     struct host *host = impl_from_ITextHost( iface );
     return SetTimer( host->window, id, timeout, NULL ) != 0;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxKillTimer,8)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxKillTimer( ITextHost *iface, UINT id )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxKillTimer( ITextHost2 *iface, UINT id )
 {
     struct host *host = impl_from_ITextHost( iface );
     KillTimer( host->window, id );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScrollWindowEx,32)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost *iface, INT dx, INT dy, const RECT *scroll,
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost2 *iface, INT dx, INT dy, const RECT *scroll,
                                                                 const RECT *clip, HRGN update_rgn, RECT *update_rect,
                                                                 UINT flags )
 {
@@ -302,7 +302,7 @@ DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxScrollWindowEx( ITextHost *iface
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCapture,8)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost *iface, BOOL capture )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost2 *iface, BOOL capture )
 {
     struct host *host = impl_from_ITextHost( iface );
     if (capture) SetCapture( host->window );
@@ -310,34 +310,34 @@ DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCapture( ITextHost *iface, BO
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetFocus,4)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetFocus(ITextHost *iface)
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetFocus( ITextHost2 *iface )
 {
     struct host *host = impl_from_ITextHost( iface );
     SetFocus( host->window );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor,12)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCursor( ITextHost *iface, HCURSOR cursor, BOOL text )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxSetCursor( ITextHost2 *iface, HCURSOR cursor, BOOL text )
 {
     SetCursor( cursor );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxScreenToClient,8)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxScreenToClient( ITextHost *iface, POINT *pt )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxScreenToClient( ITextHost2 *iface, POINT *pt )
 {
     struct host *host = impl_from_ITextHost( iface );
     return ScreenToClient( host->window, pt );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxClientToScreen,8)
-DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxClientToScreen( ITextHost *iface, POINT *pt )
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxClientToScreen( ITextHost2 *iface, POINT *pt )
 {
     struct host *host = impl_from_ITextHost( iface );
     return ClientToScreen( host->window, pt );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxActivate,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost *iface, LONG *old_state )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost2 *iface, LONG *old_state )
 {
     struct host *host = impl_from_ITextHost( iface );
     *old_state = HandleToLong( SetActiveWindow( host->window ) );
@@ -345,14 +345,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxActivate( ITextHost *iface, L
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDeactivate,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDeactivate( ITextHost *iface, LONG new_state )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDeactivate( ITextHost2 *iface, LONG new_state )
 {
     HWND ret = SetActiveWindow( LongToHandle( new_state ) );
     return ret ? S_OK : E_FAIL;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetClientRect,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost *iface, RECT *rect )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost2 *iface, RECT *rect )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -368,20 +368,20 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetClientRect( ITextHost *ifa
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetViewInset,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetViewInset( ITextHost *iface, RECT *rect )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetViewInset( ITextHost2 *iface, RECT *rect )
 {
     SetRectEmpty( rect );
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetCharFormat,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetCharFormat(ITextHost *iface, const CHARFORMATW **ppCF)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetCharFormat( ITextHost2 *iface, const CHARFORMATW **ppCF )
 {
     return E_NOTIMPL;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetParaFormat,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost *iface, const PARAFORMAT **fmt )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost2 *iface, const PARAFORMAT **fmt )
 {
     struct host *host = impl_from_ITextHost( iface );
     *fmt = (const PARAFORMAT *)&host->para_fmt;
@@ -389,7 +389,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetParaFormat( ITextHost *ifa
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSysColor,8)
-DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost *iface, int index )
+DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost2 *iface, int index )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -398,21 +398,21 @@ DECLSPEC_HIDDEN COLORREF __thiscall ITextHostImpl_TxGetSysColor( ITextHost *ifac
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetBackStyle,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetBackStyle( ITextHost *iface, TXTBACKSTYLE *style )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetBackStyle( ITextHost2 *iface, TXTBACKSTYLE *style )
 {
     *style = TXTBACK_OPAQUE;
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetMaxLength,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetMaxLength( ITextHost *iface, DWORD *length )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetMaxLength( ITextHost2 *iface, DWORD *length )
 {
     *length = INFINITE;
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetScrollBars,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost *iface, DWORD *scrollbars )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost2 *iface, DWORD *scrollbars )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -421,7 +421,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetScrollBars( ITextHost *ifa
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPasswordChar,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost *iface, WCHAR *c )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost2 *iface, WCHAR *c )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -430,32 +430,32 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPasswordChar( ITextHost *i
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetAcceleratorPos,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos( ITextHost *iface, LONG *pos )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetAcceleratorPos( ITextHost2 *iface, LONG *pos )
 {
     *pos = -1;
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetExtent,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetExtent( ITextHost *iface, SIZEL *extent )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetExtent( ITextHost2 *iface, SIZEL *extent )
 {
     return E_NOTIMPL;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxCharFormatChange,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, const CHARFORMATW *pcf)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxCharFormatChange( ITextHost2 *iface, const CHARFORMATW *pcf )
 {
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_OnTxParaFormatChange,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, const PARAFORMAT *ppf)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_OnTxParaFormatChange( ITextHost2 *iface, const PARAFORMAT *ppf )
 {
     return S_OK;
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost *iface, DWORD mask, DWORD *bits )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost2 *iface, DWORD mask, DWORD *bits )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -464,7 +464,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost *i
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxNotify,12)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, void *pv)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify( ITextHost2 *iface, DWORD iNotify, void *pv )
 {
     struct host *host = impl_from_ITextHost( iface );
     HWND hwnd = host->window;
@@ -522,21 +522,21 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxNotify(ITextHost *iface, DWOR
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmGetContext,4)
-DECLSPEC_HIDDEN HIMC __thiscall ITextHostImpl_TxImmGetContext(ITextHost *iface)
+DECLSPEC_HIDDEN HIMC __thiscall ITextHostImpl_TxImmGetContext( ITextHost2 *iface )
 {
     struct host *host = impl_from_ITextHost( iface );
     return ImmGetContext( host->window );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxImmReleaseContext,8)
-DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxImmReleaseContext( ITextHost *iface, HIMC context )
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxImmReleaseContext( ITextHost2 *iface, HIMC context )
 {
     struct host *host = impl_from_ITextHost( iface );
     ImmReleaseContext( host->window, context );
 }
 
 DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
-DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHost *iface, LONG *width )
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHost2 *iface, LONG *width )
 {
     struct host *host = impl_from_ITextHost( iface );
 
@@ -544,6 +544,80 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth( ITextHo
     return S_OK;
 }
 
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxIsDoubleClickPending,4)
+DECLSPEC_HIDDEN BOOL __thiscall ITextHostImpl_TxIsDoubleClickPending( ITextHost2 *iface )
+{
+    return FALSE;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetWindow,8)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetWindow( ITextHost2 *iface, HWND *hwnd )
+{
+    struct host *host = impl_from_ITextHost( iface );
+    *hwnd = host->window;
+    return S_OK;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetForegroundWindow,4)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxSetForegroundWindow( ITextHost2 *iface )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPalette,4)
+DECLSPEC_HIDDEN HPALETTE __thiscall ITextHostImpl_TxGetPalette( ITextHost2 *iface )
+{
+    return NULL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetEastAsianFlags,8)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetEastAsianFlags( ITextHost2 *iface, LONG *flags )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxSetCursor2,12)
+DECLSPEC_HIDDEN HCURSOR __thiscall ITextHostImpl_TxSetCursor2( ITextHost2 *iface, HCURSOR cursor, BOOL text )
+{
+    return NULL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxFreeTextServicesNotification,4)
+DECLSPEC_HIDDEN void __thiscall ITextHostImpl_TxFreeTextServicesNotification( ITextHost2 *iface )
+{
+    return;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetEditStyle,12)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetEditStyle( ITextHost2 *iface, DWORD item, DWORD *data )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetWindowStyles,12)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetWindowStyles( ITextHost2 *iface, DWORD *style, DWORD *ex_style )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowDropCaret,16)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxShowDropCaret( ITextHost2 *iface, BOOL show, HDC hdc, const RECT *rect )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxDestroyCaret,4)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxDestroyCaret( ITextHost2 *iface )
+{
+    return E_NOTIMPL;
+}
+
+DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetHorzExtent,8)
+DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetHorzExtent( ITextHost2 *iface, LONG *horz_extent )
+{
+    return E_NOTIMPL;
+}
+
 
 #ifdef __ASM_USE_THISCALL_WRAPPER
 
@@ -608,8 +682,21 @@ DEFINE_STDCALL_WRAPPER(38,ITextHostImpl_TxNotify,12)
 DEFINE_STDCALL_WRAPPER(39,ITextHostImpl_TxImmGetContext,4)
 DEFINE_STDCALL_WRAPPER(40,ITextHostImpl_TxImmReleaseContext,8)
 DEFINE_STDCALL_WRAPPER(41,ITextHostImpl_TxGetSelectionBarWidth,8)
-
-const ITextHostVtbl text_host_stdcall_vtbl =
+/* ITextHost2 */
+DEFINE_STDCALL_WRAPPER(42,ITextHostImpl_TxIsDoubleClickPending,4)
+DEFINE_STDCALL_WRAPPER(43,ITextHostImpl_TxGetWindow,8)
+DEFINE_STDCALL_WRAPPER(44,ITextHostImpl_TxSetForegroundWindow,4)
+DEFINE_STDCALL_WRAPPER(45,ITextHostImpl_TxGetPalette,4)
+DEFINE_STDCALL_WRAPPER(46,ITextHostImpl_TxGetEastAsianFlags,8)
+DEFINE_STDCALL_WRAPPER(47,ITextHostImpl_TxSetCursor2,12)
+DEFINE_STDCALL_WRAPPER(48,ITextHostImpl_TxFreeTextServicesNotification,4)
+DEFINE_STDCALL_WRAPPER(49,ITextHostImpl_TxGetEditStyle,12)
+DEFINE_STDCALL_WRAPPER(50,ITextHostImpl_TxGetWindowStyles,12)
+DEFINE_STDCALL_WRAPPER(51,ITextHostImpl_TxShowDropCaret,16)
+DEFINE_STDCALL_WRAPPER(52,ITextHostImpl_TxDestroyCaret,4)
+DEFINE_STDCALL_WRAPPER(53,ITextHostImpl_TxGetHorzExtent,8)
+
+const ITextHost2Vtbl text_host2_stdcall_vtbl =
 {
     NULL,
     NULL,
@@ -653,11 +740,24 @@ const ITextHostVtbl text_host_stdcall_vtbl =
     STDCALL(ITextHostImpl_TxImmGetContext),
     STDCALL(ITextHostImpl_TxImmReleaseContext),
     STDCALL(ITextHostImpl_TxGetSelectionBarWidth),
+/* ITextHost2 */
+    STDCALL(ITextHostImpl_TxIsDoubleClickPending),
+    STDCALL(ITextHostImpl_TxGetWindow),
+    STDCALL(ITextHostImpl_TxSetForegroundWindow),
+    STDCALL(ITextHostImpl_TxGetPalette),
+    STDCALL(ITextHostImpl_TxGetEastAsianFlags),
+    STDCALL(ITextHostImpl_TxSetCursor2),
+    STDCALL(ITextHostImpl_TxFreeTextServicesNotification),
+    STDCALL(ITextHostImpl_TxGetEditStyle),
+    STDCALL(ITextHostImpl_TxGetWindowStyles),
+    STDCALL(ITextHostImpl_TxShowDropCaret),
+    STDCALL(ITextHostImpl_TxDestroyCaret),
+    STDCALL(ITextHostImpl_TxGetHorzExtent)
 };
 
 #endif /* __ASM_USE_THISCALL_WRAPPER */
 
-static const ITextHostVtbl textHostVtbl =
+static const ITextHost2Vtbl textHostVtbl =
 {
     ITextHostImpl_QueryInterface,
     ITextHostImpl_AddRef,
@@ -701,6 +801,19 @@ static const ITextHostVtbl textHostVtbl =
     THISCALL(ITextHostImpl_TxImmGetContext),
     THISCALL(ITextHostImpl_TxImmReleaseContext),
     THISCALL(ITextHostImpl_TxGetSelectionBarWidth),
+/* ITextHost2 */
+    THISCALL(ITextHostImpl_TxIsDoubleClickPending),
+    THISCALL(ITextHostImpl_TxGetWindow),
+    THISCALL(ITextHostImpl_TxSetForegroundWindow),
+    THISCALL(ITextHostImpl_TxGetPalette),
+    THISCALL(ITextHostImpl_TxGetEastAsianFlags),
+    THISCALL(ITextHostImpl_TxSetCursor2),
+    THISCALL(ITextHostImpl_TxFreeTextServicesNotification),
+    THISCALL(ITextHostImpl_TxGetEditStyle),
+    THISCALL(ITextHostImpl_TxGetWindowStyles),
+    THISCALL(ITextHostImpl_TxShowDropCaret),
+    THISCALL(ITextHostImpl_TxDestroyCaret),
+    THISCALL(ITextHostImpl_TxGetHorzExtent)
 };
 
 static const char * const edit_messages[] =
@@ -759,10 +872,10 @@ static BOOL create_windowed_editor( HWND hwnd, CREATESTRUCTW *create, BOOL emula
 
     if (!host) return FALSE;
 
-    hr = create_text_services( NULL, &host->ITextHost_iface, &unk, emulate_10, &host->editor );
+    hr = create_text_services( NULL, (ITextHost *)&host->ITextHost_iface, &unk, emulate_10, &host->editor );
     if (FAILED( hr ))
     {
-        ITextHost_Release( &host->ITextHost_iface );
+        ITextHost2_Release( &host->ITextHost_iface );
         return FALSE;
     }
     IUnknown_QueryInterface( unk, &IID_ITextServices, (void **)&host->text_srv );
@@ -1031,7 +1144,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
         break;
     }
     case WM_DESTROY:
-        ITextHost_Release( &host->ITextHost_iface );
+        ITextHost2_Release( &host->ITextHost_iface );
         return 0;
 
     case WM_ERASEBKGND:
@@ -1185,7 +1298,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
         PAINTSTRUCT ps;
         HBRUSH brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) );
 
-        ITextHostImpl_TxGetClientRect( &host->ITextHost_iface, &client );
+        ITextHost_TxGetClientRect( &host->ITextHost_iface, &client );
 
         if (msg == WM_PAINT)
         {
-- 
2.23.0




More information about the wine-devel mailing list