Commit Graph

71161 Commits

Author SHA1 Message Date
Vadim Zeitlin
8f9e679393 Recognize MSVS 2022 in solution files
Use its native toolset (v143) by default.
2021-08-24 22:11:29 +02:00
Vadim Zeitlin
6e2d6e9bd4 Enable using MSVS prerelease versions in MSVS CI workflow
Without this options (available in 1.0.3 only), MSVS 2022 is not
detected.
2021-08-24 22:07:36 +02:00
Vadim Zeitlin
b48a266c6d Try building with MSVS 2022 too 2021-08-24 22:00:15 +02:00
Vadim Zeitlin
5385c9ced1 Add DLL Release wxMSW CI build
Append the path to the directory containing the DLLs to PATH to allow
the tests to find them.

Also quote the value of the "Configuration" property as it may (and
does) contain spaces.
2021-08-24 19:33:45 +02:00
Vadim Zeitlin
4d465837e0 Disable currently failing DLL Release MSVS CI build
This was merged accidentally, leave only the passing static build until
the DLL build is fixed.
2021-08-24 17:26:22 +02:00
Vadim Zeitlin
6917f54c4b Merge branch 'ci-msw'
Add CI workflow using MSVS to build wxMSW natively.

See https://github.com/wxWidgets/wxWidgets/pull/2488
2021-08-24 17:12:06 +02:00
Vadim Zeitlin
0701402737 Add CI workflow for building wxMSW using MSVS natively
This should allow running all the tests faster than it's done by
AppVeyor.

Ignore changes to this workflow file in all the other workflows.
2021-08-24 17:12:06 +02:00
Vadim Zeitlin
c868088a49 Add MSVS 2019 solutions for the minimal sample and the tests
It seems inconsistent to have MSVS 2019 solution for the main library
itself, but only MSVS 2017 (and earlier) one(s) for the sample and the
tests, so add MSVS 2019 solution to them too.
2021-08-24 17:12:06 +02:00
Vadim Zeitlin
fcc5f5e290 Merge branch 'configure-direct2d'
Enable using Direct2D when building wxMSW using configure.

See https://github.com/wxWidgets/wxWidgets/pull/2487
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
7f8bd498ce Allow resetting IE emulation level to fail in the tests
Warn about it, but don't fail the test if it fails, as it does this in
the GitHub Actions "windows-2019" environment without any apparent ill
effects.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
69f0ccf029 Merge branch 'find-dialog-parent'
Use correct parent for the generic "Find" dialog, even when it is not
shown yet.

See https://github.com/wxWidgets/wxWidgets/pull/2486
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
37c5f079f1 Disable Direct2D checks failing under Wine
Now that these Direct2D tests are compiled, disable those of them that
fail under Wine due to missing support for Direct2D functionality we use
in Wine implementation.

Don't even give a warning message because there would be too many of
them in these tests, just skip them silently.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
6a99b2d9a8 Fix wrong exclusion in MSW cross-build CI workflow
Ignore GTK files, not MSW ones.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
ce92055f3a Fix the effective parent of wxGenericFindReplaceDialog
This dialog is non-modal and so using GetParentForModalDialog() for it
is not quite right, because this function checks that the candidate
parent window is visible, which may not be the case for a modeless
dialog parent, as the dialog isn't necessarily going to be shown
immediately, but may well be shown later, after showing its parent.

And not allowing to use the not yet shown parent was also inconsistent
with the native MSW version which didn't have any problem with this.

So fix this by adding new GetParentForModelessDialog() function and
using it for this modeless dialog instead. This required slightly
refactoring wxDialog code to allow reusing most of it between the old
GetParentForModalDialog() and the new function.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
b6e29ea4d1 Detect Direct2D when building wxMSW with configure
Check for Direct2D headers (only, as DLLs are loaded during run-time
anyhow) and enable Direct2D-based wxGraphicsContext implementation if
they are available when building wxMSW with configure.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
8bbcf0af09 Check that wxFindReplaceDialog parent is non-null before using it
Although this dialog is normally supposed to have a valid parent, don't
crash if it doesn't have one when any of its buttons are pressed.
2021-08-24 17:12:05 +02:00
Vadim Zeitlin
0798906e7b Simplify wxFindReplaceDialogBase::Send() code slightly
Use ProcessWindowEvent() instead of GetEventHandler()->ProcessEvent().

