Commit graph

76092 commits

Author SHA1 Message Date
Vadim Zeitlin
757ebe9e2e Don't define NDEBUG for CEF headers in MSVS debug builds
If _DEBUG is defined, we must be using debug version of CEF too, even
if wxHAVE_CEF_DEBUG is not defined by the build system.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
83d69a1cd9 Revert "Add debug postfix to libcef_dll_wrapper"
This reverts commit 3d51977acf because
it's incompatible with the library names created by CMake when building
CEF directly, and not via wx CMake files.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
bddd46d343 Disable wxDeprecatedGUIConstants comparisons without 3.2 compat
Start preparing for removing these deprecated comparison operators.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
020f22de15 Define comparison and arithmetic operators as hidden friends
Change these operators in all the other classes to hidden friends too.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
09515ad4ce Make wxString and wxUniChar comparison operators friends too
Don't define them in the global scope to improve error messages.

Also move the rest of wxString operators into the class scope.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
acb24e7066 Don't define operators on common GDI classes in global scope
Use "hidden friend" idiom instead and define these operators as friend
functions inside the corresponding class scope, so that they're only
found using ADL and, in particular, don't appear as candidates when
looking for any operator.

In practice, this significantly reduces the error messages given if some
operator (e.g. "==") is applied to a type not defined it, as the
compiler doesn't need to consider converting this type to wxPoint,
wxRealPoint, wxRect, wxSize etc, nor to complain about failing to do it.
2024-01-06 01:29:24 +01:00
Vadim Zeitlin
e97d27165a Merge branch 'point-cleanup-and-new-operators'
Clean up wxPoint and wxRealPoint arithmetic operators: add missing ones,
fix parameter names,

See #24191.
2024-01-05 19:35:48 +01:00
David Miguel Susano Pinto
68bef2fbf3 Add compound operators * and / to wxPoint and wxRealPoint
Also add unit tests for them as well as for the existing additive
compound operators.
2024-01-05 19:34:43 +01:00
David Miguel Susano Pinto
1300c56f0d Put wxRealPoint operators in the same order as wxPoint ones 2024-01-05 19:31:14 +01:00
David Miguel Susano Pinto
11c3034177 Implement unary minus for wxRealPoint, same as wxPoint. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
b9b0cce41b include/wx/gdicmn.h: reorder to match the order in interface/wx/gdicmn.h. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8638db50da Document a series of undocumented wxPoint and wxRealPoint operators.
Unary minus of wxPoint and multiplication with double are implemented
but undocumented.  Many of operators that use integers types other
than int remain undocumented though.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
66e7d0bce8 Implement + and - between wxRealPoint and wxSize.
These operators are part of the documented interface for wxRealPoint
but were never implemented.  This commit implements them.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8ccbd7e95d Implement operator/=(int) and operator*=(int) for wxPoint and wxRealPoint.
These operators are part of the documented interface but were never
implemented.  This commit implements them.
2024-01-05 12:43:57 +00:00
David Miguel Susano Pinto
9a5d2ffade Correct names of variables in wxPoint and wxRealPoint arithmetic operators.
The arithmetic operators for wxPoint and wxRealPoint are quite
repetitive and were made by copy-paste from the wxSize operators.
Because of that, some of the names are a bit misleading which this
commit changes.  The changes are:

1. replace s/sz with p/pt for point variables (likely 's' comes from
   copied code used for wxSize variables)

2. replace 'i' with 'f' for floating point types (likely 'i' comes
   from copied code used for integer types)

3. replace 'factor' with 'divisor' for division operations (factors
   are the multiplication operands, not division)
2024-01-05 11:28:11 +00:00
Vadim Zeitlin
8655d7bb95 Add wxEVT_WEBVIEW_CHROMIUM_MESSAGE_RECEIVED
This allows to handle IPC messages from custom JS functions in the code
using wxWebViewChromium.
2024-01-05 01:43:32 +01:00
Vadim Zeitlin
3dde6bdeb0 Disable swap interval in GLX wxGLCanvas implementation too
We need to do it when using XWayland for the same reasons as we had to
do it in the EGL version when using either XWayland or Wayland directly:
without this, we can block for up to 1 second in glXSwapBuffers() if the
window is hidden, see #23512.

Closes #24163.

Closes #24165.
2024-01-05 01:05:30 +01:00
David Miguel Susano Pinto
11ebffe7b0 Add operator/(wxPoint, double) and operator/(wxRealPoint, double)
Do this for consistency with wxSize which already had this operator/()
overload and operator*() in these classes which was already overloaded
for double.

Closes #24185.

