Commit Graph

39762 Commits

Author SHA1 Message Date
PB
198635ad68 Fix linking issue with wxCmpNatural() in static build
wxCmpNatural() had "inline" function specifier in a .cpp file
which made the function inaccessible outside that file in static builds.

Fix this by removing "inline", the function character is such that the
overhead by a function call should have negligible impact on its
performance.

Closes https://github.com/wxWidgets/wxWidgets/pull/2050

Closes #18919.
2020-09-20 18:21:23 +02:00
Vadim Zeitlin
43249151dd Merge branch 'aui-no-tooltips'
Hide tooltips when style wxAUI_TB_NO_TOOLTIPS is set.

See https://github.com/wxWidgets/wxWidgets/pull/2048
2020-09-20 18:19:30 +02:00
Vadim Zeitlin
466f72a16c Avoid claling FindToolByPositionWithPacking() needlessly
This is a micro-optimization after the previous commit: don't call
FindToolByPositionWithPacking() at all rather than calling it and then
ignoring its result if wxAUI_TB_NO_TOOLTIPS style is set.

This commit is best viewed ignoring whitespace.
2020-09-20 18:18:36 +02:00
Paul Cornett
7d11dd20d4 Replace some floating point expressions with equivalent integer ones 2020-09-18 12:10:40 -07:00
Paul Cornett
7298070ab0 Avoid formatting integers as floating point 2020-09-18 10:57:23 -07:00
Paul Cornett
1912528acb Avoid formatting literal zeros as floating point 2020-09-18 10:53:14 -07:00
Paul Cornett
dcdcbbe078 Fix wxDataViewCheckIconTextRenderer icon size with GTK3 2020-09-17 09:29:30 -07:00
Artur Wieczorek
4b10b4f5e2 Use dedicated function to round values 2020-09-17 13:44:15 +02:00
Jouk
5274d2d647 Add src/gtk/image_gtk.cpp for compilation in OpenVMS makefile 2020-09-17 09:37:12 +02:00
Paul Cornett
b376d1402b Add support for HiDPI bitmaps to wxDataViewBitmapRenderer with GTK3 2020-09-16 11:33:13 -07:00
Paul Cornett
85d63c3150 Add a class derived from GtkImage to support HiDPI bitmaps
And use it to get HiDPI support wherever we use GtkImage. This extends and
consolidates support for custom drawing of images which has already been added
somewhat redundantly in several places.
2020-09-15 11:52:03 -07:00
Ian McInerney
cb04c35365 OSX: Fixes for readonly text fields (#2049) 2020-09-15 08:21:47 +02:00
Ian McInerney
932b9ca62f Hide tooltips when style wxAUI_TB_NO_TOOLTIPS is provided 2020-09-14 21:49:43 +01:00
Artur Wieczorek
014bd2ae54 Implement platform-specific coordinate conversion functions
Generic wxDC::DeviceToLogical{X|Y}() and wxDC::LogicalToDevice{X|Y}()
functions don't take into account transformations applied with
wxDC::SetTransformMatrix() so conversion results are invalid if wxDC is
transformed with both e.g. wxDC::SetUserScale() and
wxDC::SetTransformMatrix().
We need to implement functions in wxDCImpl and its platform-specific
derivates to do this conversion with taking into account all applied
transformations.

See #18916.
2020-09-13 23:47:26 +02:00
Stefan Csomor
bc9e7b71e7 macOS wxNativeFontInfo changes (#2045)
* adding native font descriptor serialization = v2

* remove common xml prefix from serialized string

* Update src/osx/carbon/font.cpp

Co-authored-by: VZ <vz-github@zeitlins.org>

* Update src/osx/carbon/font.cpp

Co-authored-by: VZ <vz-github@zeitlins.org>

* static string via accessor

* striping off xml preamble unconditionally

if we use a different format in the future, we will have to increase our version number

* applying italic directly to the font descriptor

thus preserving attributes in the native font descriptor which we don’t store explicitly yet

* Adding support for preserving font width

Although we don’t express this in the public API yet, we try to preserve eg condensed, when changing the font width

* Adding reference, bug fix

double checked the font weight constants,

Co-authored-by: VZ <vz-github@zeitlins.org>
2020-09-12 19:29:26 +02:00
Vadim Zeitlin
c2b1dbda83 Call GDK functions from main thread in wxGStreamerMediaBackend
This fixes another problem similar to the one fixed in be1854c617 (Avoid
UI functions in non-main thread in wxGStreamerMediaBackend, 2020-09-02)
and does it in a similar way: SetupXOverlay(), which calls gdk_flush(),
was called from gst_bus_sync_callback() which is executed in the worker
thread, so use CallAfter() to call it from the main thread later.
2020-09-02 23:24:05 +02:00
Vadim Zeitlin
e4333fdeac Fix recurrent typo in "usable"
This word has a single "e".
2020-09-02 20:49:39 +02:00
Vadim Zeitlin
bf71a70a12 Merge branch 'updateui-ischeckable'
Add a flag to wxUpdateUIEvent to tell if the item supports the check
action.

See https://github.com/wxWidgets/wxWidgets/pull/2027
2020-09-02 19:34:05 +02:00
Vadim Zeitlin
1db3751235 Merge branch 'macos11-preferences' of https://github.com/vslavik/wxWidgets
Update wxPreferencesEditor to add support for macOS 11.

See https://github.com/wxWidgets/wxWidgets/pull/2040
2020-09-02 19:26:41 +02:00
Vadim Zeitlin
eb8c48a481 Merge branch 'macos11-fix-ui-fonts-handling' of https://github.com/vslavik/wxWidgets
Fix system UI font handling on macOS 11.

See https://github.com/wxWidgets/wxWidgets/pull/2034
2020-09-02 19:24:26 +02:00
Scott Talbert
be1854c617 Avoid UI functions in non-main thread in wxGStreamerMediaBackend
In aa2cd42206 (Report video size changes to the media backend,
2016-02-22), a couple of calls to NotifyMovieSizeChanged() were added,
presumably for a good reason.  Unfortunately, NotifySizeChanged() makes
UI calls on wxGTK, so this resulted in UI calls happening on a non-main
thread because many of GStreamer's callbacks occur on arbitrary threads.
This is bad because it caused random X11 crashes.

Fix this by calling NotifyMovieSizeChanged() with CallAfter().

Closes https://github.com/wxWidgets/wxWidgets/pull/2042
2020-09-02 19:22:46 +02:00
Paul Cornett
05a134d985 Build fix for GDK_WINDOWING_WAYLAND not defined
Add some missing GDK_WINDOWING_WAYLAND wrappers.
Also some minor changes to includes.
2020-09-01 08:14:58 -07:00
Scott Talbert
7cd12a2bd6 Add EGL-based backend for wxGLCanvas
Among other things, this enables wxGLCanvas to be used natively on
Wayland.

Closes https://github.com/wxWidgets/wxWidgets/pull/2038

Closes #17702.
2020-09-01 15:03:30 +02:00
Vadim Zeitlin
ed4b9e5f97 Merge branch 'mac-native-focus-ring' of https://github.com/vslavik/wxWidgets
Draw wxTextCtrl focus ring natively on Mac.

Add wxWindow::EnableVisibleFocus() to explicitly control the focus ring
visibility if necessary.

See https://github.com/wxWidgets/wxWidgets/pull/2037
2020-09-01 14:59:42 +02:00
Rob McKay
94e8129f3f Explicitly specify application class in wxiOS
Although @"UIApplication" is supposed to be used by default anyhow,
passing "nil" is reported to result in an assertion failure in
'_UIApplicationGetPrincipalClass' when running under the iOS 13.1
simulator, so pass this string explicitly.

Closes https://github.com/wxWidgets/wxWidgets/pull/2035
2020-09-01 14:57:29 +02:00
Vadim Zeitlin
b9f946fcd3 Merge branch 'check-headers-max-warn'
Check compilation of all wx headers with all gcc warnings enabled.

This should make it impossible to introduce problems that only appear
when -Wpedantic or -Wany-other-not-completely-unreasonable-warning is
enabled when building user code including wx headers again.

See https://github.com/wxWidgets/wxWidgets/pull/2033
2020-08-31 15:10:16 +02:00
Vadim Zeitlin
be2a61519b Merge branch 'grid-selected'
Split the wxGrid RANGE_SELECT event into separate SELECTING and SELECTED
events.

See https://github.com/wxWidgets/wxWidgets/pull/2028
2020-08-31 14:55:56 +02:00
Vadim Zeitlin
d41539ef05 Merge branch 'fix-grid-resizing'
Fix bugs in wxGrid mouse handling and simplify the code.

See https://github.com/wxWidgets/wxWidgets/pull/2018
2020-08-31 14:53:37 +02:00
Vadim Zeitlin
82f7cb6e9b Merge branch 'art-ids-literals'
Revert art ids changes and make them `char*` literals again.

See https://github.com/wxWidgets/wxWidgets/pull/2031
2020-08-31 14:51:52 +02:00
Václav Slavík
8efc6fb003 Add wxWindow::WXAdjustFontToOwnPPI()
Avoid calling GeTDPI() in font.WXAdjustToPPI(GetDPI()); invocations in
common code on platforms that don't need any adjustment (i.e. anything
other than MSW).

This fixes wxOSX crashes when GetFont() is called too early during
window creation, but is the right thing to do regardless.

Closes https://github.com/wxWidgets/wxWidgets/pull/2036

Closes #18903.
2020-08-31 14:45:02 +02:00
Václav Slavík
9c5abea266 Don’t add non-default focus ring to NSTextView
NSTextView does not natively show a focus ring by default, and it is
extremely rare thing to do in native applications.

Don't do it in wxTextCtrl either.
2020-08-31 10:38:59 +02:00
Václav Slavík
9f66b03c5c Allow configuring visible focus on Mac
Add wxWindow::EnableVisibleFocus() for changing focus ring behavior on
macOS (currently not implemented elsewhere, although GTK+ has a
discouraged option to do it).
2020-08-31 10:38:59 +02:00
Vadim Zeitlin
7352a2879c Rename Qt-specific GetEventType() to start with "Qt" prefix
This avoids conflicts with another method with the same name defined in
generic wxGenericFileDirButton, which must neither override nor hide
this method of wxButton.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
9f63592eba Remove unnecessary wxBitmap copy ctor from wxQt
This ctor is not needed as the inherited wxObject ctor is sufficient and
defining it but not operator=() explicitly results in -Wdeprecated-copy
from gcc 10.
2020-08-31 01:25:45 +02:00
Václav Slavík
58c94d9ec0 Draw wxTextCtrl focus ring natively on Mac
NSTextView doesn't display focus ring by default, which is why wxOSX
did draw it manually, but this behavior can be overriden since OS X
10.3 with NSView.focusRingType property.

The HITheme-based rendering suffered from a number of non-nativeness
issues:
- didn't respect macOS 10.14+ accent colors
- not animated as the native focus ring
- subtly different shape of the outline
- noticeably different outline shape on macOS 11

Remove NeedsFocusRect() and associated workaround for manually drawing
focus ring inside NSTextView (i.e. multiline text controls). This
private interface was only used for wxTextCtrl and nothing else, so
this shouldn't have any impact elsewhere.
2020-08-30 18:32:07 +02:00
Václav Slavík
587190c95c Size preferences pages correctly on macOS 11
Preferences windows traditionally changed their size on macOS when going
between tabs (pages): the window would resize, with animation, to fit the
current tab’s content and avoid wasted space. This worked well, because the
icons toolbar was left-aligned and so changing window size by growing/shrinking
it to the right or down felt natural.

This changes in macOS 11 where preferences toolbar icons are centered and would
shift around if the window resized horizontally. Indeed, the new standard is to
keep the width and only change window height when switching between pages.

Implement this behavior in wxPreferencesEditor too. This requires us to
instantiate all pages early (as is done on other platforms), so this on Big Sur
or newer only.
2020-08-29 19:53:33 +02:00
Václav Slavík
b6bc50d16e Use macOS 11 icons in wxStockPreferencesPage
Ase the appropriate SF Symbols for General and Advanced preferences pages on
macOS 11, while still using the old templates on older systems.
2020-08-27 19:11:07 +02:00
Václav Slavík
acf02be808 Support SF Symbols images on macOS 11
Extend wxOSXGetSystemImage() and thus wxArtProvider with support for directly
loading the new symbolic images in addition to existing support for named
bundle resources.

This enables usage such as wxArtProvider::GetBitmap("gearshape").
2020-08-27 19:11:07 +02:00
Václav Slavík
ab29743097 Use correct toolbar style for preferences on macOS 11
Code compiled against macOS 11 SDK must explicitly specify that the window
should use preferences-style toolbar, otherwise the tabs would be moved to the
right alongside window title, as is done with the standard toolbar now.
2020-08-27 19:11:07 +02:00
Václav Slavík
b03fa9c37f Fix UI font serialization on macOS 11
e86154fc is insufficient, because there's still one situation when
PostScript names can't be avoided: when storing them using
wxNativeFontInfo::ToString().

Co-authored-by: Stefan Csomor <csomor@advancedconcepts.ch>
2020-08-27 13:10:45 +02:00
Václav Slavík
9e68df224f Fix colored markup drawing in Mac wxDataViewCtrl
50ba73c accidentally omitted an if (colText) check, causing calls to
setTextColor:nil - which in turn caused markup text (but curiously, not
plain) rendering to stick with a previously set color even on cells
where the default color should be used.

Restoring the original logic to prevent setTextColor:nil fixes it.
2020-08-26 19:28:32 +02:00
Václav Slavík
e86154fcd2 Fix system UI font handling on macOS 11
PostScript name for the system SF font, starting with a dot, was always
considered private, but it was possible to round-trip it. Starting with
macOS 11, font descriptors can't be created from such names and result
in a Times font fallback.

To complicate matters further, the way PostScript name of the system
font is created changed too: it is no longer universal for entire
family, but specifies the weight too.

This combined together makes it impossible to store or modify system
fonts.

Fix by not relying on PostScript names internally. Only use them when
serializing font description or where needed, and in such cases obtain
it from CTFontDescriptor on demand.

Still preserve m_postScriptName as a user-provided detail, and treat it
as such: if provided, it is sacred and used to create font descriptors;
if not provided, never fill it in from other data.
2020-08-26 19:08:32 +02:00
Andreas Falkenhahn
a59901f8f1 Fix bug in CanUndo() returning true after wxTextCtrl creation
For wxMSW text controls with wxTE_RICH2 style, calling SetFont() counts
as an undoable operation, resulting in CanUndo() returning true even if
no "real" changes have been made yet.

Fix this by resetting the undo stack after creating the control using
ITextDocument::Undo().

Unfortunately this interface is not available in MinGW-32, so this fix
can't be used with it.

Closes https://github.com/wxWidgets/wxWidgets/pull/2010

Closes #17524.
2020-08-25 18:10:20 +02:00
Vadim Zeitlin
30b37b610d Revert "Merge branch 'string-art-ids'"
This reverts commit 8c9ba23eae, reversing
changes made to 5192feb38e.

Upcoming commits will try to work around the issues with art IDs related
to wxNO_IMPLICIT_WXSTRING_ENCODING in a different way.
2020-08-24 16:47:37 +02:00
Ilya Sinitsyn
0e8ca0c8f9 Fix the cursor mode switching in wxGrid mouse move event handler
Allow switching between row and column resizing modes in mouse move event
handler.
2020-08-24 02:09:01 +02:00
Ilya Sinitsyn
d6aec06150 Process the wxGrid mouse click depending on the current mode
Simplify the code of wxGrid::DoGridCellLeftDown() and make it more
correct by using m_cursorMode instead of duplicating (not 100%
correctly) the logic used to set it in DoGridMouseMoveEvent().

If the assumption that m_cursorMode is already set by the time
DoGridCellLeftDown() is called turns out to be wrong, e.g. when wxGrid
is used on touch screens, we would need to refactor these functions to
extract the code determining m_cursorMode from the mouse location into a
separate function that would be called from both.

Note that this commit is best viewed with "git diff -w" to see how little
has really changed.
2020-08-24 02:08:54 +02:00
Vadim Zeitlin
c1d3e65ac4 Merge branch 'wine-heap-fix'
Wine heap fix and other global memory-related cleanup.

See https://github.com/wxWidgets/wxWidgets/pull/2030
2020-08-24 00:18:57 +02:00
Vadim Zeitlin
3df9d772a4 Merge branch 'display-ppi-from-scaling-factor'
Determine display DPI from scaling factor instead of trying to compute
it from the physical display dimensions.

See https://github.com/wxWidgets/wxWidgets/pull/2015

Closes #18855.
2020-08-24 00:14:27 +02:00
Vadim Zeitlin
1bf76ee594 Add a safety check for the buffer size in wxIDataObject
Avoid size overflow if the offset value is greater than it.
2020-08-22 23:48:58 +02:00
Paul Cornett
3f9884817d Allow wxButton to show explicitly set bitmaps regardless of theme setting with GTK3
See #18874
2020-08-22 11:18:48 -07:00