Commit Graph

63769 Commits

Author SHA1 Message Date
Vadim Zeitlin
1dd102d741 Fix crash when deleting all wxTreeListCtrl items with wxGTK3
GTK+ 3 (but not the generic version nor even GTK+ 2, apparently) sends
"selection changed" event from gtk_tree_model_row_deleted() when
deleting the currently selected row, which resulted in sending of
wxEVT_TREELIST_SELECTION_CHANGED events with invalid wxTreeListItem,
containing a dangling pointer, and a crash in the treelist sample when
trying to dump it.

Avoid this by clearing the model (and hence generating these events)
first and deleting the items only afterwards.

Also add a trivial unit test for wxTreeListCtrl::DeleteAllItems(), which
doesn't even allow to reproduce this bug, but is still probably better
to have than not to.

Closes #18045.
2018-01-17 10:44:28 +01:00
Vadim Zeitlin
321c9d5f30 Add another email address for John Roberts
See https://github.com/wxWidgets/wxWidgets/pull/676
2018-01-17 10:18:37 +01:00
John Roberts
4ad61f3048 Fix LAN detection in wxDialUpManager for macOS
Check for enX interface name for Darwin.

Closes https://github.com/wxWidgets/wxWidgets/pull/676
2018-01-17 10:15:30 +01:00
Vadim Zeitlin
91f54ea7e4 Remove a useless assert from wxDataViewTreeNode::GetChildNodes()
Checking that a pointer is non-null before dereferencing it is perfectly
useless: the code will crash anyhow, so assert doesn't help with
debugging it in debug builds nor with preventing the crash in release.
2018-01-17 10:15:11 +01:00
Vadim Zeitlin
ff3b3269dd Fix adding items to wxDataViewCtrl broken in the last commit
SetHasChildren(true) must be called before checking GetChildNodes() if
the parent hadn't had any items in the initial model.

Also remove the assert checking that the node is open in
BuildTreeHelper() as we may need to build even a closed tree branch.
2018-01-17 10:15:11 +01:00
Vadim Zeitlin
4dc78a33e0 Fix adding items to a never opened branch of generic wxDataViewCtrl
Calling ItemAdded() on a parent item that had never been opened yet
"lost" all its children that initially existed in the model, as the
corresponding subtree wasn't built any more in Expand() when this item
was finally opened because the list of item children wasn't empty any
more after ItemAdded() added the new child to it.

Fix this by simply not doing anything in ItemAdded() in this situation,
there is no need to update a closed tree branch immediately anyhow.
2018-01-17 00:15:50 +01:00
John Roberts
52e71680ea Fix grid sample OnGridRender()
Destroy current "frameRender" when creating a new render.

Make bitmap and frame size equal.

Closes https://github.com/wxWidgets/wxWidgets/pull/673
2018-01-15 13:24:18 +01:00
Vadim Zeitlin
ca5e944a67 Merge branch 'mac'
Assorted macOS fixes, see https://github.com/wxWidgets/wxWidgets/pull/625
2018-01-14 18:51:31 +01:00
Paul Kulchenko
c677e4e652 Fix crash on calltip click on macOS
Commit b0d0494f fixed it for autocomplete popup, but a similar issue is
still present for calltips. This commit fixes it.

Closes https://github.com/wxWidgets/wxWidgets/pull/595
2018-01-14 18:51:02 +01:00
sbrowne
d3f20c3837 Fix hang when reparenting a frozen window in wxOSX
The wrong order of changing parent and freezing/thawing could result in
hanging the application when reparenting frozen windows, e.g. when
switching order of pages in a notebook.

Closes #16722.
2018-01-14 18:51:02 +01:00
Vadim Zeitlin
0eb456f08e Revert "Fix wxTreeListCtrl under wxOSX"
This reverts commit 28f96bdff0 as it isn't
necessary any more after the fix in the previous commit.

See #17409.
2018-01-14 18:51:02 +01:00
Vadim Zeitlin
ad8d73cb15 Work around missing expanders in wxTreeListCtrl under Mac
Re-indent the column containing the expanders explicitly if the control
has just switched from "list" to "tree" mode.