Closes #24187.
2024-01-05 00:45:57 +01:00
Paul Cornett
a5e9befd4d Remove unused class
Unused since 025f5d1450 (Don't cache HDC used by wxPaintDCEx in wxMSW., 2013-03-09)
2024-01-04 12:49:37 -08:00
Paul Cornett
071e3187f5 Remove unused variables
These have been unused since e95354ec54 (added UTF-16/32-[LB]E conversions; got
rid of wxCharacterSet and simplified and fixed some bugs in remaining code, 2003-09-22)
2024-01-04 12:34:56 -08:00
Paul Cornett
cd93c73900 Remove another reference to GLU
Should have been part of ce1d317768 (Remove GLU dependency, 2023-12-28)
2024-01-04 12:22:39 -08:00
Paul Cornett
31a672b858 Improve our best size calculation for multi-line wxTextCtrl with GTK
Instead of trying to figure it out ourselves, just ask the control
what its minimum size is.
2024-01-04 12:11:50 -08:00
Vadim Zeitlin
5faa70503a Fix name in the comment for wx_check_c_source_compiles()
No real changes.
2024-01-04 03:25:07 +01:00
Vadim Zeitlin
486865b446 Add wxFileConfig::MigrateLocalFile()
This can be useful for the existing applications switching to using
XDG-compliant config files location as they can just call this function
on startup to keep using the existing file.
2024-01-04 03:23:37 +01:00
Vadim Zeitlin
ebe0847932 Add wxHAS_CONFIG_AS_{REG,FILE}CONFIG symbols
Sometimes it's useful to have some code used only if wxConfig is defined
as wxRegConfig or only if it is defined as wxFileConfig and testing for
these symbols is more clear than testing for the platform (and more
correct, considering that setting wxUSE_CONFIG_NATIVE to 0 may result in
wxFileConfig being used even under Windows).
2024-01-04 02:55:05 +01:00
Vadim Zeitlin
055c4cbed5 Fix crash on shutdown if wxConfig couldn't be saved
If saving wxConfig to the file in wxAppConsoleBase::CleanUp() failed,
wxLog messages were logged into a wxLogGui target which was recreated
because wxTheApp is still non-null when CleanUp() is called. However it
is destroyed soon afterwards and showing messages from wxLogGui without
wxTheApp leads to crashes, at least in wxGTK.

To avoid this, we could set wxTheApp to null before calling CleanUp(),
but it's not clear if there is no cleanup code (or something called from
it) which doesn't rely on wxTheApp existence, so instead just flush, and
reset, the log target after calling CleanUp() but before destroying the
application object.

This fixes the crash which could be easily reproduced simply by making
the file used by wxFileConfig not-writeable under Linux.
2024-01-04 02:46:18 +01:00
Vadim Zeitlin
e21b27019f Merge branch 'mac-build'
Improve Mac build documentation and build itself.

See #24128.
2024-01-03 20:27:00 +01:00
David Miguel Susano Pinto
a8b14edc40 Correct wxRealPoint and wxPoint operator return types in the docs
Use the correct types instead of wxSize which was erroneously used
there ever since a5664fd6ef (Increase interoperability between wxPoint
and wxRealPoint introducing constructors which convert between the two
classes., 2010-06-09).

Closes #23804.
2024-01-03 20:24:17 +01:00
Vadim Zeitlin
261490d5e2 Ignore failures in tests handling mouse clicks under AppVeyor
For some completely mysterious reason we don't get the expected mouse
click events when running under AppVeyor, something might be covering
the window and stealing the clicks for itself there.

As there doesn't seem to be anything to do about it, just skip the test
in this case.

Closes #24082.
2024-01-03 20:21:59 +01:00
Vadim Zeitlin
3de2e479fc Add wxAuiTabCtrl::DoShowTab() helper
No real changes, just add a function ensuring that the tab is shown.

It's not really clear why the existing code sometimes calls
MakeTabVisible() after SetActivePage() and sometimes doesn't, and
perhaps it should actually always do it, in which case this function
could be merged with SetActivePage() to do everything at once, but for
now keep the changes minimal.
2024-01-03 19:05:51 +01:00
Vadim Zeitlin
b66d0a640d Update new page in AUI tab control after removing the active one
Previously this was only done when removing the global (i.e. per
notebook) current page, but not when removing the page which was current
in this tab control without being globally current, and this resulted in
not showing the newly shown page correctly.

Fix this by explicitly updating the tab control in this case.

Closes #24063.
2024-01-03 18:58:23 +01:00
Vadim Zeitlin
586e1b1d48 Reuse existing variable in wxAuiNotebook::RemovePage()
Don't call wxAuiTabCtrl::GetPageCount() again when we just stored its
result in a local variable.

