Commit graph

75358 commits

Author SHA1 Message Date
Vadim Zeitlin
46feaf2066 Ignore NULL to nullptr change in git blame output
This commit touched a lot of file without really changing anything.
2023-11-17 00:38:33 +01:00
Paul Cornett
56303c6236 Document wxDisplay::GetDepth()
Should have been part of
24b5e256df (Add wxDisplay::GetDepth() and use it for wxDisplayDepth(), 2018-10-06)
2023-11-16 10:06:57 -08:00
Paul Cornett
6210c622f7 Add minimal wxVideoMode support for Wayland
See #24021
2023-11-16 09:47:37 -08:00
Paul Cornett
86a0456bc4 Build fix for wxUSE_CONFIG==0 2023-11-15 20:36:21 -08:00
Paul Cornett
67090e61d2 Improve wxSystemSettings::GetMetric() scrollbar width calculation for GTK3
See #24057
2023-11-15 20:31:24 -08:00
Paul Cornett
2d07dd25b4 Improve desktop environment detection
Add code that works for Wayland, and any DE
2023-11-10 11:23:24 -08:00
Vadim Zeitlin
39079cbf23 Return true from AddCatalog() if message ID matches language
When the original messages language matches the language of the locale
being used, these strings can be used directly and so AddCatalog()
should still return true for them but it didn't do it any more after the
changes of 94b1a17aeb (Add AddAvailableCatalog() and use it in
AddStdCatalog(), 2023-09-30).

See #18227.

Closes #24019.

Closes #24037.
2023-11-07 15:11:26 +01:00
Vadim Zeitlin
6fbb504955 Merge branch 'auibook-drag-fix'
Fix crash when dragging in wxAuiNotebook and make the code more robust.

See #24039.
2023-11-07 15:09:56 +01:00
Vadim Zeitlin
716be1bc27 Merge branch 'msw-build-mingw'
Provide more information for building applications using wxWidgets with
MinGW.

See #24036.
2023-11-07 02:33:36 +01:00
Vadim Zeitlin
1761bc3a88 Update documentation of wxTaskBarIcon limitations
Don't mention thoroughly outdated desktop environments such as Gnome 1
and don't make this X-specific as the situation is not at all better
with Wayland.

Do mention IsAvailable().

See #18081.

Closes #24028.
2023-11-07 02:32:20 +01:00
Vadim Zeitlin
a0f7980295 Add wxAuiTabCtrl::DoEndDragging()
No real changes, just refactor the code to reset all drag-related
variables in a single function instead of doing it manually in several
places.

As this function also resets m_clickTab, which could previosuly remain a
dangling pointer, change the code to get its value before calling it.
2023-11-06 00:11:52 +01:00
Vadim Zeitlin
0fd15e405f Initialize wxAuiTabCtrl members in their declarations
Ensure that all of them are initialized, including m_clickTab, which
didn't seem to be always initialized before.

No real changes (as m_clickTab doesn't seem to have been used before it
was initialized).
2023-11-06 00:05:50 +01:00
Vadim Zeitlin
bd7b333a87 Ensure that we only pass valid indices to wxAuiTabCtrl::GetPage()
Passing an invalid index to this function results in a crash, so ensure
this doesn't happen -- at the very least this would have turned the
crash fixed by the parent commit into "just" an assert failure.
2023-11-06 00:02:57 +01:00
Vadim Zeitlin
f1a3816cd9 Fix crash in wxAuiNotebook after dragging a page
Fix using outdated click position in wxAuiTabCtrl mouse handlers, which
resulted in an invalid wxEVT_AUINOTEBOOK_DRAG_MOTION event being
generated and a crash while handling it.

Ensure that we reset m_clickPt when resetting m_isDragging too so that
we don't decide that we're dragging if the mouse enters the window with
the left button already pressed after a previous drag.

