Skip to content

Commit b6925bd

Browse files
MishaProductionswinesync
andauthored
[RICHED20] Sync to Wine-10.0 (reactos#8078)
[RICHED20] Sync to Wine-10.0 Sync wine/rbtree.h to Wine-10.0 as changes in riched20 require this. Also added a define to allow directx code to compile. Sync riched20 to Wine-10.0 and its tests using the script. Signed-off-by: Francois Gouget <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 9f72c5601173728c52626342a1ec6c9a4c70670f by Francois Gouget <[email protected]> Update WINESYNC.txt Update precomp.h fix build [WINESYNC]: riched20 is now in sync with wine-staging wine-10.0 [WINESYNC] riched20: Only call ME_SendRequestResize when control is in-place active. Prevent GetClientRect from being called when not in-place active. wine commit id e61db557ab8473a490c84301dbb4b4665b6c9c9f by Charlotte Pabst <[email protected]> [WINESYNC] riched20: Exit from editor_ensure_visible when control is not in-place active. According to microsoft documentation, ScrollWindowEx, SetScrollPos and SetScrollRange may only be called while the control is in-place active. This fixes a segmentation fault in an application. wine commit id dafaadcb4addd9af334433666a4bc2e7aa6eb9ff by Charlotte Pabst <[email protected]> [WINESYNC] riched20/tests: Test that ScrollWindowEx and GetClientRect are only called when control is in-place active. wine commit id f1301cedbea51be107017bb8545956bcfd02b610 by Charlotte Pabst <[email protected]> Update editor.c [WINESYNC] riched20: Release IME input context when done using it. wine commit id 3f51fb96c162e8d3314627b3db25564fa7d9d419 by Zhiyi Zhang <[email protected]> [WINESYNC] riched20: In para_set_fmt protect against out of bound cTabStop values. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56730 wine commit id 7b2ff977739df25252d46552d2447af50c23040e by Fabian Maurer <[email protected]> Update editor.c [WINESYNC] riched20: Don't write past end of buffer. Signed-off-by: Eric Pouech <[email protected]> wine commit id 5cbe3a6cb186cffed20e3fea5f88abd0880d3914 by Eric Pouech <[email protected]> [WINESYNC] riched20: Don't crash when no OLE obj is present. This was generating a lot of crashes in riched20 tests. Signed-off-by: Eric Pouech <[email protected]> wine commit id 015aae30cf2217164f631d1c03abfc9ea63bb43d by Eric Pouech <[email protected]> Update editor.c [WINESYNC] riched20: Use CRT allocation functions. wine commit id 42579f1dcd2f14e765e2f53ceb5b46fff5623f10 by Alex Henrie <[email protected]> [WINESYNC] riched20/tests: Make the editor paste test failures more informative and unique. Knowing the content of the edit field is more useful than knowing the strcmp() result. The text field may contain carriage returns and linefeeds so use wine_dbgstr_a() so they are clearly visible in the failure message. Also prefix the ok messages with a unique string to indicate which test_WM_PASTE() test failed. wine commit id b8950d04e439f649f2167477a36ee453ad8b81ef by Francois Gouget <[email protected]> [WINESYNC] riched20: Don't call wrap_marked_paras_dc() before the editor is fully initialized. Today, CreateTextServices() sometimes triggers an assertion failure in select_style(). When ME_MakeEditor() calls ME_MakeFirstParagraph(), the editor (ME_TextEditor) is not in a fully initialized state. For example, the font cache (pFontCache) is not fully initialized, which sometimes makes select_style() believe that the cache slots are fully occupied. Fix this by delaying the call to wrap_marked_paras_dc() until the editor is fully initialized. Also, delay the call to ITextHost::TxReleaseDC() until after wrap_marked_paras_dc(), since we need the device context a bit longer. Fixes: b70eb32c5f3e506181d9e1e9fbef62e9baf3674d wine commit id 548d7179e3b2b9961321a4df50644c9b3874a295 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Factor out device context acquisition from ME_MakeFirstParagraph. This lets ME_MakeEditor() reuse the device context throughout the editor initialization process. wine commit id 03036f42e1afa9c79246dcee6b9fe876286b1aa4 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Don't call ME_UpdateRepaint inside set_selection(). This partially reverts c5daf6a30f21 (riched20: Call ME_UpdateRepaint instead of editor_ensure_visible in set_selection.) Fixes: c5daf6a30f21acd20263692b278acba49e014cc1 wine commit id ac5110131493b8b05795e8825285e41ca40ab6f1 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Add tests for change notifications caused by EM_SETSEL{,EX}. wine commit id c35926e49825f7a3d48ba826085fe1ae3d2a7e27 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Wrap marked paragraphs at Text Services initialization. Today, CreateTextServices() returns an Rich Edit object without row start and end marks, which are expected to exist by many Rich Edit operations as well as EM_* message handlers. This leads to a crash when certain messages (e.g., EM_SCROLLCARET) are sent to the Rich Edit object via ITextServices::TxSendMessage(), unless ME_WrapMarkedParagraphs() has been called beforehand. Fix this by calling wrap_marked_paras_dc() early in the initialization process. This is not a problem for windowed Rich Edit controls, which already calls ME_WrapMarkedParagraphs() before the user or application starts interacting with it. wine commit id b70eb32c5f3e506181d9e1e9fbef62e9baf3674d by Jinoh Kang <[email protected]> [WINESYNC] riched20: Use nameless unions/structs. wine commit id 26826d3af8b1969de389f3d6702d7c8b805126e1 by Alexandre Julliard <[email protected]> Update editor.h [WINESYNC] riched20: Remove DECLSPEC_HIDDEN usage. wine commit id c04ab166498b5841ecde620a9bd0b74969b01596 by Alistair Leslie-Hughes <[email protected]> [WINESYNC] riched20: Call ME_UpdateRepaint instead of editor_ensure_visible in set_selection. To prevent cases where ME_WrapMarkedParagraphs has not been called causing a NULL pointer when editor_ensure_visible tries to get the row from the cursor. wine commit id c5daf6a30f21acd20263692b278acba49e014cc1 by Santino Mazza <[email protected]> [WINESYNC] riched20: Update paragraph position in marked tree. nCharOfs is the key for paragraphs added to the marked tree If it is updated, re-add the entry to update its position wine commit id f1aa3f37ef326b7cbf8fc94e982c9f0b398181c4 by Daniel Lehman <[email protected]> Update editor.c [WINESYNC] riched20: Update the editor IME position on GCS_RESULTSTR. So that a GCS_RESULTSTR followed by GCS_COMPSTR, without interruping the composition, begins inserting the new composition text after the result instead of before it. wine commit id de45bc33a73eac5dbc3502b4a43cd48399507c73 by Rémi Bernon <[email protected]> [WINESYNC] riched20/tests: Fix a typo in a comment. wine commit id 145e3c758b9594596835e291b2fcb3c80e4c0479 by Francois Gouget <[email protected]> [WINESYNC] riched20/tests: Don't specify DT_WORDBREAK in _check_txgetnaturalsize(). Today, test_TxGetNaturalSize() creates a pop-up window with a fixed size (extent) of 100 x 100. The test function then proceeds to compute the natural size of rich edit control that fits the sample text "TestSomeText" and compare it to the RECT calculated by DrawText. Apparently, this test fails if the width of the sample text "TestSomeText" exceeds the width of the test window's client area. In this case, DrawText() with DT_WORDBREAK breaks the text into the two lines due to text wrapping; however, Rich Edit's ITextServices::TxGetNaturalSize implementation does not seem to perform text wrapping on overflow. This results in extent mismatch. (Note that the test may either succeed or fail depending on the current font used for DEFAULT_GUI_FONT, which defaults to Tahoma according to Microsoft's documentation. To reproduce this failure, it may be necessary to switch fonts or change the width of the pop-up window.) Fix this by omitting the DT_WORDBREAK flag for the DrawText() call in _check_txgetnaturalsize(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54637 wine commit id f54a1dac64c89aea3fe02ae8c0d6eef43a0aa117 by Jinoh Kang <[email protected]> Update editstr.h [WINESYNC] riched20: Implement ITextDocument::Freeze and ITextDocument::Unfreeze. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54617 wine commit id 3fe15349d39ccf31026a92eae30f83f65c91cb1f by Jinoh Kang <[email protected]> [WINESYNC] riched20: Don't assume that TxDraw preserves the device context's brush selection. Today, RichEditWndProc_common assumes that ITextServices::TxDraw preserves the brush selection of the given device context. However, this invariant may be broken by misbehaving embedded OLE objects in the text document. Fix this by not assuming that the return value of the second SelectObject() call equals the brush passed to the first SelectObject() call in RichEditWndProc_common's WM_PAINT / WM_PRINTCLIENT case. wine commit id 2027be7e0370c92595f126a0b0dd167a635d50a2 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Test for ITextDocument::Freeze and ITextDocument::Unfreeze. wine commit id 3105fad82b9bae390fcd710a2fc10a18988b4622 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Don't set para unless committing cursor move in ME_MoveCursorWords. Introduce a temporary variable, `other_para`, so that we don't end up returning incorrect para (with stale run) inside the output cursor. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54564 wine commit id 7e28fa5c558f1417f8f033cb843424778bbfb8b8 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Test for word movement across paragraph boundary. wine commit id 21d25b17c2cae8eb2d2376ce42b76e3f61eb0bba by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Fix the EM_GETSELTEXT tests in Hindi on Windows. On Windows EM_GETSELTEXT fails with an invalid parameter error in the Hindi locale but works in most other locales, including UTF-8 ones. So check for this issue and adjust the expected results accordingly. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54559 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54565 wine commit id 37cd13abdf5d91c7b3f25b39fa14976bc3a3e3a3 by Francois Gouget <[email protected]> [WINESYNC] riched20/tests: EM_GETSELTEXT's wparam is not used and should be 0. wine commit id baa41970647a7e548701a72bea2e4aa2a61ca27e by Francois Gouget <[email protected]> [WINESYNC] riched20/tests: Add context to the EM_FORMATRANGE tests. wine commit id 020145248371bbfd2e473e79ba873e8313dde72d by Francois Gouget <[email protected]> [WINESYNC] riched20/tests: Check clipboard content after destroying the editor window. Destroying the editor window should render all the formats so they are still available after. wine commit id b5b5b0b365639b889a0240d4992e16174b428f75 by Francois Gouget <[email protected]> [WINESYNC] riched20/tests: Add retry loop around OpenClipboard() to avoid access denial. Reusing existing helper from user32 & comctl32. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47888 Signed-off-by: Eric Pouech <[email protected]> wine commit id 25743d46f4103c7345c955b87b4134a065fb5f1d by Eric Pouech <[email protected]> [WINESYNC] riched20/tests: Ensure clipboard has been pasted before testing the result. The patch does reduce error failures locally. For the record: - WM_PASTE in undo operations haven't been transformed (as it requires UNDO stack manipulation in a coherent way across platforms) Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47888 Signed-off-by: Eric Pouech <[email protected]> wine commit id 4fd5252f635817b431673accaba718c7481f48f6 by Eric Pouech <[email protected]> [WINESYNC] riched20: Support SFF_SELECTION when streaming in plain text. Signed-off-by: Eric Pouech <[email protected]> wine commit id 1b7a918bd7ec8bc2c51bcb76525b56b17c5ff0c0 by Eric Pouech <[email protected]> [WINESYNC] riched20/tests: Add tests when pasting in plain text mode. Signed-off-by: Eric Pouech <[email protected]> wine commit id 82fa1048b5cc7d9c6a2a289403f25adbdd8158c7 by Eric Pouech <[email protected]> [WINESYNC] riched20: Obtain the composition start index after deleting selection. Today, the Rich Edit control handles the WM_IME_STARTCOMPOSITION message by the computing the composition start position (imeStartIndex) _before_ calling ME_DeleteSelection(), which shifts the character positions after the range of deletion. If the selection were not empty, imeStartIndex immediately becomes stale, since it does not take into account the number of deleted characters before it. Fix this by computing imeStartIndex after the ME_DeleteSelection() call. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54318 wine commit id 8c43577f0f9b4422d3641457c595c3998bd54a18 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Call GlobalReAlloc with GMEM_MOVEABLE flag. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53474 wine commit id dfd44bb979ee2052eceff094083147e9879fa807 by Rémi Bernon <[email protected]> [WINESYNC] riched20: Fix failing test in UTF8 locales. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52875 Signed-off-by: Eric Pouech <[email protected]> wine commit id 5902cfd2990261189ce9af27981a95ac12fa2a5d by Eric Pouech <[email protected]> [WINESYNC] riched20: Don't emit EN_CHANGE events during window creation. wine commit id 5c997de8dc1e4885266fa884a2fb74f840e3bedc by Evan Tang <[email protected]> [WINESYNC] riched20: Add test for EN_CHANGE events during window creation. GenoPro isn't very happy if it receives one wine commit id 0b069106b0e0f141d6925d3e10166be89fc59145 by Evan Tang <[email protected]> [WINESYNC] riched20: Move test class creation to a helper function. wine commit id f9083961ed187777d660796f7136addc04fff8b0 by Evan Tang <[email protected]> [WINESYNC] riched20/tests: Use ARRAY_SIZE instead of open coding it. wine commit id 90b6288f54afdc4430dac146779a92b89f4d1219 by Michael Stefaniuc <[email protected]> [WINESYNC] riched20/test: Add scrolling test for richole. Signed-off-by: Santino Mazza <[email protected]> wine commit id 059c70d736baa164a1b246e949acd006cf83ab5a by Santino Mazza <[email protected]> [WINESYNC] riched20: Ensure that cursor is visible when selecting text. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40444 Signed-off-by: Santino Mazza <[email protected]> wine commit id 25209c162fc209124b369abbad55d915d31909b2 by Santino Mazza <[email protected]> [WINESYNC] riched20/tests: When selection is out of view, the scrollbar should move. Signed-off-by: Santino Mazza <[email protected]> wine commit id ee131e9eba7dad090f0baf4a73fab2d62dc73b52 by Santino Mazza <[email protected]> [WINESYNC] riched20: Remove duplicate code. Signed-off-by: David Kahurani <[email protected]> wine commit id 3588479e1a674e5f43f1acb9e7c0aa8cecf98f25 by David Kahurani <[email protected]> [WINESYNC] riched20: Implement ITextDocument::Undo and ITextDocument::Redo. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53289 Signed-off-by: Jinoh Kang <[email protected]> wine commit id ded8227774570a1ea320dc34f2de0033f85b3ce7 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Add undo control state variable to ME_TextEditor. Signed-off-by: Jinoh Kang <[email protected]> wine commit id 40c54854e61d8adfca21e2fa9260712e4f5453e9 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Factor out undo-ignored status check. Signed-off-by: Jinoh Kang <[email protected]> wine commit id 0cd86e010e41eebdc1a4c142f9cc6a4948554d0e by Jinoh Kang <[email protected]> [WINESYNC] riched20: Ensure MEPF_COMPLEX is unset when in password input mode. Otherwise, Wine may crash while attempting to fetch the script shaping information, which does not exist since shape_para() was not called. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53335 Signed-off-by: Jinoh Kang <[email protected]> wine commit id f77f12ba3b1dad9ebdcb116c66b137e9103a0d1b by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Test for ITextDocument::Undo and ITextDocument::Redo. Signed-off-by: Jinoh Kang <[email protected]> wine commit id 73284ea18891a152dce989ffff59e2c527f94c73 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Commit and wrap paragraphs after changing text properties. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53170 Signed-off-by: Jinoh Kang <[email protected]> wine commit id 0974f047b57357252ec94bea119e5291250a446c by Jinoh Kang <[email protected]> [WINESYNC] riched20: Draw OLE objects with IViewObject implementation. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52752 Signed-off-by: Jinoh Kang <[email protected]> wine commit id ecc607c6da96a5c2e8988f3021e98b442fe24c12 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Fetch extent from object if REOBJECT::sizel is unset. Signed-off-by: Jinoh Kang <[email protected]> wine commit id 164897e6c94d3eee4798f82a730472a5a847f9b2 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Add tests for drawing embedded OLE objects. Signed-off-by: Jinoh Kang <[email protected]> wine commit id a7d29d1625f7e02df4fbf59ef4e4a999d39edde0 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Fix the spelling of a comment. Signed-off-by: Francois Gouget <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id f9fa5f9e523b45766f715c6981c6a6ab5f183157 by Francois Gouget <[email protected]> [WINESYNC] riched20: Implement callback to IRichEditOleCallback_QueryInsertObject. Signed-off-by: Jinoh Kang <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 10667b39aad6710668f60c1ba8f10e50aeb87242 by Jinoh Kang <[email protected]> [WINESYNC] riched20/tests: Add tests for IRichEditOleCallback_QueryInsertObject. Signed-off-by: Jinoh Kang <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 95b4072cc774ba7a7eabb0d4c114b933b7d71105 by Jinoh Kang <[email protected]> Update richole.c [WINESYNC] riched20: Set REOBJECT's cp correctly in IRichEditOle::GetObject. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52705 Signed-off-by: Jinoh Kang <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 194ba06c403fd72fbfb95048385c9ca4838af169 by Jinoh Kang <[email protected]> [WINESYNC] riched20: Add back-reference to outer ME_Run from struct re_object. Signed-off-by: Jinoh Kang <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 05796c4e2a4acb91e6035c536b4d0e1f7e16896d by Jinoh Kang <[email protected]> fix [WINESYNC] riched20/tests: Enable compilation with long types. Signed-off-by: Eric Pouech <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 9e90cecdc603d79c6332a03884ed8d4851ef2e88 by Eric Pouech <[email protected]> [WINESYNC] riched20/tests: Use correct integral type. Signed-off-by: Eric Pouech <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8b66db027d4112bfd4287b03d5c7b6f33994adc3 by Eric Pouech <[email protected]> fix build, sync rbtree.h [WINESYNC] riched20: Enable compilation with long types. Signed-off-by: Eric Pouech <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 42d0e56643740a0eac5913a9f176e789457cb475 by Eric Pouech <[email protected]> [WINESYNC] riched20/tests: Add a test to see what richedit class flavours should be available. Signed-off-by: Dmitry Timoshkov <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id d54a0e2bea4548bb5d9c0cca9f918d7c46591e23 by Dmitry Timoshkov <[email protected]> [WINESYNC] riched20: Use correct integral type. Signed-off-by: Eric Pouech <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 63a643f7f42ecd0c2625a5f5704b5b9647349e7b by Eric Pouech <[email protected]> [WINESYNC] riched20/tests: Avoid "misleading indentation" warnings. Signed-off-by: Fabian Maurer <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 2d6fad7bda2f2e21a871f405a6b0c3e70ebf6a6a by Fabian Maurer <[email protected]> [WINESYNC] include: Remove the wine_ prefix on rbtree functions. Add defines for frequently-used functions. For compatibility with vkd3d. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 3527230c461b6baba9c29e69b575ada85bdbbc43 by Alexandre Julliard <[email protected]> [WINESYNC] riched20: Defer releasing the host if inside a notify callback. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51521 Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8138159f20d6453443861570689e0f14018051da by Huw Davies <[email protected]> [WINESYNC] riched20: Return the nearest char pos if the coords are outside the format rect. For the two tests that remain todo_wine, the results differ between riched20 and msftedit, with Wine's implementation matching msftedit. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52041 Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 363508454d5f8f1fc5916bda47e6429756b7dc8f by Huw Davies <[email protected]> [WINESYNC] riched20: Check font_cache in select_style() too. Signed-off-by: Serge Gautherie <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 177f808aa86e5442be1a0a92ddccc4904bf2e743 by Serge Gautherie <[email protected]> [WINESYNC] riched20: Use the standard va_list instead of __ms_va_list. Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 5b15bf33255bd373cbf26ec373d16a8234ec6b1c by Alexandre Julliard <[email protected]> [WINESYNC] riched20: Use regular allocation helpers for text services objects. Signed-off-by: Nikolay Sivov <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 2064c206c0b67edb8524f572166b974ba9cbd6fe by Nikolay Sivov <[email protected]> [WINESYNC] riched20: Remove New() allocation macro. Signed-off-by: Nikolay Sivov <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 1d5c9defb19fca6cfb1107384fc2325d391726d6 by Nikolay Sivov <[email protected]> [WINESYNC] riched20: Don't create custom heap. Signed-off-by: Dmitry Timoshkov <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8bff437e9d5e047e689d8b32f62995785c0cd48e by Dmitry Timoshkov <[email protected]> [WINESYNC] riched20/tests: Don't cast NULL. Signed-off-by: Michael Stefaniuc <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id b701c3df99fbd6d4df7eaa11327bb11db95d8676 by Michael Stefaniuc <[email protected]> [WINESYNC] riched20/tests: Add more tests for testing EM_GETTEXTEX with OLE objects. Signed-off-by: Jactry Zeng <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 40988d6c3886d0f7a914c45ea68264bfc8540859 by Jactry Zeng <[email protected]> Update richole.c [WINESYNC] riched20: Allow to insert OLE object at specified offset. Signed-off-by: Jactry Zeng <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 8c894382dde5b9da88b0e9f23a753d5e851a43d6 by Jactry Zeng <[email protected]> Update richole.c [WINESYNC] riched20/tests: Lock hGlobal before use. Signed-off-by: Jactry Zeng <[email protected]> Signed-off-by: Huw Davies <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id f9c8c95856ded333be35ff41ab40a246bfe345b6 by Jactry Zeng <[email protected]> Co-authored-by: winesync <[email protected]>
1 parent c7a7376 commit b6925bd

File tree

29 files changed

+4218
-2266
lines changed

29 files changed

+4218
-2266
lines changed

dll/win32/riched20/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11

22
remove_definitions(-D_CRT_NON_CONFORMING_SWPRINTFS)
3-
add_definitions(-D__ROS_LONG64__)
43
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
54
spec2def(riched20.dll riched20.spec ADD_IMPORTLIB)
65

@@ -44,7 +43,7 @@ endif()
4443
add_typelib(riched_tom.idl)
4544
add_dependencies(riched20 stdole2)
4645
set_module_type(riched20 win32dll)
47-
target_link_libraries(riched20 wine uuid)
46+
target_link_libraries(riched20 wine uuid oldnames)
4847
add_importlibs(riched20 ole32 oleaut32 usp10 imm32 user32 gdi32 msvcrt kernel32 ntdll)
4948
add_pch(riched20 precomp.h SOURCE)
5049
add_cd_file(TARGET riched20 DESTINATION reactos/system32 FOR all)

dll/win32/riched20/caret.c

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ static void ME_SetCursorToEnd(ME_TextEditor *editor, ME_Cursor *cursor, BOOL fin
3939
}
4040

4141

42-
int ME_GetSelectionOfs(ME_TextEditor *editor, int *from, int *to)
42+
int ME_GetSelectionOfs(ME_TextEditor *editor, LONG *from, LONG *to)
4343
{
4444
*from = ME_GetCursorOfs(&editor->pCursors[0]);
4545
*to = ME_GetCursorOfs(&editor->pCursors[1]);
4646

4747
if (*from > *to)
4848
{
49-
int tmp = *from;
49+
LONG tmp = *from;
5050
*from = *to;
5151
*to = tmp;
5252
return 1;
@@ -160,7 +160,7 @@ int set_selection_cursors(ME_TextEditor *editor, int from, int to)
160160
/* deselected and caret moved to end of the current selection */
161161
if (from < 0)
162162
{
163-
int start, end;
163+
LONG start, end;
164164
ME_GetSelectionOfs(editor, &start, &end);
165165
if (start != end)
166166
{
@@ -461,7 +461,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
461461
/* c = updated data now */
462462

463463
if (c.run == cursor.run) c.run->nCharOfs -= shift;
464-
editor_propagate_char_ofs( NULL, c.run, shift );
464+
editor_propagate_char_ofs( editor, NULL, c.run, shift );
465465

466466
if (!cursor.run->len)
467467
{
@@ -487,34 +487,64 @@ BOOL ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, int nChars)
487487
nChars, FALSE);
488488
}
489489

490-
static struct re_object* create_re_object(const REOBJECT *reo)
490+
static struct re_object* create_re_object(const REOBJECT *reo, ME_Run *run)
491491
{
492-
struct re_object *reobj = heap_alloc(sizeof(*reobj));
492+
struct re_object *reobj = malloc(sizeof(*reobj));
493493

494494
if (!reobj)
495495
{
496496
WARN("Fail to allocate re_object.\n");
497497
return NULL;
498498
}
499499
ME_CopyReObject(&reobj->obj, reo, REO_GETOBJ_ALL_INTERFACES);
500+
reobj->run = run;
500501
return reobj;
501502
}
502503

503-
void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCursor)
504+
HRESULT editor_insert_oleobj(ME_TextEditor *editor, const REOBJECT *reo)
504505
{
505506
ME_Run *run, *prev;
506507
const WCHAR space = ' ';
507508
struct re_object *reobj_prev = NULL;
508-
ME_Cursor *cursor = editor->pCursors + nCursor;
509-
ME_Style *style = style_get_insert_style( editor, cursor );
509+
ME_Cursor *cursor, cursor_from_ofs;
510+
ME_Style *style;
511+
HRESULT hr;
512+
SIZEL extent;
513+
514+
if (editor->lpOleCallback)
515+
{
516+
hr = IRichEditOleCallback_QueryInsertObject(editor->lpOleCallback, (LPCLSID)&reo->clsid, reo->pstg, REO_CP_SELECTION);
517+
if (hr != S_OK)
518+
return hr;
519+
}
520+
521+
extent = reo->sizel;
522+
if (!extent.cx && !extent.cy && reo->poleobj)
523+
{
524+
hr = IOleObject_GetExtent( reo->poleobj, DVASPECT_CONTENT, &extent );
525+
if (FAILED(hr))
526+
{
527+
extent.cx = 0;
528+
extent.cy = 0;
529+
}
530+
}
531+
532+
if (reo->cp == REO_CP_SELECTION)
533+
cursor = editor->pCursors;
534+
else
535+
{
536+
cursor_from_char_ofs( editor, reo->cp, &cursor_from_ofs );
537+
cursor = &cursor_from_ofs;
538+
}
539+
style = style_get_insert_style( editor, cursor );
510540

511-
/* FIXME no no no */
512541
if (ME_IsSelection(editor))
513542
ME_DeleteSelection(editor);
514543

515544
run = run_insert( editor, cursor, style, &space, 1, MERF_GRAPHICS );
516545

517-
run->reobj = create_re_object( reo );
546+
run->reobj = create_re_object( reo, run );
547+
run->reobj->obj.sizel = extent;
518548

519549
prev = run;
520550
while ((prev = run_prev_all_paras( prev )))
@@ -531,6 +561,7 @@ void ME_InsertOLEFromCursor(ME_TextEditor *editor, const REOBJECT* reo, int nCur
531561
list_add_head(&editor->reobj_list, &run->reobj->entry);
532562

533563
ME_ReleaseStyle( style );
564+
return S_OK;
534565
}
535566

536567

@@ -816,15 +847,18 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
816847
}
817848
else
818849
{
819-
para = para_next( para );
820-
if (!para_next( para ))
850+
ME_Paragraph *other_para = para_next( para );
851+
if (!para_next( other_para ))
821852
{
822853
if (cursor->run == run) return FALSE;
823854
nOffset = 0;
824855
break;
825856
}
826-
if (para->nFlags & MEPF_ROWSTART) para = para_next( para );
827-
if (cursor->run == run) run = para_first_run( para );
857+
if (other_para->nFlags & MEPF_ROWSTART) other_para = para_next( other_para );
858+
if (cursor->run == run) {
859+
para = other_para;
860+
run = para_first_run( para );
861+
}
828862
nOffset = 0;
829863
break;
830864
}
@@ -1030,32 +1064,17 @@ static BOOL cursor_from_virtual_coords( ME_TextEditor *editor, int x, int y,
10301064
*
10311065
* x & y are pixel positions in client coordinates.
10321066
*
1033-
* isExact will be set to TRUE if the run is directly under the pixel
1034-
* position, FALSE if it not, unless isExact is set to NULL.
1035-
*
1036-
* return FALSE if outside client area and the cursor is not set,
1037-
* otherwise TRUE is returned.
1067+
* return TRUE if the run is directly under the pixel
1068+
* position, FALSE if it not.
10381069
*/
1039-
BOOL ME_CharFromPos(ME_TextEditor *editor, int x, int y,
1040-
ME_Cursor *cursor, BOOL *isExact)
1070+
BOOL cursor_from_coords( ME_TextEditor *editor, int x, int y, ME_Cursor *cursor )
10411071
{
1042-
RECT rc;
1043-
BOOL bResult;
1044-
1045-
ITextHost_TxGetClientRect(editor->texthost, &rc);
1046-
if (x < 0 || y < 0 || x >= rc.right || y >= rc.bottom) {
1047-
if (isExact) *isExact = FALSE;
1048-
return FALSE;
1049-
}
1050-
x += editor->horz_si.nPos;
1051-
y += editor->vert_si.nPos;
1052-
bResult = cursor_from_virtual_coords( editor, x, y, cursor, FALSE );
1053-
if (isExact) *isExact = bResult;
1054-
return TRUE;
1072+
x += editor->horz_si.nPos;
1073+
y += editor->vert_si.nPos;
1074+
return cursor_from_virtual_coords( editor, x, y, cursor, FALSE );
10551075
}
10561076

10571077

1058-
10591078
/* Extends the selection with a word, line, or paragraph selection type.
10601079
*
10611080
* The selection is anchored by editor->pCursors[2-3] such that the text
@@ -1405,7 +1424,7 @@ BOOL ME_IsSelection(ME_TextEditor *editor)
14051424

14061425
void ME_DeleteSelection(ME_TextEditor *editor)
14071426
{
1408-
int from, to;
1427+
LONG from, to;
14091428
int nStartCursor = ME_GetSelectionOfs(editor, &from, &to);
14101429
int nEndCursor = nStartCursor ^ 1;
14111430
ME_DeleteTextAtCursor(editor, nStartCursor, to - from);
@@ -1439,7 +1458,7 @@ void ME_SendSelChange(ME_TextEditor *editor)
14391458

14401459
if (editor->nEventMask & ENM_SELCHANGE)
14411460
{
1442-
TRACE("cpMin=%d cpMax=%d seltyp=%d (%s %s)\n",
1461+
TRACE("cpMin=%ld cpMax=%ld seltyp=%d (%s %s)\n",
14431462
sc.chrg.cpMin, sc.chrg.cpMax, sc.seltyp,
14441463
(sc.seltyp & SEL_TEXT) ? "SEL_TEXT" : "",
14451464
(sc.seltyp & SEL_MULTICHAR) ? "SEL_MULTICHAR" : "");

dll/win32/riched20/clipboard.c

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
1919
*/
2020

21-
#define NONAMELESSUNION
22-
2321
#include "editor.h"
2422

2523
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
@@ -77,19 +75,19 @@ static ULONG WINAPI EnumFormatImpl_AddRef(IEnumFORMATETC *iface)
7775
{
7876
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
7977
LONG ref = InterlockedIncrement(&This->ref);
80-
TRACE("(%p) ref=%d\n", This, ref);
78+
TRACE("(%p) ref=%ld\n", This, ref);
8179
return ref;
8280
}
8381

8482
static ULONG WINAPI EnumFormatImpl_Release(IEnumFORMATETC *iface)
8583
{
8684
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
8785
ULONG ref = InterlockedDecrement(&This->ref);
88-
TRACE("(%p) ref=%d\n", This, ref);
86+
TRACE("(%p) ref=%ld\n", This, ref);
8987

9088
if(!ref) {
9189
GlobalFree(This->fmtetc);
92-
heap_free(This);
90+
free(This);
9391
}
9492

9593
return ref;
@@ -100,7 +98,7 @@ static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt,
10098
{
10199
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
102100
ULONG count = 0;
103-
TRACE("(%p)->(%d %p %p)\n", This, celt, rgelt, pceltFetched);
101+
TRACE("(%p)->(%ld %p %p)\n", This, celt, rgelt, pceltFetched);
104102

105103
if(!rgelt)
106104
return E_INVALIDARG;
@@ -119,7 +117,7 @@ static HRESULT WINAPI EnumFormatImpl_Skip(IEnumFORMATETC *iface, ULONG celt)
119117
{
120118
EnumFormatImpl *This = impl_from_IEnumFORMATETC(iface);
121119
ULONG count = 0;
122-
TRACE("(%p)->(%d)\n", This, celt);
120+
TRACE("(%p)->(%ld)\n", This, celt);
123121

124122
count = min(celt, This->fmtetc_cnt-This->cur);
125123
This->cur += count;
@@ -165,7 +163,7 @@ static HRESULT EnumFormatImpl_Create(const FORMATETC *fmtetc, UINT fmtetc_cnt,
165163
EnumFormatImpl *ret;
166164
TRACE("\n");
167165

168-
ret = heap_alloc(sizeof(EnumFormatImpl));
166+
ret = malloc(sizeof(EnumFormatImpl));
169167
ret->IEnumFORMATETC_iface.lpVtbl = &VT_EnumFormatImpl;
170168
ret->ref = 1;
171169
ret->cur = 0;
@@ -194,21 +192,21 @@ static ULONG WINAPI DataObjectImpl_AddRef(IDataObject* iface)
194192
{
195193
DataObjectImpl *This = impl_from_IDataObject(iface);
196194
ULONG ref = InterlockedIncrement(&This->ref);
197-
TRACE("(%p) ref=%d\n", This, ref);
195+
TRACE("(%p) ref=%ld\n", This, ref);
198196
return ref;
199197
}
200198

201199
static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
202200
{
203201
DataObjectImpl *This = impl_from_IDataObject(iface);
204202
ULONG ref = InterlockedDecrement(&This->ref);
205-
TRACE("(%p) ref=%d\n",This, ref);
203+
TRACE("(%p) ref=%ld\n",This, ref);
206204

207205
if(!ref) {
208206
if(This->unicode) GlobalFree(This->unicode);
209207
if(This->rtf) GlobalFree(This->rtf);
210208
if(This->fmtetc) GlobalFree(This->fmtetc);
211-
heap_free(This);
209+
free(This);
212210
}
213211

214212
return ref;
@@ -217,7 +215,7 @@ static ULONG WINAPI DataObjectImpl_Release(IDataObject* iface)
217215
static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
218216
{
219217
DataObjectImpl *This = impl_from_IDataObject(iface);
220-
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
218+
TRACE("(%p)->(fmt=0x%08x tym=0x%08lx)\n", This, pformatetc->cfFormat, pformatetc->tymed);
221219

222220
if(pformatetc->lindex != -1)
223221
return DV_E_LINDEX;
@@ -226,9 +224,9 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
226224
return DV_E_TYMED;
227225

228226
if(This->unicode && pformatetc->cfFormat == CF_UNICODETEXT)
229-
pmedium->u.hGlobal = This->unicode;
227+
pmedium->hGlobal = This->unicode;
230228
else if(This->rtf && pformatetc->cfFormat == cfRTF)
231-
pmedium->u.hGlobal = This->rtf;
229+
pmedium->hGlobal = This->rtf;
232230
else
233231
return DV_E_FORMATETC;
234232

@@ -250,7 +248,7 @@ static HRESULT WINAPI DataObjectImpl_QueryGetData(IDataObject* iface, FORMATETC
250248
DataObjectImpl *This = impl_from_IDataObject(iface);
251249
UINT i;
252250
BOOL foundFormat = FALSE;
253-
TRACE("(%p)->(fmt=0x%08x tym=0x%08x)\n", This, pformatetc->cfFormat, pformatetc->tymed);
251+
TRACE("(%p)->(fmt=0x%08x tym=0x%08lx)\n", This, pformatetc->cfFormat, pformatetc->tymed);
254252

255253
if(pformatetc->lindex != -1)
256254
return DV_E_LINDEX;
@@ -290,10 +288,10 @@ static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwD
290288
IEnumFORMATETC **ppenumFormatEtc)
291289
{
292290
DataObjectImpl *This = impl_from_IDataObject(iface);
293-
TRACE("(%p)->(%d)\n", This, dwDirection);
291+
TRACE("(%p)->(%ld)\n", This, dwDirection);
294292

295293
if(dwDirection != DATADIR_GET) {
296-
FIXME("Unsupported direction: %d\n", dwDirection);
294+
FIXME("Unsupported direction: %ld\n", dwDirection);
297295
/* WinXP riched20 also returns E_NOTIMPL in this case */
298296
*ppenumFormatEtc = NULL;
299297
return E_NOTIMPL;
@@ -375,7 +373,7 @@ static DWORD CALLBACK ME_AppendToHGLOBAL(DWORD_PTR dwCookie, LPBYTE lpBuff, LONG
375373
if (pData->nLength+cb+1 >= cb) {
376374
/* round up to 2^17 */
377375
int nNewSize = (((nMaxSize+cb+1)|0x1FFFF)+1) & 0xFFFE0000;
378-
pData->hData = GlobalReAlloc(pData->hData, nNewSize, 0);
376+
pData->hData = GlobalReAlloc(pData->hData, nNewSize, GMEM_MOVEABLE);
379377
}
380378
pDest = GlobalLock(pData->hData);
381379
memcpy(pDest + pData->nLength, lpBuff, cb);
@@ -397,7 +395,7 @@ static HGLOBAL get_rtf_text(ME_TextEditor *editor, const ME_Cursor *start, int n
397395
es.dwCookie = (DWORD_PTR)&gds;
398396
es.pfnCallback = ME_AppendToHGLOBAL;
399397
ME_StreamOutRange(editor, SF_RTF, start, nChars, &es);
400-
GlobalReAlloc(gds.hData, gds.nLength+1, 0);
398+
GlobalReAlloc(gds.hData, gds.nLength+1, GMEM_MOVEABLE);
401399
return gds.hData;
402400
}
403401

@@ -407,7 +405,7 @@ HRESULT ME_GetDataObject(ME_TextEditor *editor, const ME_Cursor *start, int nCha
407405
DataObjectImpl *obj;
408406
TRACE("(%p,%d,%d)\n", editor, ME_GetCursorOfs(start), nChars);
409407

410-
obj = heap_alloc(sizeof(DataObjectImpl));
408+
obj = malloc(sizeof(DataObjectImpl));
411409
if(cfRTF == 0)
412410
cfRTF = RegisterClipboardFormatA("Rich Text Format");
413411

0 commit comments

Comments
 (0)