No real changes.
2024-01-03 18:43:30 +01:00
Vadim Zeitlin
989829891a Fix memory leak when calling wxInitialize(void)
We still allocated argv arrays when argc was 0, but didn't free them in
this case.

Fix this by just not bothering to allocate them.
2024-01-03 18:36:25 +01:00
Vadim Zeitlin
b90747d61a Use const references to wxStandardPaths in wxFileConfig code
No real changes, just minor cleanup.
2024-01-02 02:21:25 +01:00
Vadim Zeitlin
3093d7ad4f Add wxCONFIG_USE_XDG to use with wxFileConfig
Using this style allows to tell wxFileConfig to use XDG-compliant
location for the user configuration file, even when not using XDG file
layout for wxStandardPaths, which can be convenient when modifying the
existing application using wxStandardPaths for other files locations
too.

And using it in combination with wxCONFIG_USE_SUBDIR allows to put the
config file in a XDG-compliant subdirectory, which wasn't easily
possible at all before.
2024-01-02 02:18:45 +01:00
Vadim Zeitlin
d1e223d531 Add [[nodiscard]] attribute to wxStandardPaths::AppendAppInfo()
It doesn't make sense to call this function and ignore its return value,
but it may happen accidentally as it might seem that it modifies its
parameter.
2024-01-02 02:16:05 +01:00
Vadim Zeitlin
d56cf71466 Add wxStandardPaths::Dir_Config
This allows using GetUserDir(Dir_Config) to retrieve XDG-compliant
location of the configuration files, independently of the file layout
used by the global wxStandardPaths object.

Recommend using this directory instead of GetUserDataDir() for multiple
configuration files under Unix.
2024-01-02 02:07:25 +01:00
Vadim Zeitlin
72c164f28c Make wxStandardPaths::AppendAppInfo() public
This function can be useful to the application code and will be used by
wxFileConfig in the upcoming commits.
2024-01-02 01:57:04 +01:00
Vadim Zeitlin
420983f76a Document that GetUserDataDir() doesn't respect XDG file layout
And recommend using GetUserDir() instead.
2024-01-02 01:47:26 +01:00
Vadim Zeitlin
92b901f971 Remove unnecessary wxUnusedVar() from wxFileConfig code
No real changes, just don't use wxUnusedVar() for a parameter which is
actually used.
2024-01-02 00:50:39 +01:00
Paul Cornett
a65ada2a5e Simplify mm-to-pixel conversion
wxDisplay can already tell us the PPI, just convert it to mm.
2024-01-01 13:52:10 -08:00
Paul Cornett
64d1d27da9 Fix wxMM_METRIC scaling with wxGCDC for non-macOS platforms
Don't override the default mm-to-pixel calculation, it will get the right answer.
2024-01-01 13:46:18 -08:00
Vadim Zeitlin
8bb8eb5108 Increase buffer size in wxXmlDocument::Load()
The 1KB buffer used before was really too small and should have been
increased to at least 4KB, but increase it to 16KB as it should do no
harm neither.
2024-01-01 22:08:28 +01:00
Vadim Zeitlin
20845d85a5 Deprecate "encoding" parameter of wxXmlDocument ctor and Load()
This parameter wasn't used for anything as it specified the encoding of
the data contents in memory and not the encoding of the XML file as
might be believed, so it only created unnecessary confusion.

See #24167.
2024-01-01 22:08:28 +01:00
Vadim Zeitlin
268b2b98e0 Use WaitForEventAt() in Grid::ReorderedColumnsCellClick test too
This test also sporadically fails on AppVeyor.
2024-01-01 22:04:41 +01:00
Vadim Zeitlin
9ee9f4e8dd Remove documentation of wxXmlDocument::GetEncoding()
This function was removed in 4519d8e08a (Remove wxUSE_UNICODE checks as
they're always true now, 2022-10-27).
2024-01-01 21:00:08 +01:00
Vadim Zeitlin
0b049be4b7 Use unique_ptr<> in wxXmlDocument
Replace manual use of raw pointer with std::unique_ptr<>.

No real changes.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
2a5eac26f4 Remove unnecessary calls to wxDELETE()
Replace them with just calls to delete as it doesn't matter if the
pointer is null or not in all these cases and using just "delete" is
more clear.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
326876eb60 Initialize wxXmlDocument::m_docNode in its declaration too
Similar to the previous commit.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
08ef52671f Initialize wxXmlDocument::m_fileType and m_eol in declaration
This is simpler and more clear than calling SetFileType() from all
ctors.

Also m_eol
2024-01-01 20:53:53 +01:00