Commit Graph

63519 Commits

Author SHA1 Message Date
Vadim Zeitlin
814a674531 Speed up the sample progress dialogs in the sample
Just make them finish faster, it's too boring to wait for them to do it
when testing when they take so long.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
0b96d3b905 Dispatch events from the native MSW wxProgressDialog too
Do this for compatibility with wxGenericProgressDialog, which always did
this and can't really do otherwise as it needs to react to the clicks on
its buttons, and also because not doing it results in the other
application windows being marked as "not responding" by MSW, which looks
bad.

Closes #17768.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
93c9ec2f01 Remove unnecessary check from DoNativeBeforeUpdate()
Don't test if we're using the native task dialog in this function
because it is only called if we are, so simplify the code by omitting
this check.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
046d3be215 Don't require calling DoNativeBeforeUpdate() with locked CS
Acquire the lock in wxProgressDialog::DoNativeBeforeUpdate() itself
instead of relying on the caller to do it.

This is just a refactoring in preparation for further changes.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
aac673391c Make state change in wxProgressDialog::Resume() more explicit
Reset the state to "Continue" instead of assigning it the dialogs own
m_state which was also set to "Continue" from the base class Resume()
called just before, but this wasn't necessarily obvious from just
reading the code.

No real changes.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
1206b7e0bd Return HRESULT, not BOOL, from TaskDialogCallbackProc
Although this doesn't change anything because, by a happy concourse of
circumstances, FALSE is the same as S_OK and TRUE is the same as S_FALSE
numerically, it is still better and more clear, because consistent with
the documentation, to return these constants from the task dialog
callback function rather than boolean ones.
2017-11-16 01:35:50 +01:00
Vadim Zeitlin
ed88275a88 Ensure we don't crash in wxProgressDialog::DoGetPosition()
Check that we do have the shared data before dereferencing the pointer
to it. While this normally will always be the case, it could be null if
some error happened, so add a check for it, just as we already do it
elsewhere.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
759c0461e1 Remove state assigning from wxProgressDialog::DoGetPosition() too
This was accidentally copy-and-pasted from another function in
1ef1f8fda6, just remove it as it was done
for the original check in the last commit but one.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
3f6e557f18 Tiny style fix in wxProgressDialog::GetHandle()
No real changes, just remove the trailing spaces and add post-#endif
comment for consistency.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
25d9faca17 Remove state assigning from wxProgressDialog::GetHandle()
This was added in 01bd848eb9 without any
explanation and probably was a copy-and-paste typo as it just doesn't
make any sense to change the state of the dialog in this accessor
function (and if the state doesn't change, then this assignment is just
completely useless).

Remove the apparently unnecessary assignment and also an unnecessary
temporary variable.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
3b4a71c4dc Allow testing wxGenericProgressDialog in the dialogs sample too
Add the possibility to test the generic implementation of the class when
we use the native one by default, this is useful to allow comparing the
behaviour of the two classes.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
8c5dae9491 Make wxGenericProgressDialog::Resume() virtual
It needs to be overridden in the native MSW wxProgressDialog
implementation, but was only hidden by the function with the same name
in the derived class, making it impossible to call the right function
via the base class pointer, for example.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
27110bfa72 Gracefully handle parent disappearance in wxGenericProgressDialog
Use a weak reference to the parent instead of a pointer to avoid
crashing if the parent TLW is destroyed before wxGenericProgressDialog
itself is. This is unlikely to happen in C++ code, where objects of this
class are typically created on the stack, but can happen in e.g.
wxPython where this is not the case.

Closes #16378.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
ec82ae1302 Document new wxProgressDialog auto-resizing behaviour
The dialog now grows automatically as needed and Fit() can be called to
shrink it back if desired and this behaviour is consistent under all
platforms.
2017-11-16 01:35:49 +01:00
Andrew Radke
4101849b4d Grow wxGenericProgressDialog automatically if needed
If the new message is longer than the previously shown one, increase the
dialog size to fit it, instead of truncating the message. Still don't do
anything if the new message is shorter to avoid unwanted constant
changes in the dialog size if the message keeps changing.

This is the original patch proposed in #10624, which it really makes
sense to apply now because it makes the generic version match the
behaviour of the native one under MSW (and the behaviour of the native
version cannot be changed).

See #10624.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
0473d14ef1 Make wxProgressDialog::Fit() work in native MSW version
This method is supposed to adjust the dialog size to its contents and
while the dialog increases automatically when using native
implementation under MSW, it doesn't shrink back on its own and so it's
still useful to allow Fit() to do it.

