Commit graph

76090 commits

Author SHA1 Message Date
Vadim Zeitlin
be5fa77839 Reuse wxButton::GetDefaultSize() instead of duplicating it
Just reuse the existing function in IncreaseToStdSizeAndCache() helper
instead of using a separate and, until the parent commit, different, way
of computing the default button size here.

This will hopefully avoid introducing any discrepancies between the size
returned by GetDefaultSize() and the size actually used for the buttons
by default in the future.

See #24283.
2024-02-05 19:05:02 +01:00
Vadim Zeitlin
57b408ed88 Fix wxButton::GetDefaultSize() in high DPI under MSW
Using button size in dialog units doesn't work well in high DPI, as it
gives sizes wildly different from those actually used by Windows itself
for the buttons (e.g. for those in Explorer dialogs still using Win32
API), so switch to using DIPs, just as it was done for determining the
initial size of the buttons when actually creating them in c6d2f6d9fe
(Really fix the standard button size in high DPI under MSW, 2019-10-19)

See #18528.

Closes #24283.
2024-02-05 19:04:52 +01:00
Vadim Zeitlin
36583f13e1 Merge branch 'fix-vlistbox-out-of-range' of https://github.com/wsu-cb/wxWidgets
Prevent scrolling beyond specified range.

See #24278.
2024-02-03 21:54:40 +01:00
Vadim Zeitlin
42839def49 Merge branch 'fix_webkit_tests'
Fix WebView tests with WebKitGTK 2.43+.

See #24276.
2024-02-03 21:54:05 +01:00
Vadim Zeitlin
e20a994b1f Merge branch 'really-fix-cleanup'
Really fix logging during app cleanup.

See #24272.
2024-02-03 21:53:24 +01:00
Vadim Zeitlin
dba79a2d67 Merge branch 'avoid-impl-string-conv-logstatus'
Avoid implicit string conversions when using wxLog functions.

See #24271.
2024-02-03 21:52:27 +01:00
Bill Su
95054f3d4a wxVListBox: fix Page Down being unable to reach last item 2024-02-03 00:21:49 -05:00
Vadim Zeitlin
9c33be4f5e Use a helper lambda for naming history menu items
Shorten the code a bit more.

No real changes.
2024-02-02 18:01:24 +01:00
Vadim Zeitlin
44bc26f087 Use range-for loops for iterating over wxWebViewHistoryItems
No real changes, just simplify the code a bit.
2024-02-02 17:59:01 +01:00
Bill Su
66dfd0ae89 prevent scrolling beyond specified range
Fix #24277
2024-02-02 00:41:10 -05:00
Scott Talbert
3ef1aee986 Fix WebView sample when there are blank title pages in history
Otherwise, the wxMenu code asserts due to an empty item.
2024-02-01 20:56:36 -05:00
Scott Talbert
1622a5c9c2 Fix WebView tests with WebKitGTK 2.43+
It seems that WebKitGTK is now failing to navigate to about: URLs unless
they are about:blank or about:srcdoc, so use about:srcdoc as the
alternate URL to fix the WebView tests.

Ref: 3c3163e71f
2024-02-01 20:56:32 -05:00
Vadim Zeitlin
a01c870dbb Don't let exceptions escape from events handled during idle time
This resulted in immediate program termination, at least with wxGTK, if
an event handler called when dispatching pending events during idle time
threw an exception (which, in particular, covers all the exceptions
inside lambdas passed to CallAfter()).

Just catch and handle them as usual, i.e. as we do with the event
handlers called immediately in response to a user action.
2024-01-31 04:08:26 +01:00
Vadim Zeitlin
509fcb0214 Avoid resetting wxTheApp too early while still avoiding crashes
Both recent changes trying to order resetting wxTheApp and flushing the
logs failed: 055c4cbed5 (Fix crash on shutdown if wxConfig couldn't be
saved, 2024-01-04) did because it reset wxTheApp too late and wxLogGui
was created when it was already unsafe to use, while b628237245 (Fix
crash due to using wxLog during shutdown in a better way, 2024-01-26)
failed because it reset wxTheApp too early, resulting in it being null
during execution of window destructors which could expect wxTheApp to
still be available.

And while 6636a2ac9e (Fix recent regression with destroying
wxDataViewCtrl on app exit, 2024-01-30) fixed one of the problems due to
the latter change, there are no guarantees that there are no more such
problems, especially in user-defined destructors in the application
code.

So instead of resetting wxTheApp before or after calling CleanUp(), now
do it in the middle of wxAppBase::CleanUp(): just after destroying all
the windows (and so executing any user-defined destructors) but before
the application object becomes truly unusable.