Closes #17409.
2018-01-14 18:51:02 +01:00
Vadim Zeitlin
3380a2438d Fix scale factor confusion in wxMac wxBitmap implementation
Merge ctors from (width, height) and (width, height, scale) into a
single one because the former really should be just a special case of
the latter for scale == 1 but, surprisingly and confusingly it wasn't,
because the latter also multiplied the size by scale, meaning that width
and height parameters had different meanings.

This resulted in at least 3 bugs when using scale factors different from
1: first, copying bitmaps wasn't done correctly because as
wxBitmapRefData copy ctor incorrectly scaled its size by scale again.
And second, creating bitmap from wxImage whose size wasn't divisible by
scale not just didn't work correctly but crashed when accessing memory
outside of the image because (unnecessarily) dividing and multiplying
the image size by scale wasn't idempotent. Finally, even for the images
of even size (assuming scale factor of 2), bitmaps created from them
used incorrect width and height, corresponding to the half of the image
dimensions, instead of the same ones, as they're supposed to be (the
scaled dimensions are supposed to be returned by GetScale{Width,Height}
methods).

Closes #17505.
2018-01-14 18:51:02 +01:00
Vadim Zeitlin
5920c7edb1 Mention wxMessageQueue<> in the thread overview
This class should be used in almost all programs using detached threads.
2018-01-14 18:34:51 +01:00
Vadim Zeitlin
673ea07284 Document that window must be created in ShowScrollbars()
Calling it before creating the window actually works under MSW, but not
under the other platforms.
2018-01-14 18:31:29 +01:00
Vadim Zeitlin
27c399adbe Remove wxALWAYS_SHOW_SB-related code from wxScrolled
There is no need to handle this style specially here, it's supposed to
be handled at wxWindow level and is, indeed, at least in all the major
ports.