Closes #24027.
2023-11-05 23:50:51 +01:00
Vadim Zeitlin
523979b1f1 Explain that using MSVC-specific wx/setup.h is optional
It made sense to emphasize its use when this was the recommended way to
set up MSVS projects, but now the simplest (and hence recommended) way
to do it is using wxwidgets.props file, so make the manual setup
instructions more generic as they're most likely to be used with
non-MSVC compilers.
2023-11-05 02:26:58 +01:00
Vadim Zeitlin
23abd00d0b Slightly improve the example list of libraries to link with
Fix spelling error and use more forward-looking "34" in their names.
2023-11-05 02:26:58 +01:00
Vadim Zeitlin
ae91254d3e Provide MinGW-specific instructions for building applications
We had instructions for building wxWidgets with MinGW but not for
building the applications using wxWidgets, so add them too now in the
hope that it will be helpful to people who struggle to find the options
to use for building -- or at the very least to the people who have to
answer the questions about this, as they could now just point to these
instructions.
2023-11-05 02:26:58 +01:00
Blake-Madden
9bae94022c Fixes for wxTextProofOptions documentation
Fix missing semicolons causing help parsing to break.

Document Language().

Fix typo.

Closes #24026.
2023-11-03 00:52:12 +01:00
Vadim Zeitlin
31fefa7ba2 Merge branch 'cxx17-string-toculong'
Fixes for C++17 version of wxString::ToCULong().

See #24022.
2023-11-03 00:51:04 +01:00
Vadim Zeitlin
71c25b4de7 Merge branch 'getsubbitmap-fixes'
Assorted fixes to wxBitmap::GetSubBitmap().

See #24010.
2023-11-03 00:49:50 +01:00
Vadim Zeitlin
ae2b05be5c Fix more compatibility problems in C++17 wxString::ToLong()
Unlike the traditional C functions, std::from_chars() doesn't skip
leading whitespace and doesn't accept the leading "+" sign, so we need
to skip them explicitly to preserve the behaviour of ToLong() in the
previous wxWidgets versions.
2023-10-31 00:44:10 +01:00
Vadim Zeitlin
8d6a722ed8 Fix C++17 implementation of wxString::ToCULong()
Do use std::from_chars<unsigned long>() in it as otherwise values
greater than LONG_MAX failed to parse.

Handle negative numbers explicitly to still parse them in this function
as well, as needs to be done for compatibility.

Add a test case for the previously failing numbers.

Closes #23957.
2023-10-31 00:44:10 +01:00
Vadim Zeitlin
9a620bf920 Refactor: extract SetBaseAndSkipPrefix() from wxString::ToCLong()
No real changes, just extract part of the function into a separate
helper to allow reusing it in the next commit.
2023-10-30 23:56:11 +01:00
Joan Bruguera Micó
abfdd186ff Undo wxGLCanvas::SwapBuffers() Wayland frame sync.
This reverts the frame synchronization logic that was recently added
with the purpose of avoiding performance issues due to `eglSwapBuffers`
blocking when the canvas is hidden or occluded.

This logic should be unnecessary after `eglSwapInterval(display, 0)`
is called, since `eglSwapBuffers` should never block anymore.
Furthermore, as it stands now, it causes the canvas to continuously
repaint itself at the refresh rate of the display, which is wasteful
for applications which do not need to continuously refresh.

Fixes #24012.

Closes #24017.
2023-10-30 00:26:11 +01:00
Joan Bruguera Micó
133f7731b2 Ignore spurious map-events on Wayland's wxGLCanvasEGL
In the recent changes for handling map/unmap events on Wayland's
wxGLCanvasEGL, we use the following GTK widget signals:
* The "map-event" signal to create the canvas's subsurface.
  The earlier "map" signal can not be used, as the associated toplevel
  window's Wayland surface may not yet exist by the time we receive it.
* The "unmap" signal to destroy the canvas's subsurface.
  Using the later "unmap-event" signal is problematic, due to other
  resources we build upon being already destroyed by then.

Usually, the "map-event" signal comes before "unmap" and resources are
created and destroyed appropriately. However, there's an edge case:
If a canvas is shown and then immediately hidden (before wxWidgets can
pump from the event loop), "unmap" will come before "map-event".
This happens because signals like "map" and "unmap" are delivered
immediately (when calling e.g. `gtk_widget_hide`), while signals like
"map-event" and "unmap-event" are delivered later on the event loop.

For the same reason, showing a canvas, then immediately hiding it, then
immediately showing it again, will cause two "map-event"s to get
delivered enqueued without a "unmap" in between.

This condition can be hit quite easily when setting up a complex UIs,
and in particular it is triggered by Aegisub during startup, leading to
a crash (Wayland protocol error) when opening a video later, or when
specifying a video directly on the startup command line.

