Commit graph

75607 commits

Author SHA1 Message Date
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
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
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
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
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
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
acf113f3f9 Update copyright years to 2024
Just run misc/scripts/inc_year and commit the results.

See #18690.
2023-12-31 18:56:06 +01:00
Vadim Zeitlin
a79759d999 Switch wxMSW 32 bit cross build workflow to Debian Stable
Debian Testing doesn't have 32-bit support any more.
2023-12-31 18:03:22 +01:00
Martin Corino
6ee9056c16 Fix column reordering in wxHeaderCtrlSimple and related problems
Override required functions in wxHeaderCtrlSimple to avoid asserts if
its columns are reordered.

Also bring the code behaviour in agreement with the documentation by
calling UpdateColumn() after calling UpdateColumnVisibility().

Finally, only call UpdateColumnsOrder() if the corresponding event was
not processed as the application should use one xor the other mechanism
for reacting to columns reordering, but not both.

Closes #24108.

Closes #24172.
2023-12-31 17:57:19 +01:00
Vadim Zeitlin
927590fbcd Merge branch 'qt-richtooltip-fixes' of https://github.com/AliKet/wxWidgets
wxRichToolTip fixes for wxQt port.

See #24170.
2023-12-31 17:48:37 +01:00
Vadim Zeitlin
00dff6e3bc Stop using $EGREP in configure.ac unnecessarily
We don't have DISABLED_UTILS or DISABLED_DEMOS variables, so it's
useless to exclude them from the makefiles list -- just stop doing it.

This fixes a problem with using EGREP without preceding AC_PROG_EGREP
with autoconf 2.72, as EGREP is not defined any longer with this
version.

See #24168.
2023-12-29 19:03:28 +01:00
Paul Cornett
ce1d317768 Remove GLU dependency
See #23721
2023-12-28 14:49:42 -08:00
Paul Cornett
f1731fd672 Return index of first added image in wxImageList::Add()
This is what MSW does. Broken in c374eefd34 (Fold wxOSX-specific wxImageList into
generic version, 2018-10-30)
See #10013
2023-12-28 12:49:47 -08:00
Paul Cornett
ef326106c0 Improve wxEVT_LEAVE_WINDOW generation while mouse is captured with GTK3
Non-integral coordinates and overlay scrollbars can cause the event to be
generated with coordinates that are still inside the window. Avoid this by
ensuring that integral coordinates are outside the window, and ignoring overlay
scrollbars. Also remove gdk_display_flush(), contrary to the very old comment
it does not seem to be necessary. Fixes wxScrolledWindow auto-scrolling.
2023-12-28 12:39:41 -08:00
Paul Cornett
fc8a780932 Avoid applying "no-window" mouse coordinate conversion to generic wxWindow
For a wxPizza widget in a GtkScrolledWindow, the coordinates are already correct.
2023-12-28 12:32:59 -08:00
Paul Cornett
6cb6cf1fde Use correct comparison for out-of-window mouse coordinate
Coordinates on a window are 0..size-1
2023-12-28 12:26:24 -08:00
AliKet
b284260191
Update interface/wx/nonownedwnd.h
Co-authored-by: VZ <vz-github@zeitlins.org>
2023-12-28 16:35:23 +01:00
ali kettab
7dea9423c5 Fix wxPopupTransientWindow::Dismiss() implementation
Remove installed event handlers before trying to hide the popup,
as this could result in Destroy() being called twice under wxQt.
This happens to wxRichToolTip for example. i.e. Destroy() is called
once from wxPopupFocusHandler::OnKillFocus() after the call to Hide()
then, from wxRichToolTipPopup::OnTimer().
2023-12-27 19:49:10 +01:00
ali kettab
40a6d74aaf Create the wxPopupWindow with a parent under wxQt
The fact that we cannot create a wxPopupWindow with a parent
is no longer valid after the recent changes to the wxQt port.

The wxRichToolTip (an instance of wxPopupWindow) will crash if
created without a parent under this port.
2023-12-27 19:31:50 +01:00
ali kettab
c7fdb41fcd Implement wxNonOwnedWindow::SetShape() taking wxGraphicsPath under wxQt
This is a copy and paste of wxMac's implementation to make wxRichToolTip
work under wxQt.
2023-12-27 19:17:21 +01:00
Vadim Zeitlin
7a306c4a42 Merge branch 'qt-fixes' of https://github.com/AliKet/wxWidgets
Many wxQt improvements and simplifications.

See #24135.
2023-12-27 02:57:14 +01:00
Vadim Zeitlin
378da09c84 Fix typo in "receive" occurring a few times
This is just too annoying to see.
2023-12-27 02:56:20 +01:00
Vadim Zeitlin
5f62f30231 Use WaitForEventAt() in Grid::CellSelect test too
Try making this test more robust as well as it also sporadically fails
on AppVeyor.

Also simplify it a bit, checking for each of the expected events in turn
instead of checking for their total number at the end.
2023-12-27 02:49:53 +01:00
ali kettab
a0b0f524ff Handle wxTextCtrl created with wxTE_DONTWRAP or wxTE_NO_VSCROLL under wxQt 2023-12-26 22:50:59 +01:00
ali kettab
0eaff271ed Fix wxStaticBitmap not using correct bitmap size under wxQt 2023-12-26 22:50:59 +01:00
ali kettab
0fb1a74983 Fix Set{Back,Fore}groundColour() for wxFrame under wxQt
Restrict the effect of these functions to the central widget only.
Otherwise the menubar, toolbar and statusbar would also be affected.
2023-12-26 22:50:59 +01:00
ali kettab
aa562ea2fb Get rid of QtCreateControl() from wxQt code base
If possible, all windows should call wxWindow::Create() on creation now,
because among other things:
- It manages generic and non-generic windows uniformly and transparently
- It ensures an appropriate initial size for the window
- AddChild() and PostCreation() are automatically called
- Scrollbar policies are set in one place.
2023-12-26 22:50:59 +01:00
ali kettab
69ec562f16 Update outdated comments under wxQt
There is no longer a QtGetContainer() function name. wxQtEventForwarder was renamed
to wxQtEventSignalHandler. And QtGetScrollBarContainer() was just removed in previous
commits.
2023-12-26 12:45:52 +01:00
ali kettab
840d362a70 Keep forward declarations of Qt classes in alphabetical order 2023-12-26 12:45:52 +01:00
ali kettab
15f3f4c3af Refactor the code that chooses which widget to use for drawing under wxQt
No real changes.
2023-12-26 12:45:52 +01:00
ali kettab
ee009a6416 Honor wxALWAYS_SHOW_SB flag if specified under wxQt 2023-12-26 12:45:52 +01:00
ali kettab
31aac5fac4 Get rid of QtGetScrollBarsContainer() from wxWindow API under wxQt
Because It is simpler to initialize (the inherited) m_qtContainer member
directly in derived classes during construction process, and make the API
a little bit cleaner.
2023-12-26 12:45:52 +01:00