Commit Graph

63356 Commits

Author SHA1 Message Date
Artur Wieczorek
1033a1636d Process HDN_ITEMCHANGING notifications only when column is being resized
When column resizing is finished, after HDN_ENDTRACK notification there is
also sent one (and last) HDN_ITEMCHANGING notification. We have to skip it
to prevent from sending EVT_HEADER_RESIZING after EVT_HEADER_END_RESIZE
because EVT_HEADER_END_RESIZE should be really the last one event
in the sequence of resizing events (like it's assumed in wxGrid).

Closes #16390.
2017-11-20 21:57:05 +01:00
Vadim Zeitlin
8f9c4470d7 Merge branch 'arrays-alloc-optimise'
Reduce the number of memory allocations in wxArrayString and wxVector.
2017-11-19 23:13:43 +01:00
Vadim Zeitlin
7ba4832c0f Merge branch 'sound-async-unix'
Minor fixes to Unix wxSound implementation, including async API and OSS
backend tweaks.
2017-11-19 22:59:14 +01:00
Vadim Zeitlin
3590273503 Document that osspd requirement for using OSS under Linux
Without SDL, wxSound doesn't work out of the box on most (all?)
contemporary Linux systems, so at least document this.

See #14899.
2017-11-19 22:51:51 +01:00
Vadim Zeitlin
2558c91ae8 Don't fail to okay all mono WAVs in OSS wxSound backend
Ever since the changes of 544c4a3bde
(almost 14 years ago), playing mono WAVs with wxSound completely failed
if setting the sound device to mono using SNDCTL_DSP_STEREO ioctl
failed. This doesn't look like a wise thing to do, so don't consider
this as a fatal failure, but just play mono as stereo (and even possibly
stereo as mono) instead.

This fixes the sound sample being broken out of the box on many (all?)
Linux systems.
2017-11-19 22:44:57 +01:00
Vadim Zeitlin
d788588cfc Use wxMutexLocker instead of manual Lock/Unlock() calls
This is safer and also makes the code simpler and shorter.
2017-11-19 22:37:36 +01:00
Vadim Zeitlin
6c1a557a0f Lock and unlock mutex in both wxSound threads using it
The code was completely broken as it locked the mutex in only one thread
and then tried to unlock it in another one, which made no sense, didn't
protect against anything and resulted in errors and assert failures.

Fix this by locking and unlocking the mutex in both threads before
accessing shared data or playing sound.

Closes #17990.
2017-11-19 22:37:36 +01:00
Vadim Zeitlin
6ebc56939f Acquire mutex before modifying variable in wxSoundSyncOnlyAdaptor
The mutex must be locked to avoid data races with the thread actually
playing the sound.
2017-11-19 22:37:36 +01:00
Vadim Zeitlin
f7e5fb61b1 Remove unused wxSoundSyncOnlyAdaptor::m_playing variable
It seems to have been replaced by wxSoundPlaybackStatus::m_playing a
long time ago but was still kept, resulting in confusion and always
returning false from IsPlaying() as it tested a wrong variable.

Fix this by removing this one completely and always using the other one
everywhere.
2017-11-19 22:37:36 +01:00
Vadim Zeitlin
abce2a9428 Use the same growth strategy in wxArrayString as in wxVector
Remove maximal reallocation size in wxArrayString too, as it was done
for wxVector a commit ago, and increase its size by 100% and not 50%
when it needs to grow.

There is no real reason to use different growth strategies in the two
classes and wxVector one seems to be better.
2017-11-19 22:02:26 +01:00
Vadim Zeitlin
d3132b114c Optimize memory allocation in wxArrayString ctors
Call assign() instead of Add() in a loop: this is not only shorter, but
also ensures that reserve() is called before starting the loop and all
the required memory is allocated at once.
2017-11-19 21:59:02 +01:00
Vadim Zeitlin
876090aeea Remove maximal reallocation size in wxVector
This dramatically pessimizes performance for large vector sizes and
doesn't actually save that much memory because all intermediate
allocations are still being used by the process, so follow stdlibc++
example and just double the allocated buffer size without limit.
2017-11-19 21:56:24 +01:00
Vadim Zeitlin
aef4edb969 Merge branch 'progress-dialog-fixes'
Make native MSW wxProgressDialog much more usable and some minor
improvements to the generic version.
2017-11-17 18:00:16 +01:00
Vadim Zeitlin
ca0557a6eb Merge branch 'release-scripts' 2017-11-17 17:56:41 +01:00
Vadim Zeitlin
dc751d3f33 Add a hint about making wxProgressDialog initially wide enough
Using unbreakable spaces to achieve this looks like a hack, but seems to
be the only thing working well in practice.
2017-11-16 23:52:36 +01:00
Vadim Zeitlin
d4d3222466 Split initial wxProgressDialog message consistently with updates
Native wxMSW dialog split the provided message into the title and body
in Update(), but didn't do it for the initial message specified when
constructing the dialog, resulting in weird jumps, due to the font size
change between the body and title dialog elements, if the updated
message differed just slightly from the initial one.

Fix this and refactor the code to reuse the same function for doing this
splitting in both places.
2017-11-16 23:52:33 +01:00
Vadim Zeitlin
602e2e6abb Avoid fitting wxProgressDialog to its contents on first update
Use TDM_UPDATE_ELEMENT_TEXT even for the initial update as this allows
to specify the message of roughly comparable (or greater) length than
the messages that will be subsequently used while the dialog is shown
and avoid size changes later, which is much more natural than having to
do it for the first call to Update().
2017-11-16 23:52:30 +01:00
Vadim Zeitlin
83b9fa3119 Get rid of unnecessary wxCriticalSectionLocker use
No real changes, just don't lock a critical section for a short time
only to lock it again almost immediately after unlocking -- just combine
both blocks for which it is locked into one, there is no reason to
release it for TASKDIALOGCONFIG and wxMSWTaskDialogConfig initialization
which are both trivial operations not involving any callbacks.
2017-11-16 23:52:27 +01:00
Vadim Zeitlin
3d98129b51 Further improve wxProgressDialog resizing behaviour documentation
Unfortunately it doesn't seem possible to prevent the native MSW dialog
from changing its size in both upper and lower direction vertically, so
at least mention this in the documentation and mention a possible
workaround of manually adjusting the text to always have the same number
of lines.
2017-11-16 23:52:25 +01:00
Arrigo Marchiori
23b7973c24 Mention possible problem with wxProgressDialog created in OnInit()
Such dialogs must be destroyed before the main event loop starts running
to avoid problems with the temporary event loop created by the dialog
internally.

See #17983.
2017-11-16 23:52:22 +01:00
Vadim Zeitlin
a4530c3c73 Exclude unnecessary files in the submodules from release archives
Cut down on release archives size, somewhat, by excluding third party
libraries that we're never going to use.

The exception is libtiff which references all its files in its configure
that we do run and it's probably not worth to bother with paring it down
if this means maintaining changes to configure.
2017-11-16 23:37:36 +01:00
Vadim Zeitlin
34e6c7cccc Silence "make allmo" during release archives build
The commands used and their output are not important and there are many
of them, don't display them.
2017-11-16 23:37:24 +01:00
Vadim Zeitlin
7fd25de661 Update release script to include submodules in the archives
Use "git submodule foreach" to run "git archive" in all of the
submodules as well.

Also document the requirement to have GNU tar which is needed to be able
to successfully extract several concatenated tar archives.
2017-11-16 23:37:24 +01:00
Vadim Zeitlin
6471933857 Fix getting SHA-1 sums in the post-release script
sha1sum doesn't return just the SHA-1, unlike "git hash-object", so get
only the part of its output we need here.
2017-11-16 23:36:35 +01:00
Vadim Zeitlin
12957a3696 Add "Changes since 3.1.0" section to the README
Separate it from the "Changes since 3.0" version which combines both the
most important changes in this one and the changes from 3.1.0 itself.
2017-11-16 21:47:56 +01:00
Vadim Zeitlin
a80210f0d7 Allow running pre/post-release scripts from any directory
Don't assume they're run from the directory containing them, especially
as this is not how they are shown to be invoked in the release
instructions.

Now running ./build/tools/pre-release.sh works too.
2017-11-16 18:49:45 +01:00
Vadim Zeitlin
2fc4b76cf0 Use Bash for release scripts using non-POSIX features
A script using "declare -a" can't use /bin/sh as it's non-POSIX and not
supported by e.g. Dash which is /bin/sh on Debian systems.
2017-11-16 18:45:59 +01:00
Cătălin Răceanu
45c33d2a17 Add scripts for automating more parts of the release process
Update dates in various files before the release automatically.

Also automatically update SHA-1 of the release files both before the
release (to zero them) and afterwards (to use the correct values).

Closes https://github.com/wxWidgets/wxWidgets/pull/443
2017-11-16 18:45:17 +01:00
Vadim Zeitlin
9b65905c4b Exclude some files from release tar balls
Git-specific files don't make sense outside of Git repository and CI
files are not needed neither.
2017-11-16 18:44:27 +01:00
Vadim Zeitlin
80ca6661d4 Explain that wxProgressDialog should be created on the stack
Creating it on the heap is unnecessary and can be actually harmful, so
document explicitly that it shouldn't be done.

See #17983.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
3918c420b4 Check the active event loop in wxGenericProgressDialog dtor
Verify that the active loop didn't change during this object lifetime as
otherwise we could deactivate a different event loop from the one we
installed.

It's still a programming error to write code which doesn't destroy
wxGenericProgressDialog early enough, but at least now "just" assert and
leak memory in this case instead of resetting the active event loop and
hanging the program.

Closes #17983.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
5a3fd23a68 Remove a now redundant test in UpdateExpandedInformation()
Checking for m_progressBarMarquee is not necessary any longer, just
testing the value is enough.

Update the comments to explain why is it so.

No real changes.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
4ab676c967 Show elapsed/estimated times in wxMSW wxProgressDialog by default
This further improves the dialog usability when the main thread doesn't
update it frequently enough, as these times can be seen immediately
without having to expand the "details" part of the dialog which can be
very sluggish in this case.

It is also more consistent with the generic dialog and the behaviour of
the native dialog before 6b91c5dfab876f0f1b17d54304bfb2fda27398ef which
removed the code clearing TDF_EXPAND_FOOTER_AREA style.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
ed086ea044 Get rid of unnecessary variables in wxMSW wxProgressDialog
There doesn't seem to be any need to have both "foo" and "realFoo", just
reuse the existing variables instead.

No real changes.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
e49cde166f Improve progress bar updating in native wxMSW wxProgressDialog
Since the switch to tying the task dialog thread message queue with the
main thread, animating the progress bar didn't work well unless the
dialog was updated very frequently from the main thread and could lag
behind significantly, and confusingly for the user, otherwise.

Work around this by avoiding the progress bar animation and setting it
immediately to its real value. This works much better in practice.
2017-11-16 01:35:53 +01:00
Vadim Zeitlin
7481c74365 Make other wxGenericProgressDialog methods virtual too
Solve the same problem as was recently with hiding, instead of
overriding, Resume() in the native MSW wxProgressDialog class for all
the other methods which were also affected by it.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
cac3d39fa1 Don't explicitly attach progress dialog thread input
This is actually completely unnecessary because this is done implicitly
by Windows itself anyhow when we create the dialog with the owner window
belonging to a different thread.

Notice that this also explains why the thread input can't be detached
later.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
1c62ebdcd7 Minor optimizations in wxProgressDialog
Don't bother performing the updates if nothing was requested.

And ensure that nothing is requested even more often than it already was
by not requesting an update if the new value is the same as the old one.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
317470a39a Use "max" instead of 100 in the progress dialog sample code
No real changes, just don't hardcode 100 as we have a symbolic constant
for it here already.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
ca7e1d8bd1 Remove manual wxProgressDialog centering code
This is not necessary any longer now that we use the correct parent for
the dialog window, the task dialog is centered automatically.

And unlike our own code, comctl32.dll code always puts the dialog fully
on one monitor instead of making it span two of them if the parent
window does.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
2b8e84ca49 Avoid deadlock when closing the progress dialog
Don't call EndDialog() while inside the critical section, this could
(and did, sometimes) result in a deadlock if the main thread was trying
to enter it in order to send us wxSPDD_DESTROYED notification as
EndDialog() needs it to process some messages.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
d7ec02636a Avoid spurious assert when cancelling wxProgressDialog
If Cancel/close button was pressed twice in a row, assert checking that
the dialog state was "Continue" could be triggered, which was worse than
annoying as it resulted in a deadlock due to trying to show the assert
dialog box while holding the critical section that prevented the main
thread from continuing.

Allow the state to be either "Continue" or already be set to "Canceled"
now to account for this case.

Still assert for the other invalid states, but they really aren't
supposed to be possible here.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
dc5802746d Set wxProgressDialog::m_parent too
This, in addition to the previous commit, allows Centre() to work
correctly as it needs to retrieve the parent window rectangle.

See #17768.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
a8eccd21c7 Implement wxProgressDialog::DoGetSize() for the native dialog too
DoGetPosition() was done in 1ef1f8fda6,
implement DoGetSize() too now in order to give a chance Centre() (which
needs both position and size to work).

See #17768.
2017-11-16 01:35:52 +01:00
Vadim Zeitlin
ffe84cfb99 Factor out wxProgressDialog::GetTaskDialogRect()
No real changes, just prepare for implementing DoGetSize() in this class
by extracting the common part between the existing DoGetPosition() and
it in a new function.
2017-11-16 01:35:51 +01:00
Vadim Zeitlin
df2a0eb67e Stop using m_winPosition to pass position to the main thread
We can just ask for the window rectangle directly from the main thread,
there is no need to update the position in wxProgressDialogSharedData
all the time.
2017-11-16 01:35:51 +01:00
Vadim Zeitlin
d240c1f20f Just use wxGenericProgressDialog::m_parentTop directly
Remove another redundant line of code from wxGenericProgressDialog::
Create(), there is no need to call GetParentForModalDialog() again when
we just did it to initialize m_parentTop, just use the latter directly.
2017-11-16 01:35:51 +01:00
Vadim Zeitlin
58f90d36a0 Remove redundant wxGenericProgressDialog::m_parentTop assignment
The line setting m_parentTop directly was mistakenly left over even
after 7e08367534 added the call to
SetTopParent() just above it.

Remove it now (better late than never), it's redundant at best and even
wrong if the top level parent can't be used as the dialog parent because
SetTopParent() checks for this but this line did not.
2017-11-16 01:35:51 +01:00
Vadim Zeitlin
12efb20ad2 Disable close title bar button in wxProgressDialog too
When the "Cancel" button inside the dialog is disabled, disable the
close title bar button as well as it serves the same purpose.

In particular, this avoids asserts when clicking the close title bar
button while showing the confirmation message box asking the user
whether the dialog should be cancelled in the dialogs sample.
2017-11-16 01:35:51 +01:00
Vadim Zeitlin
fdfd8efa83 Factor out wxTopLevelWindow::MSWEnableCloseButton()
Make it possible to reuse this code for other, non-wx, windows.

No real changes, this is just a pure refactoring.
2017-11-16 01:35:51 +01:00