Commit Graph
77228 Commits
Author SHA1 Message Date
Ulrich TelleandVadim Zeitlin 57e1c9e1ee Update wxWidgets language database and improve locale matching
This commit improves the best locale match algorithm by prioritizing
closer matches and add many new tests verifying that this works as
expected.

In order to do this, new information had to be added to the language
database, which was extended with it and updated to use the latest
Unicode CLDR data and latest Windows 11 locale list.

Further, add a set of scripts for maintaining the language database up
to date and a GitHub workflow `genlangdb.yml` which can be run manually
to regenerate the wxWidgets language-related source and header files
from the underlying Windows and Unicode data. It produces 2 artifacts:

- wxLanguageDatabaseDist.zip allows to easily update the
  language-related files in the wxWidgets repository by simply copying
  all files.
- the normal workflow log and wxLanguageDatabaseLog.zip allow to check
  all temporary files of the regeneration process and to detect
  potential issues, before the language-related files are actually
  replaced by the new ones.

Finally, fix wxUILocaleImplName::GetPreferredUILanguages: Under Windows
10 and above the Windows API function ::GetUserPreferredUILanguages()
returns only the primary UI language plus US English. Additional
preferred UI languages installed by the user are ignored, so instead of
using this function read the list of user preferred languages from the
Windows registry.

Closes #24855.
2024-11-18 16:46:25 +01:00
taler21andVadim Zeitlin 7239f6ee11 Fix indent of wxTreeCtrl without images in high DPI under MSW
Work around the incorrect behavior of the native control, which causes
the buttons for expanding and collapsing to be displayed too small in
a wxTreeCtrl not using images at high DPI.

Closes #24640.

Closes #24941.
2024-11-12 21:03:50 +01:00
Lauri NurmiandVadim Zeitlin 1ba62a6e78 Fix non-ASCII msgids with wxGETTEXT_IN_CONTEXT_PLURAL
The compilation fix in PR #24925, a47b560 (Fix
wxGETTEXT_IN_CONTEXT* with wxNO_IMPLICIT_WXSTRING_ENCODING,
2024-10-29) aimed for the wxNO_IMPLICIT_WXSTRING_ENCODING
case presumably also has the side effect of preventing
non-ASCII (non-English) msgids with wxGETTEXT_IN_CONTEXT_PLURAL,
also in the regular case when implicit encoding is permitted.

It is best to define wxGETTEXT_IN_CONTEXT_PLURAL separately for
both wxNO_IMPLICIT_WXSTRING_ENCODING and without it, similarly
to how wxGETTEXT_IN_CONTEXT is defined. For some reason it
was defined only once until now.

This commit reverts the definition of
wxGETTEXT_IN_CONTEXT_PLURAL for the regular case to what it
was before.

Closes #24944.
2024-11-10 15:56:56 +01:00
Lauri NurmiandVadim Zeitlin fd28beb2fa Define wxPLURAL regardless of WXINTL_NO_GETTEXT_MACRO
The purpose of WXINTL_NO_GETTEXT_MACRO is, as I understand it, to avoid
name clashes between _() and symbols with the same name introduced by
other libraries or compilers.

Although wxPLURAL has forever (15d0695 (added wxPLURAL() macro,
2005-06-01)) been conditionally defined, there is no similar need with it.
wxPLURAL has a longer name, and is wx-prefixed. The other, more recently
introduced translation macros are not conditionally defined, which makes
wxPLURAL inconsistent in this regard.

Closes #24943.
2024-11-10 15:53:47 +01:00
Vadim Zeitlin b3751da48c Document that XRC default_size for bitmaps is in DIPs
In particular, mention that it doesn't make sense to express it in
dialog units and that this is not supported.

See #24698, #24840.
2024-11-10 15:44:34 +01:00
Vadim Zeitlin 11f0addc83 Account for axis sign when handling device origin in wxMSW wxDC
Changes of 4f9186f1a1 (Increase usable scrolling range in wxMSW by a
factor of 10,000, 2022-04-30) broke device origin handling if axis had
non-default direction because we didn't account for their signs at all.

Just do it now by interpreting the origin correctly depending on
direction.

See #24938.