No real changes.
2021-08-24 17:12:04 +02:00
Jouk
cc3afe0dc6 Include wx/toplevel.h to for wxTopLevelWindow 2021-08-24 14:05:00 +02:00
Vadim Zeitlin
d6ba8eafc5 Merge branch 'generic-listctrl-fixes'
Fix selection when right clicking in generic wxListCtrl and other minor
improvements.

See https://github.com/wxWidgets/wxWidgets/pull/2483
2021-08-23 02:01:17 +02:00
Vadim Zeitlin
efb5ae2a1d Merge branch 'modernize-dir-test'
Get rid of CppUnit boilerplate in wxDir unit tests.

See https://github.com/wxWidgets/wxWidgets/pull/2482
2021-08-23 02:00:46 +02:00
AliKet
cb6d67bab4 Reset selection on right click in a more efficient way
Instead of using HighlightAll(), use the second argument of
HighlightOnly() to remove selection from the previous current item.
2021-08-23 01:59:07 +02:00
Kvaz1r
247b7dab49 Set m_isShowingModal as true before showing dialog in wxUniv
This allows ModalDialogsTestCase InitDialog unit test to pass.

Closes https://github.com/wxWidgets/wxWidgets/pull/2481
2021-08-23 00:28:02 +02:00
Vadim Zeitlin
0e9e6aaf3a Set "subitem" argument of HitTest() to -1 in generic wxListCtrl
Sub-item hit testing is still not implemented, but at least initialize
the output parameter to the documented value instead of leaving some
junk in it.
2021-08-23 00:24:24 +02:00
Vadim Zeitlin
a90dd434f7 Remove misleading word from the listctrl sample log message
It was surprising to see "right double click" for a right click.
2021-08-23 00:21:21 +02:00
Vadim Zeitlin
14511a8bec Fix selection on right click in generic wxListCtrl
Right clicking item always selected it, which made it possible to have
multiple selected items even in a single-selection control.

Restore HighlightAll(false) erroneously removed by fedc80eee3 (Improve
selection and focus events generation in wxGenericLisCtrl, 2020-09-06)
to fix this and restore the correct old behaviour.

Note that even in multiple selection mode right clicking a previously
unselected item should still clear the selection, as it does it in the
other GTK programs (and also under MSW).
2021-08-23 00:16:32 +02:00
Vadim Zeitlin
683dfcdfae Use native CATCH macros in wxDir unit test
They provide more information than CppUnit-compatibility ones.
2021-08-22 21:35:14 +02:00
Vadim Zeitlin
3e9d66f925 Remove CppUnit test case class from wxDir unit tests
No real changes, just simplify the code by getting rid of unnecessary
CppUnit boilerplate.
2021-08-22 21:27:20 +02:00
Kvaz1r
12ddfb45c5 Fix infinite recursion in wxUniv wxStdScrollBarInputHandler
This could sometimes result in crashes due to stack overflow.

Closes #19230.
2021-08-22 14:25:00 +02:00
Kvaz1r
b28a71085e Call Update before giving away focus on dismiss menu in wxUniv
Without immediate refreshing menu is appearing as inactive.

Closes https://github.com/wxWidgets/wxWidgets/pull/2479
2021-08-22 14:23:54 +02:00
Vadim Zeitlin
593864a816 Merge branch 'm1-ci-builds'
Make self-hosted Mac CI builds faster and more useful.

See https://github.com/wxWidgets/wxWidgets/pull/2476
2021-08-21 18:33:26 +02:00
Blake-Madden
03abc1e685 Fix typo in wxMSW installation instructions
Closes https://github.com/wxWidgets/wxWidgets/pull/2477
2021-08-21 17:49:35 +02:00
Vadim Zeitlin
4c2707d3dc Enable ASAN for the ARM M1 CI build
Run the tests under ASAN to detect potential problems.