Note that this relies on the previous commit, as before it the
application became unusable even before wxAppBase::CleanUp() execution
started in some ports (notably wxGTK).

See #24252.
2024-01-30 21:10:41 +01:00
Vadim Zeitlin
a7aea0febf Do common wxApp cleanup before port-specific part in all ports
Some ports called wxAppBase::CleanUp() before performing port-specific
cleanup, while some did it afterwards. The former seems preferable, as
some actions performed in wxAppBase (such as showing log dialogs) may
not work any more after the port-specific cleanup is done, while there
should be no dependencies in the other direction.

So standardize on calling wxAppBase version first in all ports, which
also makes them more consistent with each other.
2024-01-30 21:07:29 +01:00
Vadim Zeitlin
c965c87290 wxX11: don't call CleanUp() from wxApp::Exit()
This is not done in any other ports and shouldn't be necessary in this
one neither, CleanUp() will be called from wxEntryCleanup() later
anyhow.
2024-01-30 20:36:41 +01:00
Vadim Zeitlin
6636a2ac9e Fix recent regression with destroying wxDataViewCtrl on app exit
As mentioned in the commit message of b628237245 (Fix crash due to using
wxLog during shutdown in a better way, 2024-01-26), this change could
affect existing code using wxTheApp and it did affect wxDataViewCtrl and
not in a good way: destroying it during application shutdown started to
crash now that wxTheApp is null when it happens.

Fix this by skipping the idle time notification when shutting down, it's
not useful anyhow by then.
2024-01-30 20:15:02 +01:00
Vadim Zeitlin
fb8d7b7de0 Take C string in wxLogger::MaybeStore() to simplify
We don't need to take wxString here, when we only ever call this
function ourselves with ASCII strings only.

This should result in slightly shorter generated code too, as the
conversion from C string to wxString now happens only in a single place
inside MaybeStore() instead of being done in all places calling
wxLogSysError() or wxLogStatus().
2024-01-30 18:47:06 +01:00
Vadim Zeitlin
10f235b43c Avoid implicit wxString conversions in wxLog{Status,SysError}()
They don't compile when wxNO_IMPLICIT_WXSTRING_ENCODING is defined.

Closes #24267.
2024-01-30 18:45:13 +01:00
Vadim Zeitlin
cfb321b175 Merge branch 'dylib-rpath'
Set rpath for wx libraries themselves too and not just the samples.

See #24265.
2024-01-30 01:54:24 +01:00
Bill Su
74f88f9131 Add wxRadioButton group support to wxGenericValidator
Enable wxGenericValidator(int*) to work with wxRadioButton groups
when applied to the first element of the group.  The value will be
the index of the selected button within the group.

Closes #24264.
2024-01-30 01:52:59 +01:00
Vadim Zeitlin
ab0865f991 Also set rpath under FreeBSD
They seem to support it since a very long time, so there should be no
problems with doing it there too.
2024-01-29 01:52:14 +01:00
Vadim Zeitlin
0352fe1fbd Don't set LD_LIBRARY_PATH for CI workflows
This shouldn't be necessary any longer, after the fix in the grandparent
commit.
2024-01-29 01:20:52 +01:00
Vadim Zeitlin
3de719d68c Don't set LD_LIBRARY_PATH in Mac CI workflow unnecessarily
This variable is not used under macOS anyhow.
2024-01-29 01:20:12 +01:00
Vadim Zeitlin
63bcac8c21 Use -rpath option when linking all the libraries too
Previously this was used only for linking the samples, which ensured
that they found the libraries directly referenced by them, but this
wasn't enough to find the libraries referenced indirectly, via another
library (e.g. wxxml used by wxxrc internally but not necessarily
referenced by the sample using XRC) because DT_RUNPATH is not used in
this case, as documented in Linux ld.so(8).

Ensure that such libraries are found nevertheless by setting runpath
for all the libraries too.

Note that it would probably be more logical to just get rid of
SAMPLES_RPATH_FLAG and use DYLIB_RPATH_FLAG everywhere, but this would
result in a ton of changes, so keep the old variable for now and just
set it to the same value to avoid this and keep the possibility to
change it to a different value if necessary later.
2024-01-29 01:15:40 +01:00
oneeyeman1
91de9867ee Add wxStandardPaths::GetSharedLibrariesDir()
This function returns the directory with the application's shared
libraries, which is different from the plugins directory under Mac.