To avoid this breaking our resource management, add some checks to detect
those "map-event"s we shouldn't handle - either the ones that happen
after "unmap", or the duplicate ones without an "unmap" in between.

Fixes #23961.

Closes #23968.
2023-10-30 00:24:51 +01:00
Joan Bruguera Micó
22ae7a58b5 Clean up Wayland resources on wxGLCanvas destructor
If the wxGLCanvas is destroyed immediately (without hiding it first),
the GTKs widget's `unmap` signal which usually destroys the Wayland
resources is not emitted. Thus, we need to ensure they are destroyed
on the destructor instead.

This fixes an use-after-free issue, sometimes causing a crash, because
one of the leaked resources is the canvas's Wayland frame callback.

Fixes #24013.

Closes #24016.
2023-10-30 00:20:30 +01:00
Vadim Zeitlin
64afa9d963 Ensure that we call eglSwapInterval() for the correct context
Calling it from the frame callback might change the swap interval for
the wrong context if the active context got changed in the meanwhile,
but by the time SwapBuffers() is called the correct context must be set.

Doing it there also allows to unify X11 and Wayland code branches.
2023-10-29 19:37:28 +01:00
Martin Corino
8fc73d45ce Document wxPGSelectPropertyFlags enum
This enum is used in the public API and so needs to be documented.

Closes #23980.
2023-10-29 02:54:03 +02:00
ali kettab
8b66609f16 Fix wxTLW::SetSizeHints() implementation under wxQt
As documented, the value -1 is special which means no constraints will
be used.

In other words, we should use the Qt defaults if -1 was specified.

Closes #24008.
2023-10-29 02:49:17 +02:00
PB
220031c0da Fix buttons missing in widgets sample after recent changes
The Clear log and Exit buttons were not shown after the changes
in a69fabe (Fix using wxStaticBoxSizer in samples, 2023-10-22).

Fix this by creating them with the proper parent.

Closes #24005.