Also enable optimizations for the universal build (overriding
--disable-optimise used by default) to check that there are no problems
with building wxWidgets for real production use.
2021-08-21 16:17:26 +02:00
Vadim Zeitlin
1c0258e5d6 Make wxMSW CI builds name more consistent with the other ones
No real changes, this is purely cosmetic.
2021-08-21 15:49:40 +02:00
Vadim Zeitlin
95a337349d Report errors in wxTestingModalHook in non-debug builds too
wxFAIL_MSG_AT() does nothing in these builds, so do at least something
else -- even if it's not ideal, it's still better than doing nothing.
2021-08-21 15:49:40 +02:00
Scott Talbert
8d2de3dd91 Add missing wxEventType declarations to notifmsg interface header
Closes https://github.com/wxWidgets/wxWidgets/pull/2475
2021-08-21 15:06:12 +02:00
Vadim Zeitlin
6f3be7ab26 Reduce the number of Mac CI builds and add a universal one
Don't run 8 builds for all combinations of arch/debug/C++ dialect but
just a few of them covering all of the possibilities.

Also add a static universal build which is what is commonly used for
distributing software using wxWidgets under Mac.
2021-08-21 15:05:13 +02:00
Vadim Zeitlin
cc3c836711 Fix tests build with wxDEBUG_LEVEL==0
Define various macros used in the test code (or in the headers included
from it) as nothing when wxDEBUG_LEVEL==0.

Also don't define a helper function used when asserts are enabled in
this build to avoid clang warnings about unused function.
2021-08-21 15:05:13 +02:00
Vadim Zeitlin
1a8e22d813 Rename self-hosted Mac CI workflow file for consistency
Call this file consistently with the other CI files and also ignore all
of the other files in each workflow to avoid unnecessary rebuilds.

Finally, remove a leftover mention of Travis file which doesn't exist
any longer.
2021-08-21 14:39:43 +02:00
Vadim Zeitlin
8ccfd32d04 Fix using wxDC::Blit() when using RTL layout under MSW
Work around what seems like a bug in StretchBlt() implementation by
applying an extra offset to it when using RTL layout and revert an
earlier attempt to fix this problem for wxMemoryDC used in wxNotebook
code from 6614aa496d (fix for tabs drawing in RTL (patch 1552881),
2006-10-21).

Closes #19190.
2021-08-20 22:09:32 +01:00
Vadim Zeitlin
6689feb648 Merge branch 'osx-text-undo'
Implement undo/redo for (multiline) wxTextCtrl in wxOSX.

See https://github.com/wxWidgets/wxWidgets/pull/2474
2021-08-20 22:10:48 +02:00
Tobias Taschner
26c9bc0807 wxWebViewEdgeImpl: Add missing MinGW definitions
In a756ed93c2 (wxWebViewEdge: Improve wxEVT_WEBVIEW_LOADED, 2021-08-17)
usage of additional interfaces was added. This adds their interface IDs
for non VISUALC compilers.

Also sorted the definitions alphabetically, use "--color-moved" git
option to see the actual changes.

Closes https://github.com/wxWidgets/wxWidgets/pull/2472
2021-08-20 21:36:21 +02:00
Vadim Zeitlin
ca9a48598d Avoid copying the font object unnecessarily in wxTextMeasureBase
This change slightly modifies the parent commit by avoiding an
unnecessary copy of wxFont which, while cheap, is not quite free and
can be easily avoided here.

See https://github.com/wxWidgets/wxWidgets/pull/2471
2021-08-20 21:32:55 +02:00
Dimitri Schoolwerth
eb76f400d2 Fix potential wxTextMeasureBase::DoGetPartialTextExtents() crashes
If wxTextMeasure is constructed without a font and the base version of
DoGetPartialTextExtents() gets used then there's a crash due to
dereferencing a null pointer. To fix, simply use GetFont() like
elsewhere to get the effective font used.

To fix another null pointer dereference crash don't call
wxTextMeasure::DoGetTextExtent() with null height pointer, as it
requires that both width and height pointers are non-null since
8cd79b7af0 (Factor out text measurement from wxDC and wxWindow into
wxTextMeasure., 2012-10-18), but not for all back-ends any longer since
d76774b444 (Don't dereference NULL output pointer in wxTextMeasure.,
2012-11-25).

