Commit Graph

72301 Commits

Author SHA1 Message Date
Vadim Zeitlin
dec0c1b5b6 Don't return wxNullBitmap from XRC GetBitmapBundle()
Return an empty bundle directly instead of relying on conversion from
invalid bitmap.
2022-02-20 17:55:59 +01:00
Vadim Zeitlin
cc54b767d3 Define NIIF_USER if it's not defined too
This fixes compilation after the changes of 148f56085f (Define
NIIF_LARGE_ICON ourselves if it's not defined, 2022-02-19) for the
compilers using headers so old that they don't even define NIIF_USER
which exists since XP SP2 -- which includes MinGW 5.3 used for our
AppVeyor CI builds.
2022-02-20 17:06:43 +01:00
Vadim Zeitlin
4a63bae1c8 Use wxRecursionGuard to set and reset wxGTK g_inSizeAllocate
This is a bit shorter and more robust, as it ensures that the flag will
be reset even if we return earlier.

No real changes.
2022-02-20 00:00:33 +01:00
Vadim Zeitlin
5cc8e34dfb Fix completely broken code in the parent commit
This was accidentally committed without being tested, correct it now.

See #22138.
2022-02-19 23:13:40 +01:00
Vadim Zeitlin
6168e1625d Get the icon of requested size directly in X11 wxTaskBarIcon code
Instead of getting the bitmap of the default size and then possibly
rescaling it, get the icon of the correct size directly from the bitmap
bundle, which could yield better results (and at worst would do the same
thing as before, but with less code).

See #22138.
2022-02-19 21:50:57 +00:00
Vadim Zeitlin
148f56085f Define NIIF_LARGE_ICON ourselves if it's not defined
It should actually always be defined when using any of the currently
supported compilers, but define it ourselves just in case it isn't.

At least get rid of #ifdef checking for it in the code.

See #22138.
2022-02-19 21:47:16 +00:00
Alexander Koshelev
1278aae752 Use wxBitmapBundle in wxTaskBarIcon
Update the sample to use wxBitmapBundle too.

Closes #22138.
2022-02-19 21:44:27 +00:00
Vadim Zeitlin
66723b671f Ask whether X11 or Wayland is used in the bug report template
This is rather important, as many wxGTK bugs only manifest themselves
under one or the other, so ask to specify which one is used.
2022-02-19 22:36:50 +01:00
Vadim Zeitlin
66e8d7d1af Really fix fallback logic in wxArtProvider::GetBitmapBundle()
The code added to this function in ae7fa19ae3 (Improve fallback logic in
wxArtProvider::GetBitmap{,Bundle}(), 2022-01-31) didn't do anything at
all because of forgotten "break" after creating the bundle.

Also tweak this code slightly because it was not optimal: consider a
situation with 3 providers, the first one not having neither the bitmap
nor the bundle with the given ID, the second one having the bundle and
the third one having only the bitmap. With the old logic here (if it
were fixed to actually work), we would return wxBitmapBundleImplArt,
i.e. use wxArtProvider::GetBitmap() that would end up getting the bitmap
from the provider 2 bundle, i.e. do the right thing, but in a rather
indirect way.

With the new version we just return the bundle of the provider 2
directly. And we also avoid calling GetBitmap() more than once, which is
unnecessary as its return value doesn't change anyhow.
2022-02-19 17:12:33 +00:00
Vadim Zeitlin
61d10a7328 Remove unnecessary wxSizer::Fit() calls
wxSizer::SetSizeHints() already does what Fit() does (while also setting
the minimum window size to the fitting size), so there is no need to
call both of them.

No real changes, just some cleanup.
2022-02-19 15:38:07 +01:00
Vadim Zeitlin
fab42c3e2c Harmonize wxSizer::Add() calls in wx{Text,Number}EntryDialog
These dialogs are pretty similar, so use the same wxSizerFlags arguments
when constructing them for consistency.

Using wxSizerFlags::Border() instead of hard-coded 5 or 10px is also
more correct and improves wxNumberEntryDialog appearance in high DPI
under MSW.
2022-02-19 15:34:12 +01:00
Vadim Zeitlin
a83fff2902 Remove unnecessary SetAutoLayout(true) calls
There is no need to call SetAutoLayout() explicitly after (or just
before) calling SetSizer() with a valid sizer pointer, as SetSizer()
already enables automatic layout, so just drop the useless calls.

No real changes.
2022-02-19 15:08:12 +01:00
Vadim Zeitlin
d4909ffd07 Remove unnecessary wxBeginBusyCursor() from generic dialogs
For some reason lost in the mist of time (this seems to have started in
92afa2b150 (Did somework on the generic dialogs, Renamed wxBox ->
wxBoxSizer Removed old dialog layout code,, 1999-08-11)) we were setting
busy cursor while creating several generic dialogs.

This is completely useless, so just stop doing it.
2022-02-19 14:57:41 +01:00
Paul Cornett
d1e59441a5 Support auto-scrolling when rubberbanding with generic wxOverlay
The backing bitmap needs to be updated when the window scrolls.
This works well on MSW and GTK2, but GTK3 with X11 still has
artifacts, because GtkScrolledWindow draws onto the client area.
2022-02-18 10:18:53 -08:00
Vadim Zeitlin
6efd3b4438 Fix -Wnoexcept from gcc 10.3 in STL build
Add more wxNOEXCEPT to hash-related classes to avoid warnings like

.../c++/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = wxStringHash]’:
include/wx/clntdata.h:33:22:   recursively required from ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = wxString; _Tp = int (*)(void*, void*); _Hash = wxStringHash; _Pred = wxStringEqual; _Alloc = std::allocator<std::pair<const wxString, int (*)(void*, void*)> >]’
include/wx/clntdata.h:33:22:   required from here
.../c++/bits/hashtable_policy.h:1112:40: error: noexcept-expression evaluates to ‘false’ because of a call to ‘wxStringHash::wxStringHash()’ [-Werror=noexcept]
 1112 |       _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
      |                                        ^~~~~~~~~~~~~~~