Closes #24198.
2024-11-10 15:42:27 +01:00
Vadim Zeitlin d148f1c4e9 Use correct name for all Paul Cornett's commits 2024-11-10 15:39:44 +01:00
Vadim Zeitlin 06490f1faf Ignore commit reformatting variables assignments for git-blame
Add another insignificant commit to the list of commits to ignore.
2024-11-05 15:24:16 +01:00
paulcorandGitHub b21642b72b Fix loading BMP files which use 32bpp but do not have valid alpha (#24939)
Based on the behavior of WIN32 LoadFile(), and the gdk-pixbuf BMP loader source
code, the alpha values are ignored unless the compression method is BI_BITFIELDS.
See #10915, #24219
2024-11-04 19:38:54 -08:00
ali kettabandVadim Zeitlin b6e88ef422 wxQt: fix wxClientDC clipping
Fix the change done in f89cbe6eab (wxQt: translate QPainter of
wxClientDC into window client area., 2024-10-28) to set up clipping
correctly.

See #24921.
2024-11-02 21:04:32 +01:00
Roberto BoriottiandVadim Zeitlin 50252c9382 Remove stray zero-width space from Italian translations
No real changes, just remove an accidentally added U+200B from one
translation.
2024-11-02 16:05:19 +01:00
Bill SuandVadim Zeitlin 12b09a5e5e Provide wxXmlResourceHandler for wxVListBox
Fix #24361.

Closes #24867.
2024-11-02 04:03:24 +01:00
Vadim Zeitlin d7528e39ab Merge branch 'aui-update-iconized'
Fix updating AUI while minimized.

See #24934.
2024-11-02 04:01:13 +01:00
Vadim Zeitlin b7bc6a15d6 Merge branches 'gtk-mouse-click', 'gtk-click-captured' and 'gtk-enter-leave-events'
Fix multiple problems with GTK mouse events:

- Avoid phantom release events after dismissing modal dialog (#24931).
- Do send enter/leave events for window-less controls in wxGTK (#24932).
- Fix coordinates in click events sent to window with capture (#24933).
2024-11-02 03:57:53 +01:00
Blake-MaddenandVadim Zeitlin a32caeecd9 Mention that wxHTML can handle background-color style
Closes #24923.
2024-11-02 03:57:22 +01:00
Blake-MaddenandVadim Zeitlin 48df3a32fc wxHtmlPrintout i18n and DPI fixes
Make default titles translatable, don't piece strings together for
title.

Also, make initial frame size DPI aware.

Remove wxT macros.

Closes #24916.
2024-11-02 03:56:29 +01:00
Vadim Zeitlin ec7cfdf2c3 Merge branch 'pg-fixes'
Miscellaneous wxPropertyGrid fixes.

See #24929.
2024-11-02 03:54:48 +01:00
Vadim Zeitlin 3966608c59 Merge branch 'lbox-ownerdraw-bg'
Fixes for owner drawn wxListBox items background.

See #24918.
2024-11-02 03:52:08 +01:00
Vadim Zeitlin 297223ea93 Merge branch 'webrequest-curl-close-crash'
Fix crash in wxWebRequestCURL when connection is refused

See #24914.
2024-11-02 03:44:38 +01:00
Vadim Zeitlin 6277278e45 Merge branch 'aui-hint-fixes'
wxAUI notebook pages dragging-related fixes, fixing #24890 and #24892.

See #24911.
2024-11-02 03:43:38 +01:00
Vadim Zeitlin 3cce8397ec Merge branch 'msw-offset-fixes'
Fix handling client area offset in wxMSW for different DC classes.

See #24924.
2024-11-02 03:40:32 +01:00
Vadim Zeitlin d3f788f371 Don't leave wxGUIEventLoop::m_lastEvent uninitialized
Zero out m_lastEvent originally to avoid reading uninitialized memory
contents later in memcmp() when GTKIsSameAsLastEvent() is copied.
2024-11-01 22:15:42 +01:00
Vadim Zeitlin d20fb1c199 Return empty size from iconized wxFrame GetClientSize() in wxMSW
Returning negative size, due to subtracting tool/status bar size from
it, was unexpected, so return empty, i.e. (0,0), size when the window is
iconized instead, as documented.
2024-11-01 19:13:21 +01:00
Vadim Zeitlin 8b71472619 Don't break AUI layout if Update() is called while iconized
Because we don't have the correct client size when the window is
minimized (at least in wxMSW), postpone the actual update until the
window is restored, as we don't really need to do it until then anyhow.

Closes #24930.
2024-11-01 19:13:21 +01:00
Lauri NurmiandVadim Zeitlin a47b560fd4 Fix wxGETTEXT_IN_CONTEXT* with wxNO_IMPLICIT_WXSTRING_ENCODING
The call to wxGetTranslation() was ambiguous. Fix this by adding missing
wxASCII_STR() for all string literal arguments in wxGETTEXT_IN_CONTEXT
and wxGETTEXT_IN_CONTEXT_PLURAL, just as it is used in _().

Also test that all translation macros expand to compilable code
when wxNO_IMPLICIT_WXSTRING_ENCODING is enabled.

See #1312 and also #24916.

Closes #24925.
2024-11-01 16:35:06 +01:00
Vadim Zeitlin c6bcc29c69 Fix coordinates in click events sent to window with capture
First of all, ensure that the press and release events do go to the
window with the capture, which may not have been the case at all when
the capturing window didn't have a corresponding GDK window, e.g. when
capturing mouse in wxStaticText-derived class.

And also adjust the coordinates to be correct for the captured window to
ensure that the window receives the expected events.
2024-11-01 00:52:52 +01:00
Vadim Zeitlin 36ccedccd4 Send wxEVT_{ENTER,LEAVE}_WINDOW for window-less wxGTK windows too
Send events about entering/leaving windows such as wxStaticText, which
don't have their own window at GTK level, and so don't get the
corresponding signals from GTK -- but we can still synthesize these
events if we detect mouse motion in another window.

This commit is best viewed with Git --color-moved option.

Closes #11848.
2024-11-01 00:16:29 +01:00
Vadim Zeitlin ccfcfbd566 Make log messages in enter/leave callbacks different
No real changes, just make the trace messages more understandable.
2024-11-01 00:16:29 +01:00
Vadim Zeitlin ba3119e6f8 Fix bug with unexpected events after dismissing a modal dialog
This commit fixes a long-standing problem with receiving "phantom"
events after dismissing a modal dialog shown from an event handler which
can be illustrated using the following example:

--------------------------------- >8 --------------------------------------
#include <wx/app.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/frame.h>
#include <wx/msgdlg.h>
#include <wx/sizer.h>
#include <wx/stattext.h>

class TestApp : public wxApp {
public:
    bool OnInit() override {
        auto f = new wxFrame(nullptr, wxID_ANY, "wx Test");
        auto b = new wxButton(f, wxID_ANY, "Dialog");
        b->Bind(wxEVT_BUTTON, [f](wxCommandEvent&) {
            wxDialog dlg(f, wxID_ANY, "Dialog");
            dlg.SetSizerAndFit(dlg.CreateStdDialogButtonSizer(wxOK));
            dlg.ShowModal();
        });

        f->Bind(wxEVT_LEFT_UP, [f](wxMouseEvent&) {
            wxMessageBox("Got left up", "wx Test", wxOK | wxICON_INFORMATION, f);
        });

        auto* const sizer = new wxGridSizer(1);
        sizer->Add(b, wxSizerFlags().Center());
        f->SetSizer(sizer);

        f->Show();
        return true;
    }
};

wxIMPLEMENT_APP(TestApp);
--------------------------------- >8 --------------------------------------

Showing the dialog by clicking the button and then dismissing it by
clicking the button in the dialog resulted in the message box coming up.

This was due to the fact that the existing code preventing GTK from
propagating key and mouse events upwards the window parent chain based
on using the global gs_lastEvent variable didn't work if an event
handler dispatched any events from inside it, e.g. by showing a modal
dialog which ran its own nested event loop: the global variable was
overwritten by the event handling in it and, after dismissing the dialog
and returning to GTK, our handler was called again for the parent window
with the same event that we had already seen, but we didn't ignore it
any more because gs_lastEvent had been changed in the meanwhile.

Fix this by replacing the global variable with a wxEventLoop member
variable and using the currently active wxEventLoop for storing the
"last event", as it ensures that the original event is not overwritten
by event dispatching in the nested event loop.

Note that it would be tempting to achieve the same effect in a much
simpler way by connecting "after" signal handlers for all the signals
that we want to prevent from bubbling up without affecting their default
handling and this actually works fine for all of them -- except the "key
press" one, as it needs to reach the TLW parent in order to trigger the
calls to gtk_window_propagate_key_event() and gtk_window_activate_key()
there and it seems tricky to call these functions manually without
running into infinite recursion. It would be nice if we could do this,
as this would also make using our custom event source (see commit
d0406f4606 (Fix handling of identical consecutive key events,
2014-08-15) and #15802) unnecessary, but for now use this less intrusive
fix.
2024-10-31 20:27:55 +01:00
Vadim Zeitlin c172039659 Replace wxPROCESS_EVENT_ONCE() macro with a function
Get rid of an ugly macro and also simplify things: we don't need
per-function static "eventPrev", as GTK event propagation never
interleaves the events of different types, so we can just have a single
global storing the last event for checking if we had already seen it or
not.
2024-10-31 17:19:56 +01:00
Vadim Zeitlin 5851e34ba8 Revert "Don't prevent the other button release handlers from running in wxGTK."
This reverts 42fdb98f74 (Don't prevent the other button release handlers
from running in wxGTK., 2014-09-27) because it doesn't seem necessary
any more: the original test case from #16055 which this commit was done
to fix works after reverting it and the modified test case from the same
issue doesn't crash any more neither. And, finally, wxTR_EDIT_LABELS
still works too (see #16573).

So follow the usual rule and do stop GTK signal handling if the event
was processed.
2024-10-31 17:19:56 +01:00
Vadim Zeitlin bd60c91198 Use a RAII helper instead of resetting g_lastMouseEvent manually
Ensure that it's always reset on scope exit, which is safer and also
allows to simplify the code a little bit.

No real changes.
2024-10-31 17:19:56 +01:00
Vadim Zeitlin 138090c561 Don't cast g_lastButtonNumber unnecessarily in wxGTK wxDropSource
This cast became unneeded after the changes of 8f9850dd77 (Fix X server
hang in DND., 2006-11-14), so remove it, finally.

No real changes.
2024-10-31 17:19:56 +01:00
Vadim Zeitlin d48fbd1aba Add tracing of mouse press and release events to wxGTK too
No real changes, this is just a debugging helper.
2024-10-31 17:19:56 +01:00
Vadim Zeitlin c28eb2b1c7 Also add the check to wxPropertyGrid::DrawItemAndValueRelated()
This is similar to the previous commit and adds a check for the
parameter being non-null to this function too for consistency and
extra safety.
2024-10-30 16:16:44 +01:00
Vadim Zeitlin 76cb9b6ba1 Add parameter validity check to wxPropertyGrid::RefreshProperty()
Don't crash in this function if it ever happens to be passed a null
pointer again (see the fix in the parent commit) and document that it
takes a non-null pointer.
2024-10-30 16:15:18 +01:00
Vadim Zeitlin 790aa18f41 Fix crash in wxPropertyGrid with wxGTK3 after recent change
Since the recent 27fe76fcbf (Fix wxPropGrid editor appearance after DPI
change, 2024-10-20) creating wxPropertyGrid in wxGTK immediately crashed
if there was no selection in it.

Check that we have a non-null selected property before calling
RefreshProperty() with it to avoid this.

See #24898.
2024-10-30 16:12:14 +01:00
Vadim Zeitlin d6e2f8fec6 Remove unneeded code and variable in wxAuiManager code
Remove some remnants of the code resetting m_actionHintRect which became
unnecessary many years ago and don't use a temporary variable when we
can just assign to m_actionHintRect itself directly instead.

No real changes.
2024-10-28 23:47:50 +01:00
Vadim Zeitlin c183a0cd40 Remove unnecessary offset of hint rectangle by client area origin
This shouldn't be necessary and won't be, once the related bugs in the
different ports (see #24924 for wxMSW) are corrected.
2024-10-28 23:47:32 +01:00
Vadim Zeitlin d266287486 Fix origin of wxOverlay for wxFrame with toolbar in wxMSW
Offset the rectangle correctly: doing it before calling ClientToScreen()
didn't work because it doesn't seem to handle negative coordinates, so
convert client (0, 0) to screen coordinates first and then compensate
(which requires using the negative offset) for the adjustment already
done in wxClientDC.
2024-10-28 23:44:48 +01:00
Vadim Zeitlin 2765d8098f Do offset wxClientDC and wxPaintDC by client area origin in wxMSW
We didn't use GetClientAreaOrigin() in wxMSW, unlike in all the other
ports, meaning that for the frames with a toolbar the origin of
wxPaintDC was hidden behind the toolbar itself.

Fix this and ensure that the origin is the point just below (or to the
right of) the toolbar instead.
2024-10-28 23:43:47 +01:00
utelleandVadim Zeitlin 6bcbcf9d09 Make wxMSW date/time picker controls locale aware
Set the date/time format corresponding to the current locale after
creating the control.

See #23965.
2024-10-28 17:40:18 +01:00
Lauri NurmiandVadim Zeitlin 795c02c498 Make wxWARN_UNUSED work with Clang (again)
Checking for availability of 'warn_unused' using __has_cpp_attribute
evaluates to false with Clang, even when the attribute is actually
available. __has_attribute gives the correct result, so use it instead,
despite the aesthetic inconsistency with other checks.

See #24833.

Closes #24907.
2024-10-28 17:39:21 +01:00
Vadim Zeitlin 74a1997842 Merge branch 'endsession-fixes'
Miscellaneous end session-related fixes for wxMSW.

See #24906.
2024-10-28 17:38:39 +01:00
Vadim Zeitlin 4e15b57593 Merge branch 'fix-archive-clang19' of https://github.com/lanurmi/wxWidgets
Fix compilation of <wx/archive.h> on Clang 19 on Fedora.

Clang 19.1.0 on Fedora Rawhide fails to compile <wx/archive.h> because
m_rep's members are accessed as if m_rep was not a pointer, but it is.

This is obviously wrong with any compiler, but apparently because
wxArchiveIterator is a template class, and its operator=() is never
called in tests, its brokenness went unnoticed.

It has been broken ever since the commit where the code was added,
0037559, 20 years ago.

See #24922.
2024-10-28 17:37:20 +01:00
ali kettabandVadim Zeitlin f89cbe6eab wxQt: translate QPainter of wxClientDC into window client area.
Because Qt considers the menubar and toolbar parts of the client area
and we need to apply the same fix done for wxPaintDC in this commit
9652958 (translate QPainter into window client area.) to wxClientDC too.

Closes #24921.
2024-10-28 17:31:06 +01:00
Blake-MaddenandVadim Zeitlin 3572ed5889 Use white background for wxHtmlWinParser without a window
If HTML parser has no window connected to it, fall back to black text on
white background as using the system colour can result in unreadable
text if the system is using dark mode.

Closes #24919.

Closes #24920.
2024-10-28 17:12:11 +01:00
Lauri Nurmi 86dae550cf Add a trivial test for wxArchiveIterator::operator=()
It is necessary to call operator=() in tests to ensure it even
compiles.
2024-10-28 12:27:14 +02:00
Lauri Nurmi c70a281c33 Fix compilation of <wx/archive.h> on Clang 19 on Fedora
Clang 19.1.0 on Fedora Rawhide fails to compile <wx/archive.h>
because m_rep's members are accessed as if m_rep was not a pointer,
but it is.

This is obviously wrong with any compiler, but apparently because
wxArchiveIterator is a template class, and its operator=() is
never called in tests, its brokenness went unnoticed.
2024-10-28 12:26:31 +02:00
Vadim Zeitlin 926ab60603 Factor out common part of wxListBoxItem and wxCheckListBoxItem
No real changes, this is just a refactoring extracting common code in
src/msw/listbox.cpp and src/msw/checklst.cpp into a new header which can
be reused from both places.

As a side effect, wxCheckListBoxItem now uses the wxListBox fix for
background colour from the parent commit, which makes it unnecessary to
set it explicitly in it any more.

Also test customizing the text colour of wxCheckListBoxItem in the
sample for completeness.
2024-10-27 14:34:15 +01:00