There currently appears to be no code in wx that would result in either
crash. For Windows both crashes can be artificially reproduced with
the render sample (requiring static linking with wx due to using private
wxTextMeasure) when using the GDI+ renderer along with the patch:

diff --git a/samples/render/render.cpp b/samples/render/render.cpp
index 6bae34781b..bc4f8d405b 100644
--- a/samples/render/render.cpp
+++ b/samples/render/render.cpp
@@ -34,6 +34,7 @@
     #include "wx/image.h"
 #endif

+#include "wx/private/textmeasure.h"
 #include "wx/apptrait.h"
 #include "wx/artprov.h"
 #include "wx/renderer.h"
@@ -209,6 +210,10 @@ private:
             wxGraphicsContext* ctx = m_renderer->CreateContext(pdc);
             gdc.SetBackground(GetBackgroundColour());
             gdc.SetGraphicsContext(ctx);
+
+            wxTextMeasure txm(&gdc);
+            wxArrayInt widths;
+            txm.GetPartialTextExtents("a", widths, 1.0);
         }

         wxDC& dc = m_renderer ? static_cast<wxDC&>(gdc) : pdc;

Closes https://github.com/wxWidgets/wxWidgets/pull/2471
2021-08-20 21:32:02 +02:00
Dimitri Schoolwerth
a7b9dc121b Fix recent regression with drawing themed multi-line text
Remove conditions from MSW themed text drawing that prevent multi-lines
from being rendered properly and instead always use DT_TOP alignment
for multi-lines.

This fixes a regression occurring since 90ba137f20 (Work around text
extent differences resulting in clipped text, 2021-07-26) with themed
Vista+ :

Non-top aligned multi-line text gets rendered as a single line because
of DT_SINGLELINE being used if the height of the drawing rect and
multi-line text happen to be equal. This occurs on the "Variable line
height" page of the dataview sample, which calculates its cell height
by multiplying the text extent by the number of lines in the text (a
requirement with wxMSW, not wxGTK).

Removing the conditions also exposes top aligned multi-line themed text
to drawing beyond the drawing rect, which actually makes it behave more
like wxGTK and wxOSX as well as wxMSW non-themed drawing as they try to
render text fully without regard for the bounds of the drawing rect.

Closes https://github.com/wxWidgets/wxWidgets/pull/2470
2021-08-20 21:29:57 +02:00
Vadim Zeitlin
1f7cd9c7a4 Merge branch 'generic-initial-state-fixes'
Fixes for the initial state of generic wx{List,Spin}Ctrl.

See https://github.com/wxWidgets/wxWidgets/pull/2469
2021-08-20 21:28:35 +02:00
Vadim Zeitlin
e51971e86c Skip wxTextCtrl::EmptyUndoBuffer() test when using Wine
Wine doesn't provide the OLE interface used by this function, so the
test would always fail when running under it, just skip it instead.
2021-08-20 20:16:11 +01:00
Stefan Csomor
b3b24e962e Expand self-hosted Mac M1 CI build workflow
See https://github.com/wxWidgets/wxWidgets/pull/2336
2021-08-20 19:42:35 +02:00
Vadim Zeitlin
8fe4ba8ff4 Add wxIsRunningUnderWine() helper function
This is mostly useful in the testing code to avoid failures when testing
for functionality not implemented by Wine.
2021-08-20 18:22:26 +01:00
Vadim Zeitlin
64f7c23272 Add unit test for wxTextCtrl::EmptyUndoBuffer()
Check that calling it results in CanUndo() returning false and really
prevents Undo() from working.
2021-08-20 17:00:12 +01:00
Vadim Zeitlin
adacb5c07e Move EmptyUndoBuffer() from wxTextEntry to wxTextCtrl
It seems unlikely that we're ever going to need this function in any
other classes inheriting from wxTextEntry (i.e. wxComboBox) and both
existing implementations are for wxTextCtrl only, so define this
function there.

If really necessary, we can always lower it to wxTextEntry later, while
moving it in the other direction wouldn't be easily possible due to
compatibility concerns.

This commit is best viewed with git --color-moved option.
2021-08-20 17:00:01 +01:00