So revert 2119b213e3 (see #13616) and the
workaround for it applied later for macOS (see #14856). And this also
removes the need for handling wx[HV]SCROLL in wxScrolled (see #17846).

Closes #14856, #17846.
2018-01-14 18:27:10 +01:00
Vadim Zeitlin
a6c1899092 Merge branch 'msw-wakeup-no-msg'
Restore using event objects, instead of posting WM_NULL messages, for
idle wakeup under MSW.
2018-01-14 13:38:04 +01:00
Vadim Zeitlin
bd6694761d Merge branch 'cygwin64'
Several compilation fixes due to the fact that sizeof(long)==8 under
Cygwin in 64 bits.

This allows the library to compile, but there are still run-time
problems, notably the unit tests throw an unknown exception currently.
2018-01-14 13:34:57 +01:00
Vadim Zeitlin
ae4dd59719 Merge branch 'cmake-fixes' of https://github.com/MaartenBent/wxWidgets
Miscellaneous improvements to CMake build system.

See https://github.com/wxWidgets/wxWidgets/pull/666
2018-01-14 03:10:13 +01:00
Vadim Zeitlin
9df5541c53 Don't show dialogs from OnExceptionInMainLoop() in the tests
Similarly to the previous commit, ensure that the tests can run
unattended under MSW even if an unhandled exception is thrown during
their execution.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
277937b0c4 Always use stderr for wxMessageOutputBest in the tests
Avoid showing message boxes even if we don't have the associated console
as this prevents the test from completing on its own if an unknown
exception happens.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
d55d5b1dd7 Use LONG for OLE IAccessible methods parameters
This is another fix for 64 bit Cygwin build: LONG is defined as a 32 bit
type in it, but not long, which is 64 bits, so use the former instead of
the latter.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
ebb06fbeaf Use wxTimeVal_t instead of timeval to fix 64 bit Cygwin problems
Due to the same problem with sizeof(long) mismatch as in the previous
commit, we can't use struct timeval, with its long fields, in 64 bit
Cygwin builds, and need to use __ms_timeval instead.

Add wxTimeVal_t type to hide this difference and update all code
compiled under MSW (there is no need to uglify Unix-only code using
timeval, as in wxSelectDispatcher, for example) to use it instead of
timeval.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
1261139bcb Fix wxSocket code compilation with Cygwin in 64 bits
Use __ms_u_long instead of just u_long with Cygwin to avoid mismatch
between (64 bit) Cygwin long and (still 32 bit, even in 64 bit build)
Windows API long.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
a5ae0685a0 Fix wxFSVolume compilation with Cygwin in 64 bits
Use __LONG32, which is always 32 bits when using Cygwin, unlike long,
which is 64 bits there in 64 bit builds, and so can't be used as an
argument to InterlockedExchange().

Closes #16746.
2018-01-14 02:25:51 +01:00
Vadim Zeitlin
d1e57312c2 Revert "Don't call wxWakeUpIdle() with a lock in wxProgressDialog"
This reverts commit d26758044c which was a
workaround for the problem of wxWakeUpIdle() dispatching events, as this
is not the case any more after the latest changes.
2018-01-13 17:41:16 +01:00
Vadim Zeitlin
d617834eb9 Don't make wxEventLoop::WakeUpIdle() virtual
It just forwards to (virtual) WakeUp() and there should be no need to
ever override this method itself (nor even to keep it, except for
backwards compatibility).

No real changes.
2018-01-13 17:40:53 +01:00
Vadim Zeitlin
9b4759d7b6 Don't rely on getting WM_NULL messages in wxIdleWakeUpModule
Since the switch to using an event object for idle handling wakeup,
WM_NULLs are not being sent any longer, so wxIdleWakeUpModule didn't do
anything, resulting in pending event dispatching being paused while our
event loop was not running, as it happened, for example, while the
window was resized.

See #17579.
2018-01-13 17:33:09 +01:00
Vadim Zeitlin
91aed00288 Revert "Revert using an event object for waking up event loop in wxMSW"
This reverts commit ebb3a791b9,
effectively reapplying 6c40531fb7 once
again.

This breaks wake up when not running our own event loop once again
(see #17579), but this will be fixed in the next commit.
2018-01-13 15:23:30 +01:00
Vadim Zeitlin
d26758044c Don't call wxWakeUpIdle() with a lock in wxProgressDialog
This can result in deadlocks because wxWakeUpIdle(), admittedly rather
unexpectedly, can result in dispatching a message in the main thread,
which could reacquire the same lock again.
2018-01-12 17:17:53 +01:00
Maarten Bent
47fb2b6122 CMake: Update cotire to 1.7.10 2018-01-11 22:09:52 +01:00
Maarten Bent
f166d3b9c0 CMake: Don't use external project for wxexpat
This simplifies things a lot. And it is also not used for png, tiff and zlib.
2018-01-11 22:09:51 +01:00
Maarten Bent
21615b1634 CMake: Set Visual Studio working directory
Use the executable output directory for samples and demos, use the source directory for tests.
2018-01-11 22:09:43 +01:00
Maarten Bent
db86112675 CMake: Disable crt and socket warnings from Windows headers 2018-01-11 22:09:38 +01:00
Maarten Bent
573e887a4c CMake: Fix building and running samples
Add missing header, source and resource files.
Add missing data files (font), remove deleted data files (help).
Fix specifying xrc sample data files.
Remove WXUSINGDLL check from dialogs sample, it is not defined in e.g. static gui build.
2018-01-11 22:09:37 +01:00
Maarten Bent
4d35e8e54d CMake: Copy demo and sample data files to correct directory
Instead of 'lib/', copy it to directory where the executables are (e.g. 'lib/vc_x64_lib/').
2018-01-11 22:09:28 +01:00
Vadim Zeitlin
6bd8cb964b Really remove removed files from the help sample
This does what 1c2e58cd85 tried to do
manually correctly, by updating bakefile and rebaking, and so finally
completing the changes of 961a1c2b39.

See #17962.
2018-01-10 23:44:08 +01:00
Vadim Zeitlin
f0d946a38d Merge branch 'xrc-spinctrldouble'
Add XRC handler for wxSpinCtrlDouble.

Closes https://github.com/wxWidgets/wxWidgets/pull/665
2018-01-10 17:45:08 +01:00
Vadim Zeitlin
c3c8a2198d Document the recently added wxSpinCtrlDouble XRC handler
Update XRC reference documentation after adding a new handler too.
2018-01-10 17:44:42 +01:00
Vadim Zeitlin
74cf8370ce Avoid code duplication between wxSpinCtrl XRC handlers
Extract styles initialization into a function reused by both
wxSpinCtrlXmlHandler and wxSpinCtrlDoubleXmlHandler.

No real changes, this is a pure refactoring.
2018-01-10 17:44:37 +01:00
Trylz
80f4c8cde3 Add XRC handler for wxSpinCtrlDouble
Create wxSpinCtrlDoubleXmlHandler class similar to the existing
wxSpinCtrlXmlHandler and update the XRC schema to account for it.
2018-01-10 17:44:32 +01:00
Vadim Zeitlin
e2a31ef3db Merge branch 'grid-clip'
See https://github.com/wxWidgets/wxWidgets/pull/648
2018-01-10 17:19:03 +01:00
Vadim Zeitlin
6ec4489189 Merge branch 'upmake-cmake'
Generate CMake files list from upmake.

See https://github.com/wxWidgets/wxWidgets/pull/663
2018-01-08 17:33:57 +01:00
Vadim Zeitlin
5def115f28 Extract common type definitions from wx/defs.h to wx/types.h
Fix the problem with compiling user code including wx/debug.h as the
first wxWidgets header under MSW. This ought to work, but didn't,
because wx/debug.h included wx/chartype.h without including wx/defs.h
(because there is already an inclusion in the other direction), which
defines SIZEOF_WCHAR_T required by wx/chartype.h, first.

Notice that we repurpose the existing but completely unused (no mentions
of it or the symbols defined in it anywhere neither in wxWidgets nor in
any of the code search engines) wx/types.h header as it has a fitting
name and this avoids having to add a new header and remove the existing
one.
2018-01-07 22:43:24 +01:00
Vadim Zeitlin
267067aa8a Regenerate CMake files list from upmake too
Replace the specialized Python script used for it before (and which was
actually forgotten to run a couple of times already) with a newer
version of upmake, which can now update CMake variable definitions too.
2018-01-07 22:29:42 +01:00
Vadim Zeitlin
b2a8c2188f Remove duplicate wx/scrolbar.h from CMake files list
This will avoid warnings when regenerating it the next time.
2018-01-07 19:19:29 +01:00
Vadim Zeitlin
d7fbf1f820 Output the message about bakefile_gen by default in upmake
This message shouldn't be given only when --verbose is given, it's
useful as a reminder and you shouldn't have to remember to give a
special option to get this reminder.
2018-01-07 18:43:01 +01:00
Vadim Zeitlin
9a75103d9a Fix upmake bug with conditions in bakefile files
Don't strip the <if> tags from bakefile variables (this bug fix is
actually in Makefile::Update Perl module, but is incorporated here by
reference) and remove these tags which somehow made it into upmake input
file, as they make no sense there.

Note also that upmake was recreated using a different version of fatpack
(0.010007), which accounts for many other differences in this file.
2018-01-07 18:36:58 +01:00
Vadim Zeitlin
c1e097cc68 Update CMake files list
Regenerate the file that was forgotten before by the changes of
48a5d6c5f8 (see #18038) and
95b28abfdf (see
https://github.com/wxWidgets/wxWidgets/pull/541).
2018-01-07 17:03:46 +01:00
Vadim Zeitlin
a6d677a0fe Check for correct window in wxNumValidatorBase::SetWindow()
Override SetWindow() to check that the validator is being associated
with the window of the correct type, this allows to trigger an assert
immediately if this is not the case, making it simpler to find the error
as the call to SetValitator() on the wrong window will be in the call
stack when this happens, unlike before when the assert would happen only
at some later time.
2018-01-07 01:26:53 +01:00