In file included from include/wx/clntdata.h:16,
                 from include/wx/event.h:17,
                 from include/wx/evtloop.h:14,
                 from tests/testprec.h:5,
                 from tests/allheaders.cpp:410:
include/wx/hashmap.h:568:5: note: but ‘wxStringHash::wxStringHash()’ does not throw; perhaps it should be declared ‘noexcept’
  568 |     wxStringHash() {}
      |     ^~~~~~~~~~~~

that started to be given my MinGW x86-64 10.3.9 (although they were not
given by 10.2.1 version of the same compiler).

But adding wxNOEXCEPT here is more consistent with the changes of
7d74df9a03 (Add wxNOEXCEPT to the hash structs operator() declarations,
2020-08-30) and makes sense anyhow.
2022-02-18 17:02:10 +01:00
Mehmet Soyturk
8aa5c55f61 Change wxRichTextParagraph::m_cachedLines data type to vector
Now wxRichTextParagraph::m_cachedLines is stored as a wxVector instead
of a wxList.

See #2523, closes #2577.
2022-02-17 01:20:01 +01:00
Maarten Bent
151a9c5a63 Fix determining DPI info for wxDialog creation
WM_NCCREATE is not received for dialogs, so use a different message.
There seem to be no other messages that are always and only send on
creation, so use WM_NCCALCSIZE which seems always generated but not too
often.

Use m_activeDPI to determine if the DPI variables have been initialized
or not, instead of adding another variable for this.

Closes #22133.
2022-02-16 22:49:54 +00:00
Blake-Madden
4c5f39426e Add example of using wxString::ToCDouble() to the documentation
Add an example showing the meaning of the return value.

Also, a couple other small edits.

Closes #22129.
2022-02-16 22:42:58 +00:00
Vadim Zeitlin
4ff445af4d Check that we parsed something in wxBitmapBundle::FromSVG()
Don't always return success from this function, NanoSVG just skips
everything until the start of the XML prologue and doesn't return an
error even if it doesn't find it at all, so check that it could parse at
least something to avoid returning a "valid" bundle not containing
anything at all.