Closes #24052.
2024-01-28 18:41:20 +01:00
Vadim Zeitlin
f82ccc1a19 Merge branch 'image_crash' of https://github.com/Randalphwa/wxWidgets
Don't crash in wxImage::InitAlpha() if it's called on an empty image
and avoid calling it in this case.

See #24260.
2024-01-28 18:18:14 +01:00
Scott Talbert
fc35ad92bb Remove unnecessary empty destructors
These cause a problem for GCC 14 which detects that there are no
corresponding copy constructors and assignment operators and gives
-Wdeprecated-copy-dtor due to their presence, e.g.

/home/fedora/swt2c/wxWidgets/bld/bk-deps g++ -c -o test_allheaders_allheaders.o  -I/home/fedora/swt2c/wxWidgets/bld/lib/wx/include/gtk3-unicode-3.3 -I../../include -D_FILE_OFFSET_BITS=64 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/webp -I/usr/include/blkid -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/fribidi -I/usr/include/sysprof-6 -pthread -I/usr/include/libpng16 -DWITH_GZFILEOP  -D__WXGTK__      -I../../tests -DWXUSINGDLL -I../../tests/../samples -I../../3rdparty/catch/single_include -pthread -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -O2 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/libxml2 -I/usr/include/sysprof-6 -I/usr/include/libpng16 -DWITH_GZFILEOP -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0  -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DPIC   ../../tests/allheaders.cpp
In file included from ../../include/wx/evtloop.h:13,
                 from ../../tests/testprec.h:5,
                 from ../../tests/allheaders.cpp:369:
../../include/wx/event.h: In copy constructor ‘wxSetCursorEvent::wxSetCursorEvent(const wxSetCursorEvent&)’:
../../include/wx/event.h:1943:11: error: implicitly-declared ‘wxCursor::wxCursor(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
 1943 |           m_cursor(event.m_cursor)
      |           ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../include/wx/cursor.h:51,
                 from ../../include/wx/event.h:21:
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
   37 |     virtual ~wxCursor();
      |             ^
../../include/wx/event.h: In member function ‘void wxSetCursorEvent::SetCursor(const wxCursor&)’:
../../include/wx/event.h:1949:57: error: implicitly-declared ‘wxCursor& wxCursor::operator=(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
 1949 |     void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
      |                                                         ^~~~~~
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
   37 |     virtual ~wxCursor();
      |             ^

Fixes #24248.

Closes #24255.
2024-01-28 18:16:07 +01:00
Vadim Zeitlin
50e35c71eb Fix using Alt under MSW when wxGrid has focus
Stop consuming all wxEVT_KEY_UP events in wxGrid as this broke the
standard keyboard handling: pressing and releasing "Alt" didn't give
focus to the menu bar when wxGrid had it.

This also seems completely unnecessary.

Closes #24246.

See #24247.
2024-01-28 18:09:10 +01:00
Blake-Madden
d495c50637 Replace 16-bit code in MSW wxGetUserName() with use of netapi32
Uses NetAPIXXX functions now instead of GetProfileString().

Also update the documentation.

Closes #24242.
2024-01-28 18:05:38 +01:00
taler21
28ced1bc33 Make checks on character entry in numeric validators less relaxed
Restrict the input to not allow values that are greater than the
positive maximum or less than the negative minimum.
In many cases it is not necessary to allow invalid characters to be
entered. For example, if the specified range is 0 to 100.

See #24220.
2024-01-28 18:02:13 +01:00
Vadim Zeitlin
3dad98e06d Merge branch 'tab-key-category'
Exclude Ctrl+I from "TAB" key category and Ctrl+H from the "cut" one.

See #24258.
2024-01-28 17:32:54 +01:00
Vadim Zeitlin
5bb2cb43d1 Restore wxAuiToolBar::RealizeHelper(bool) for compatibility
This function was replaced with a more useful function taking
wxOrientation and returning wxSize in bbba3b7cb9 (Make
wxAuiToolBar::RealizeHelper() return value actually useful, 2023-12-25)
but there is some existing code using the old RealizeHelper() from its
overridden Realize(), so restore it for compatibility, even if it's
quite useless now.

See #24023, #24164, #24244.
2024-01-28 17:32:32 +01:00
Vadim Zeitlin
cc9f9af400 Flush wxLogGui before showing a modal dialog
This ensures that any messages passed to wxLogError() or other functions
are shown before wxMessageBox() that could be referring to them instead
of it happening while the message box is shown (most ports, including
wxGTK) or only after it is dismissed (wxMSW).

See #24231.

Closes #24228.
2024-01-28 17:31:38 +01:00
Vadim Zeitlin
b628237245 Fix crash due to using wxLog during shutdown in a better way
This commit reverts 055c4cbed5 (Fix crash on shutdown if wxConfig
couldn't be saved, 2024-01-04) and implements an alternative solution
mentioned in that commit log message by setting wxTheApp to null pointer
before calling CleanUp().

This ensures that wxLog creates wxLogOutputBest if necessary instead of
recreating wxLogGui which can't be safely used once the cleanup starts:
under MSW the dialog used by it can't be shown once the GUI objects are
destroyed, so logging from CleanUp() still resulted in crashes under
this platform, even after the previous fix.

This change might affect some existing code using wxTheApp during
shutdown but it seems like the only really safe thing to do.

See #24252.
2024-01-28 17:30:52 +01:00
Randalphwa
0255d8dded Switch to wxCHECK_RET instead of silent return 2024-01-27 15:01:17 -08:00
Randalphwa
aa29faed81 GetImageListBitmaps() -- don't modify if invalid
If the bitmap is empty or invalid, there is no reason to attempt to add a mask,
alpha channel, etc.
2024-01-27 11:53:33 -08:00
Randalphwa
994bc961e7 InitAlpha() --avoid crash if empty/invalid 2024-01-27 11:53:33 -08:00
Vadim Zeitlin
dc55e4fe11 Suppress ASAN report about memory leaks in g_quark_init()
This is a one off allocation which won't be fixed by glib maintainers
(see https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2135 and
https://discourse.gnome.org/t/feature-request-enable-compilation-without-memory-leaks/6960
etc).
2024-01-27 19:06:56 +01:00
Vadim Zeitlin
460c35ff0e Return false from wxKeyEvent::IsKeyInCategory(WXK_TAB) for Ctrl+I
Although TAB and Ctrl+I generate the same key code in the events passed
to wxEVT_CHAR handlers, it seems more reasonable to only consider the
former to be in "TAB category", but not the latter.

See #10268.

Closes #24254.
2024-01-27 17:56:21 +01:00
Vadim Zeitlin
6053381b34 Make keyboard sample window bigger on high DPI screens
Add missing FromDIP() when using hard-coded size.
2024-01-27 17:56:21 +01:00
Vadim Zeitlin
29caef7a5a Show pressed key category in the "keyboard" sample
Make it simple to check what does IsKeyInCategory() return for the
various keys.
2024-01-27 17:05:10 +01:00
Vadim Zeitlin
ac3cea5bcd Update FreeBSD 13 image name for Cirrus CI
13.0 doesn't seem to be available any longer, so switch to 13.2.
2024-01-24 17:46:21 +01:00
Vadim Zeitlin
5e1890c068 Merge branch 'cef-docs'
CEF-related documentation and build improvements.

See #24230.
2024-01-24 17:44:01 +01:00
Vadim Zeitlin
f265775527 Use C++17 for MSVS wxWebView project
webview_chromium.cpp requires using C++17 as it includes CEF headers
that require it (e.g. they use std::in_place) and we need to use the
same options all files in this project as they share the same PCH, so
just use C++17 for all of them -- it should do no harm.
2024-01-24 00:14:03 +01:00
Vadim Zeitlin
f05177db2a Improve CMake error message if C++17 is not used with CEF
The previous error didn't make sense if CMAKE_CXX_STANDARD wasn't set,
so use a slightly different message in this case.

Also improve the comment explaining why we need C++17 in the first
place.

Co-Authored-By: Maarten Bent <MaartenBent@users.noreply.github.com>
2024-01-24 00:08:04 +01:00
Vadim Zeitlin
fca0c75b2e Don't give an error if compiler supports C++17 by default
Previously CMake would give an error if CMAKE_CXX_STANDARD wasn't
explicitly set to C++17 or greater when using CEF, but this is not
really needed if the compiler supports C++17 without any non-default
options, so check for this too.
2024-01-23 03:45:59 +01:00
Vadim Zeitlin
5480296dd0 Use C++17 when using CEF and not C++14
CEF uses std::in_place_t which is not available in C++14.
2024-01-23 03:29:23 +01:00
Vadim Zeitlin
8463b13c14 Don't use -Wno-extra with MSVS when building wxWebviewChromium
Only set it for the other compilers.

This fixes a problem introduced in 26025e2652 (Disable -Wextra when
building libcef_dll_wrapper, 2023-12-29).
2024-01-23 03:29:04 +01:00
Blake-Madden
509f853757 Add holiday authority overview
Closes #24240.
2024-01-23 03:23:41 +01:00