Update the sample to test Fit() too.
2017-11-16 01:35:49 +01:00
Vadim Zeitlin
0736bdfb28 Prevent constant size changes in native MSW wxProgressDialog
MSW implementation of wxProgressDialog adjusted the dialog size to the
size of the message shown in it on each update, resulting in visually
unpleasant constant jumping around (this is the same problem that we
used to have in wxGenericProgressDialog long time ago, see #10624).

Minimize this by using TDM_UPDATE_ELEMENT_TEXT instead of
TDM_SET_ELEMENT_TEXT for changing the element text. This still increases
the dialog size if the new element text is longer than the old value,
but at least doesn't shrink it back if it is shorter, which is already
quite an improvement.

Notice that this change requires using TDF_EXPAND_FOOTER_AREA style, as
otherwise the expanded information can't be updated without a re-layout.
But this doesn't seem to be a big loss and it's not really clear why did
we explicitly clear this flag before anyhow.

Update the dialogs sample to make it easy to test for this behaviour and
the documentation to mention MSW version peculiarities.
2017-11-16 01:35:48 +01:00
Vadim Zeitlin
6d2f903a48 Remove an apparently unnecessary line from MSW wxProgressDialog
It doesn't seem necessary to disable the use of common buttons, so don't
do it.
2017-11-16 01:35:48 +01:00
Paul Cornett
c1c9c2c5e5 Fix build with GTK+ 2.6 2017-11-15 10:52:21 -08:00
Paul Cornett
21620da3e5 Move GTK3 wxNO_BORDER handling to wxControl
So wxNO_BORDER works with other controls, such as wxBitmapButton.
Also use GTK prefix on ApplyCssStyle(), and add an overload that
creates the GtkCssProvider.
2017-11-15 10:51:38 -08:00
Vadim Zeitlin
ef0309c141 Fix wxTypeIdentifier::operator==() to be const
Comparing things doesn't change them.

Also rewrite operator!=() in terms of operator==() to ensure
consistency.
2017-11-14 15:58:17 +01:00
Vadim Zeitlin
a98c51e6bc Check for pangoft2 >= 1.38 in configure too
We need to use PKG_CHECK_MODULES(pangoft2) anyhow because we need to
link with its libraries, so make the version check there too and
simplify wxFont::AddPrivateFont() implementation in wxGTK.
2017-11-14 15:27:49 +01:00
Scott Talbert
0d62f728ae Avoid crashing when wxTaskBarIcon is used with a non-X11 display
Fixes #17779
2017-11-13 20:30:59 -08:00
Vadim Zeitlin
5463402e39 Try to show when do X errors happen while running tests
Install an X11 error handler to try to gather more information about the
GUI tests failures on buildbot.
2017-11-14 02:57:57 +01:00
Vadim Zeitlin
f5703673ad Skip focus event test when running under buildbot
This test seems to consistently fail, but the failure can't be
reproduced locally nor debugged on buildbot, so, lacking any other
solution, just disable it.
2017-11-14 02:41:58 +01:00
Vadim Zeitlin
f3b5cc32fa Fix recently introduced crash in ClippingBoxTestCase
Commit fc7f20c419 did fix a memory leak in
this test case, but at the price of introducing a crash due to deleting
the same pointer twice.

The real fix would be to change the code here to avoid returning a
pointer which sometimes needs to be deleted and sometimes must not, but
for now just add a crude check to avoid crashing.
2017-11-14 00:41:31 +01:00
Vadim Zeitlin
ad448da284 Suppress deprecation warnings for g_option_group_free()
Closes #17877.
2017-11-14 00:41:31 +01:00
Vadim Zeitlin
99367a1530 Update glib version check in GetStandardCmdLineOptions()
This code still works fine with glib 2.50.
2017-11-14 00:41:31 +01:00
Vadim Zeitlin
d3b033f432 Allow webview sample to build without wxSTC
There doesn't seem to be any special reason to use wxStyledTextControl
in this sample and doing it unconditionally breaks the build with
--disable-stc, so use wxTextCtrl instead in this case.

Closes #17998.
2017-11-14 00:09:08 +01:00
Vadim Zeitlin
f3995658ff Increase timeout for WindowTestCase::FocusEvent()
The default 100ms doesn't seem to be enough when this test runs under
buildbot.
2017-11-14 00:06:21 +01:00
Vadim Zeitlin
11a5728b32 Replace remaining std::auto_ptr<> with wxScopedPtr in the tests
This should have been done in b8c9cd3528
to avoid all warnings about std::auto_ptr<> being deprecated when using
g++ 6 or later which compiles in C++14 mode by default.
2017-11-14 00:06:18 +01:00
Vadim Zeitlin
283f5a4d56 Remove useless wxFont::ActivatePrivateFonts()
Just "activate" the font immediately when adding it using
AddPrivateFont(), nothing seems to be gained from having two functions
and it just makes things more complicated both when implementing and
when using the API.
2017-11-13 22:29:30 +01:00
Vadim Zeitlin
c9d1f9a719 Clean up FcConfig object on library shutdown
Don't just leak it as was done before.
2017-11-13 22:29:30 +01:00
Vadim Zeitlin
d99a255e98 Fix private fonts support in wxGTK
Use pango_fc_font_map_set_config() to associate the FcConfig containing
the private fonts with the global Pango context to make them available.

Also use FcInitLoadConfigAndFonts() instead of just FcConfigCreate() to
initialize the new config with all the default fonts instead of just
using our private fonts in it.
2017-11-13 22:29:30 +01:00
Vadim Zeitlin
3158a46ce7 Require fontconfig >= 2.8 and change its guard macro name
FcConfigAppFontAddFile() that we use is only available since 2.8, so
check for at least this version of the library in configure.

Also change the macro guarding its use to the more semantically
appropriate "wxHAVE" rather than "wxUSE" and make it more precise by
adding "2_8_0" suffix to it.
2017-11-13 22:29:30 +01:00
Vadim Zeitlin
ed655bfcde Add wxFontEnumerator::InvalidateCache()
This is necessary to recognize new fonts, for example those added using
AddPrivateFont(), as being valid: otherwise they were not found in the
cache and couldn't be used in wxGTK.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
5a13e4eda2 Clear wxFontEnumerator face names cache on library shutdown
Don't rely on it being done during statics cleanup as this doesn't work
if the library is shutdown and re-initialized.

Use a module to do the cleanup, just as it's already done for a lot of
other global data in wx.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
5c17c4b745 Set ATSApplicationFontsPath in Mac app bundle
This is required to allow loading private fonts from the bundle
Resources/Fonts subdirectory and doesn't seem to have any negative
consequences for the applications which don't need this functionality.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
5d134711a1 Add BUNDLE_FONT_RESOURCES and use it in font sample
Allow copying font files to the Fonts subdirectory of the app bundle,
private fonts can only be loaded from there under macOS currently.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
4f5f4af3b1 Compilation fixes for wxUSE_STL==1 build
Add an explicit call to wc_str() in one place where conversion to
wchar_t* is needed and use wxString::operator==() instead of lstrcmp()
to avoid having to perform this conversion explicitly in another place.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
ac4f99fa0d Test for FontConfig availability in configure when using wxGTK
This library is now needed in order to implement wxFont private font
methods.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
28864d3ef6 Clean up private fonts on library shut down under MSW
Ensure we don't keep the values in the global gs_privateFontFileNames
variable if the library is shutdown and reinitialized later, this would
be unexpected.
2017-11-13 22:29:29 +01:00
Vadim Zeitlin
149807db26 Move wxMSW wxFont private font methods to src/msw/font.cpp
This ensures that they will be defined and work even when building with
wxUSE_GRAPHICS_CONTEXT==0 (as can happen even by default with old MinGW
versions).

Private fonts are still made available to wxGraphicsContext as well by
providing access to them from GDI+ code via wxGetPrivateFontFileNames().
2017-11-13 22:29:28 +01:00
Vadim Zeitlin
4145a30e06 Report errors if using private font fails in the font sample
Give more information instead of just silently not showing the
corresponding menu item.
2017-11-13 22:29:28 +01:00
Vadim Zeitlin
a7a59a263d Update the version when private font support was added
It will be 3.1.1 and not 2.9.5 as originally planned.
2017-11-13 22:29:28 +01:00
Arthur Norman
547e40b114 Add support for loading fonts from files.
wxFont::AddPrivateFont() can now be used to load a font from a file for the
applications private use. Update the font sample to show this.

Closes #13568.
2017-11-13 22:29:28 +01:00
Vadim Zeitlin
91697a8724 Use correct commit of src/png submodule
Fixes wrong commit accidentally used in the previous commit.
2017-11-13 22:25:59 +01:00
Vadim Zeitlin
760bd1bf4e Update png submodule to avoid -Wundef warnings 2017-11-13 22:16:10 +01:00
Vadim Zeitlin
f65a608993 Remove declared but not implemented wxFont::Unshare() in wxGTK
No real changes, just remove a method which was never defined nor used.
2017-11-13 22:16:10 +01:00
Václav Slavík
926d486f54 Fix NSFont bridging crash with Asian input methods on 10.11
There's a bug in OS X 10.11 where a toll-free bridged font may have an
attributed of private class __NSCFCharacterSet that unlike
NSCharacterSet doesn't conform to NSSecureCoding. This poses a problem
when such font is used in user-editable content, because some Asian
input methods then crash in 10.11 when editing the string. As a
workaround for this bug, don't use toll-free bridging, but re-create
NSFont from the descriptor instead on buggy OS X versions.

Fixes regression introduced in a77066d530
(#507).
2017-11-13 18:46:37 +02:00