Add a unit test checking that we actually can't create an SVG from a
.bmp file (which is something that "worked" before).
2022-02-15 19:37:22 +00:00
Paul Cornett
3aad506c5b Avoid some -Wfloat-conversion warnings 2022-02-13 18:11:55 -08:00
Paul Cornett
511c537362 Avoid -Wsign-compare warnings 2022-02-13 13:52:52 -08:00
Paul Cornett
eafa248117 Avoid mirroring text when wxDC axes are inverted with GTK3
This was already done for RTL, just extend it to inversion of either axis,
as this is the behavior of MSW and GTK2.
See #22113
2022-02-13 10:22:48 -08:00
Paul Cornett
a2076a3dd7 Build fix
This was supposed to be part of b62a1f8f1a (wxOverlay implementation for Wayland, 2022-02-13)
2022-02-13 09:13:57 -08:00
Paul Cornett
b62a1f8f1a wxOverlay implementation for Wayland 2022-02-13 09:03:36 -08:00
Vadim Zeitlin
574548e559 Fix -Wundef in wxAUI in PCH builds after the last change
We need to include wx/dcbuffer.h even when using PCH, it's not included
by wx/wx.h.
2022-02-13 02:10:59 +01:00
Vadim Zeitlin
d00aeb5813 Avoid using double buffering unnecessarily in wxAuiNotebook
We don't need to do double buffering on our own if the underlying
platform always does it anyhow, as macOS and GTK 3 do.
2022-02-13 01:43:18 +01:00
Vadim Zeitlin
0401fe21f7 Inherit scaling factor in wxBitmap ctor taking wxDC in wxGTK
This is the documented behaviour and not doing it breaks wxAuiTabCtrl
redrawing in high DPI, as it uses this ctor for double buffering.
2022-02-13 01:10:19 +01:00
Vadim Zeitlin
cd7b6f5507 Fix build after a merge conflict in parent commit
Rename CreateWithLogicalSize() to its new name.
2022-02-13 00:41:17 +01:00
Vadim Zeitlin
c08c539d18 Merge branch 'ak_wizard' of https://github.com/kosh543/wxWidgets
Use wxBitmapBundle in wxWizard.

See #22124.
2022-02-13 00:30:26 +01:00
Vadim Zeitlin
9dc34611c7 Merge branch 'ak_htmllistbox' of https://github.com/kosh543/wxWidgets
Use wxBitmapBundle in wxHtmlWindow.

See #22123.
2022-02-13 00:29:39 +01:00
Vadim Zeitlin
f0e6a8b15a Merge branch 'bitmap-scale-fixes'
Really fix setting wxBitmap scale factor in wxMSW and rename
wxBitmap::CreateWithLogicalSize() to CreateWithDIPSize().

See #22118.
2022-02-13 00:27:24 +01:00
Blake-Madden
ddf90dc3e0 Fix comment in example for banner window
Should say top edge, not left.

Closes #22122.
2022-02-11 18:48:03 +01:00
Vadim Zeitlin
9ab6a5244f Merge branch 'fsw-tests'
Try to do something about recurrent failures in wxFSW unit tests.

See #22119.
2022-02-11 18:47:23 +01:00
Vadim Zeitlin
4436a126dc Merge branch 'tbar-hidpi'
Fix toolbar resizing when moving to a lower DPI screen.

See #22117.
2022-02-11 18:46:49 +01:00
Vadim Zeitlin
00bd8c5576 Fix high DPI support for MDI windows
High DPI support didn't work for wxMDIParentFrame (and everything
inside it) because it was only enabled when InheritAttributes() from
wxNonOwnedWindow was called and this was only done in wxTopLevelWindow
but not in this class.

Fix this by removing the need to call InheritAttributes() at all and
just initializing m_perMonitorDPIaware when the window is created
automatically, to ensure that it can't be forgotten.

Co-Authored-By: Maarten Bent <MaartenBent@users.noreply.github.com>