Closes #24007.
2023-10-29 02:47:46 +02:00
Vadim Zeitlin
3dd977f53a Make using EGL under Wayland from outside wxEVT_PAINT work again
Since the changes of 194a7be33f (Improve wxGLCanvasEGL refresh logic
under Wayland, 2023-05-17, see #23554) drawing on wxGLCanvas from
wxEVT_IDLE handler without refreshing the window first didn't work any
longer because the "ready to draw" flag was always false in this case.

To make this work again, refresh the window ourselves to ensure that it
does get redrawn. This is less efficient than drawing on it from
wxEVT_PAINT because all the code executed by the application prior to
calling SwapBuffers() is just wasted, but better than not updating the
window at all.

The recommended way of doing things remains, just as it always was, to
draw from wxEVT_PAINT and call Refresh() in the application code when
the window needs to be updated.

See #23998.

Closes #23996.
2023-10-29 02:46:31 +02:00
Vadim Zeitlin
8f3331e8c1 Fix assert checking input size in wxOSX GetSubBitmap()
Extend the just added GetSubBitmap() unit test to check for this too.
2023-10-29 01:48:29 +02:00
Vadim Zeitlin
2cf77c2596 Fix GetSubBitmap() returned value size when rounding is required
When using non-integer scale factor, we need to round the result of the
multiplication by it instead of truncating it for consistency with the
behaviour of wxBitmap::CreateWithDIPSize() and the other places where we
do this, including wxOSX version of this function.

Add a simple unit test checking that this works correctly (it would fail
with wxGTK before).
2023-10-29 01:48:27 +02:00
Vadim Zeitlin
4048542d54 Move test not depending on it outside wxHAS_RAW_BITMAP check
No real changes, just don't put the test not using raw bitmap access
inside the section guarded by "#if wxHAS_RAW_BITMAP".

This commit is best viewed with Git --color-moved option.
2023-10-29 01:48:11 +02:00
Vadim Zeitlin
34bce88b23 Improve assert message in wxOSX and wxMSW GetSubBitmap()
Don't test for 2 unrelated conditions inside the single assert as this
makes it unclear which of them failed.

Separate the checks for bitmap and input parameter validity, just as it
was already done in wxGTK.
2023-10-29 01:22:47 +02:00
Vadim Zeitlin
3ac8c2717e Set scale factor of bitmap returned by wxMSW GetSubBitmap()
The bitmap scale factor may not be used in wxMSW, where physical and
logical size are the same, but still set it for consistency with the
other ports.
2023-10-29 01:22:47 +02:00
Stefan Csomor
695ca04289
change implementation to a sonoma supported version (#24003) 2023-10-27 14:18:17 +02:00
PB
4ddea5658d Cover default button in wxDialog::CreateStdDialogButtonSizer docs
Add a note explaining that when creating a button sizer with this
method, one of the buttons will be usually made the default.

See #23992.

Closes #24001.
2023-10-25 23:54:22 +02:00
Randalphwa
b297edbe79 Fix using unique_ptr<> in the builds with wxUSE_INTL==0
Include standard library <memory> header file explicitly in the files
where std::unique_ptr<> is used instead of relying it on getting
implicitly included from the other headers, as this doesn't happen when
wxUSE_INTL==0.

Closes #23999.
2023-10-25 23:50:17 +02:00
Vadim Zeitlin
600049f20c Merge branch 'dfb-cxx17'
Fix wxDirectFB build with C++17.

See #23991.
2023-10-25 23:49:00 +02:00
Vadim Zeitlin
72b4658d5a Merge branch 'gtk-gui-app-console-mode'
Add a test for running wxGTK GUI apps in console mode.

See #23981, #23990.
2023-10-25 23:48:00 +02:00
Vadim Zeitlin
9e8a913e4d Merge branch 'qt-textctrl-hittest' of https://github.com/AliKet/wxWidgets
Implement several previously missing wxTextCtrl functions in wxQt.

See #23984.
2023-10-25 23:46:30 +02:00
Vadim Zeitlin
9d06e4c4a7 Implement wxSearchCtrl::GetEditHWND() correctly in wxMSW
Since the changes of 4d76a87015 (Make wxSearchCtrl inherit from
wxTextEntry in all ports, 2023-07-09, see #23697) GetEditHWND() returned
null for wxSearchCtrl which was considered to be correct because all
wxTextEntry functions were supposed to be forwarded to wxSearchTextCtrl
anyhow.

This wasn't really correct, however, as GetEditHWND() was also called
from SetHint(), resulting in an assert failure and falling back on
generic hint implementation which, while mostly working, suffers from
some problems that the native implementation doesn't have.

So make this function return the actual HWND used by the associated text
entry to fix this and allow SetHint() to work as before and also
forestall any problems due to not having the right HWND in the future.

See #23983.

Closes #23975.
2023-10-25 23:45:23 +02:00
Vadim Zeitlin
93b8819a03 Merge branch 'qt-event-trans' of https://github.com/AliKet/wxWidgets
Some fixes for keyboard event processing in wxQt.

See #23974.
2023-10-25 23:44:10 +02:00
Vadim Zeitlin
c1ed2cf33f Fix compiling calls to CopyBits() in C++17
Template arguments can't be narrowed, so use the correct type for them
instead of "int" which is insufficient to hold UINT_MAX.
2023-10-24 01:22:17 +02:00
Vadim Zeitlin
b389483c58 Work around the use of "register" in DirectDB headers
This keyword results in deprecation warnings since C++11 and errors
since C++17 in which it was completely removed.
2023-10-24 01:21:39 +02:00
Vadim Zeitlin
c07a1ec718 Check running the GUI test without GUI in Unix CI builds
This just checks that launching a GUI program and not initializing GUI
in it works as expected and, notably, does not crash.
2023-10-24 01:21:22 +02:00
Vadim Zeitlin
5af28133a0 Fix crash on shutdown of wxX11 GUI applications not using GUI
This should have been done back in f18b415ee3 (Don't crash on startup of
console programs in monolithic wxX11 build., 2011-05-03) when a related
crash on startup was fixed.
2023-10-24 01:21:22 +02:00
Vadim Zeitlin
ea393d76ad Allow running GUI test in console-like app mode
This allows to test that GUI applications not initializing the GUI can
at least start correctly and work as console ones (at least under Unix).
2023-10-24 01:21:22 +02:00
Vadim Zeitlin
c151c9271f Make GTK wxSystemSettings initialization more robust
Add more checks which should not be really needed, but don't do any harm
neither and ensure that we don't use invalid pointers.
2023-10-24 00:36:13 +02:00