Closes #22116.
2022-02-11 18:45:48 +01:00
Vadim Zeitlin
74424cbeb2 Rename wxBitmap::CreateWithLogicalSize() to CreateWithDIPSize()
The new name, recently introduced in 94716fd801 (Add
wxBitmap::CreateWithLogicalSize(), 2022-01-22), was perhaps more clear,
but also misleading and confusing because the postcondition

	CreateWithLogicalSize(size, 2).GetLogicalSize() == size

was not satisfied under MSW, so rename it once again, and hopefully
finally, because the new name is consistent with GetDIPSize() returning
the same size.

Also try to improve the documentation a bit more.
2022-02-11 17:30:57 +00:00
Vadim Zeitlin
20f82e2ccb Fix CreateWithLogicalSize() to set correct scale in wxMSW too
Unlike under Mac (see previous commit), this never worked correctly in
wxMSW at all, only SetScaleFactor() could be used to change the scale
factor of the bitmaps there.

Fix this and make CreateWithLogicalSize(..., scale) result in
GetScaleFactor() returning the same scale for the resulting bitmap, as
expected, under MSW too.

Also add a unit test verifying that this holds.
2022-02-11 17:15:51 +00:00
Vadim Zeitlin
6f5ac3c594 Fix CreateWithLogicalScale() to set correct scale in wxOSX
This got unfortunately broken by the changes of 94716fd801 (Add
wxBitmap::CreateWithLogicalSize(), 2022-01-22).
2022-02-11 17:15:51 +00:00
Alexander Koshelev
d6271a6c10 XRC: use wxBitmapBundle in wxWizard 2022-02-11 18:04:56 +03:00
Alexander Koshelev
e6a8e8ccfb Use svg files in wizard sample 2022-02-11 18:04:56 +03:00
Alexander Koshelev
429b5561ff Use wxBitmapBundle in wxWizard 2022-02-11 18:04:56 +03:00
Alexander Koshelev
bbcaa7b9e0 Use wxBitmapBundle in html about sample 2022-02-11 16:47:47 +03:00
Alexander Koshelev
7a2a1e9074 Use wxBitmapBundle in wxHtmlWindow 2022-02-11 16:16:45 +03:00
Paul Cornett
2356dda034 Export IsX11/IsWayland symbols needed by wxMediaCtrl library 2022-02-10 11:16:36 -08:00
Paul Cornett
94868c6f41 Add functions for determining if GDK3 backend is X11 or Wayland 2022-02-10 10:15:08 -08:00
Vadim Zeitlin
d130323a4c Fix default size of wxBitmapBundle created from scaled bitmap
We need to use GetDIPSize(), not GetLogicalSize(), for this to work
correctly under MSW too.

Also add a unit test checking for this.
2022-02-10 14:01:09 +00:00
Vadim Zeitlin
20d1188e82 Really fix setting wxBitmap scale factor
Optimization of 2ae80673ff (Avoid unnecessarily unsharing bitmaps in
wxMSW, 2022-02-02) broke setting the scale factor because we didn't
update the right bitmap data in case bitmap hadn't had exclusive
ownership of its data before. Fix this by not using a reference which
may refer to another object after AllocExclusive() call.

Also change the other ports to unshared the bitmap when modifying its
scale factor so that the new unit test passes for them too.
2022-02-10 14:01:09 +00:00
Vadim Zeitlin
34ca92d362 Show logs in case of Mkdir or Rmdir failures in wxFSW unit tests
Try to gather more information about the test failures on GitHub Actions
when creating or removing the test directory that isn't reproducible
locally.
2022-02-10 13:55:54 +00:00
Vadim Zeitlin
046f228bb2 Reset watch directory in wxFileSystemWatcher unit test
Share the same variable between GetWatchDir() and RemoveWatchDir() to
make things more clear.

Also check for GetWatchDir() postcondition (i.e. that the directory
exists) in the function itself instead of doing it in the caller.
2022-02-10 13:38:00 +00:00
Vadim Zeitlin
93c86fe5cd Fix harmless signed/unsigned warning in wxRegEx unit test
Cast the expected number of matches to "int" to have the same type as
wxRegEx::Replace() return value -- there is no danger of truncation here
as we're never going to expect billions of matches.
2022-02-10 13:36:49 +00:00