Consistently handle DST start time in wxDateTime::Set().
Always move the dates invalid due to DST (i.e. falling into the "missing" hour
on the DST start date) forward, as GNU libc does, even when using a different
CRT implementation, such as MSVC one which moves the invalid dates backwards.
This seems more expected and also fixes an especially bad problem which
happened due to moving the date backwards in Brazilian time zone where DST
starts at midnight as doing this changed the day and totally broke ParseDate()
assumption that setting wxDateTime to 00:00:00 at the given date really did
set it to this date.
Add a convenience ShowWindowModalThenDo() variant of ShowWindowModal()
that takes a functor argument and calls it when the dialog is closed.
This is, of course, particularly useful when the argument is a C++11
lambda, especially when having more than one window-modal dialog invoked
from the same window, which can get messy quickly with all the
wxEVT_WINDOW_MODAL_DIALOG_CLOSED handlers.
Václav Slavík [Fri, 6 Sep 2013 17:09:05 +0000 (17:09 +0000)]
Add wxCondition::Wait() overload that also tests the condition.
Add Wait() overload that takes a functor argument and doesn't return
until the condition is signaled _and_ the predicate returns true. This
is useful for dealing with spurious wakeups and is modeled after C++11
std::condition_variable's corresponding method.
Fix bug with not selecting wxAuiNotebook page when its child was focused.
The code in OnChildFocusNotebook() handler only worked correctly if the page
itself was focused but not if the focus was given to one of its children --
which should still make the page itself current.
Revert wxDO_LOG_IF_ENABLED() change for MSVC6 in r74735.
The old solution worked fine for that compiler and the new one fails when
wxLogXXX() is used inside a switch statement to the wrong rules used by VC6
for the scope of the variables defined inside the for loop.
Simply revert back to using the old version for it, this will be easy to
re-revert after 3.0 by simply removing the check for it.
Restore correct wx-config creation and work around MinGW lack of symlinks.
This undoes the changes of r72205 and r72249 (see #14517) as using relative
paths for wx-config symlink didn't work correctly if non-default values for
$bindir and/or $libdir were used (i.e. if they were not siblings).
Instead, fix the original problem of lack of symlinks when using MinGW
directly: just use "cp -p" if "ln -s" fails. This should work everywhere and
do the right thing.
Correct erasing of background behind controls in a toolbar in wxMSW.
We need to handle WM_PRINTCLIENT in wxToolBar itself as the default handler
for this message forwards to WM_ERASEBKGND of the parent window and our
handler for that message only erases the client part of the window, in wx
sense, i.e. including a relatively big vertical offset accounting for the
toolbar. This means that when we get WM_PRINTCLIENT from the embedded control
drawing code, we don't erase anything at all as the control rectangle height
is smaller than the offset.
This fix is not perfect as ideally the existing MSWGetBgBrushForChild() should
be taken into account automatically by the default MSWPrintChild()
implementation but at least it fixes the ugly visual artefacts.
Add a test for a tooltip for a control inside a static box.
Also create the controls as children of the static box, not its siblings, to
make the tooltip work under wxGTK and because this is how we recommend doing
things now.
Add wxDEPRECATED_MSG() and use it in a couple of places.
This macro should be used instead of wxDEPRECATED() for the new deprecations
as it allows to give a helpful explanatory message (if supported by the
compiler) and also is simpler to use as it doesn't require wrapping the entire
declaration in it but can be simply used before it.
Also add wxDEPRECATED() support for clang as a side effect.
Remove superfluous mouse capturing in wxGrid row/column labels windows.
This code recaptured the mouse in the window which had already had it, thus
triggering the (recently added, see r74677) asserts in CaptureMouse(). It also
didn't preserve the invariant of m_winCapture always having the capture. And
it was apparently completely unnecessary too.
So simply remove it to fix the asserts while drag-resizing wxGrid rows/columns.
The code there was pretty wild, making clearly wrong assumptions (column size
doesn't, and AFAICS never did, include 20 pixel margin) and also was clearly
uncertain about what it was doing by trying to limit the number of iterations
to some arbitrary cutoff when it is pretty clear that the loop increasing the
width and decreasing the height on each iteration will reach the condition of
"width >= height*1.68" sooner or later.
Paul Cornett [Tue, 3 Sep 2013 05:37:30 +0000 (05:37 +0000)]
Fix referencing of cairo_t returned from wxDCImpl::GetCairoContext().
It was assumed that all callers were going to unref the cairo_t, but that is not
true, so callers that are going to unref it should ref it themselves.
See #15455
Vadim Zeitlin [Sat, 31 Aug 2013 17:41:16 +0000 (17:41 +0000)]
Rewrite wxLogXXX() macros to avoid "ambiguous else" warnings.
Use a dummy for loop instead of an if statement to avoid all problems with the
dangling else clauses: both the need for an artificially inversed "if" to make
the code like
if ( something )
wxLogError("...");
else
something-else;
to work as expected and to avoid warnings given by some versions of g++ and
clang for the code above advising to add explicit braces.
Vadim Zeitlin [Sat, 31 Aug 2013 17:41:13 +0000 (17:41 +0000)]
Removed a method using wxColour from non-GUI benchmark code.
No idea how could this work before but the presence of this code in the
non-GUI benchmark project prevented it from building. As it's not used anyhow,
just remove it.
Paul Cornett [Sat, 31 Aug 2013 03:25:12 +0000 (03:25 +0000)]
Don't update position of widgets in a wxPizza from size_allocate handler.
The values in m_{x,y} are not the same as client coordinates if the wxPizza is scrolled.
Closes #15444
Vadim Zeitlin [Fri, 30 Aug 2013 23:32:42 +0000 (23:32 +0000)]
Fix infinite loop in wxMSW with wxStaticBox inside non-wxTAB_TRAVERSAL parent.
We didn't ensure that the parent of a (native) control with WS_EX_CONTROLPARENT
had this style as well, unlike for our own windows. Fix this now to make
certain that we never call ::IsDialogMessage() on a window whose parent
doesn't have WS_EX_CONTROLPARENT as it simply hangs in this case, entering an
infinite loop searching for the default button.
Also try to reduce the possibility of such bugs in the future by checking for
WS_EX_CONTROLPARENT and not wxTAB_TRAVERSAL before calling ::IsDialogMessage()
even if this doesn't totally prevent them (it wasn't sufficient to fix even
this particular bug).
Václav Slavík [Fri, 30 Aug 2013 13:14:50 +0000 (13:14 +0000)]
Loosen the assert in IsScrollIncrement().
wxWindowGTK::GTKGetScrollEventType() tries to map GtkAdjustment's delta
to either step or page increment by comparing it with the respective
GtkAdjustment steps. Both of them can be 0, but this code is not
expected to be called in such case.
Yet, in practice, it occasionally is, see e.g.
http://devel.aegisub.org/ticket/979GTKGetScrollEventType (wxWebView is
prone to it as well).
Check for >= 0 instead, to be more robust when faced with unexpected
input from GTK+.
Vadim Zeitlin [Thu, 29 Aug 2013 12:33:44 +0000 (12:33 +0000)]
Don't define __STRICT_ANSI__, we should build both with and without it.
For some reason, wxDialUpManager code defined __STRICT_ANSI__ itself, don't do
it as __STRICT_ANSI__ can be predefined by the compiler resulting in the
redefinition warnings and, in any case, our code should build both with and
without it.
Vadim Zeitlin [Tue, 27 Aug 2013 22:49:53 +0000 (22:49 +0000)]
Don't enable dialog navigation inside wxFrame by default.
This was done, apparently accidentally, by r68366 and resulted in cursor arrow
keys not being sent by default to the wxFrame children under MSW any more as
they were used for dialog navigation instead.
So don't derive wxTopLevelWindow from wxNavigationEnabled<> any more and only
derive from it at wxDialog level.
Vadim Zeitlin [Tue, 27 Aug 2013 22:49:44 +0000 (22:49 +0000)]
Handle custom configurations in MSVC-specific setup.h.
Account for wxCFG when building the paths used for MSVC autolinking. This
variable should be defined to the same value as CFG during (command line)
build.
Vadim Zeitlin [Tue, 27 Aug 2013 22:49:23 +0000 (22:49 +0000)]
Don't use any icon for items inserted without one in wxMSW wxListCtrl.
Previously we erroneously used the first icon in the image list for them
instead. This was inconsistent with wxGTK and didn't make much sense, even if
it is the default behaviour of the native control, so don't do this any more
and explicitly specify I_IMAGENONE for the icon if it wasn't given.
Vadim Zeitlin [Sat, 24 Aug 2013 14:33:22 +0000 (14:33 +0000)]
Move code removing "-psn_xxx" command line arguments to common code.
We need to do this when using any port under OS X, not just wxOSX, e.g. the
-psn_xxx arguments passed by the Finder when launching the application, must
also be ignored when using wxGTK.
Vadim Zeitlin [Fri, 23 Aug 2013 16:37:09 +0000 (16:37 +0000)]
Fix wxHtmlHelpData::SetTempDir() to behave correctly without trailing slash.
The path passed to this function is always a directory, so use
wxFileName::AssignDir() instead of the default constructor of wxFileName which
considers the name to be a name of a file unless it ends with a path separator.
Paul Cornett [Mon, 19 Aug 2013 17:25:56 +0000 (17:25 +0000)]
Remove DoSetSizeHints() call from Create()
The reason it was added does not seem to be reproducible anymore,
and it interferes with wxRESIZE_BORDER on Ubuntu.
Closes #14870
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:28 +0000 (13:28 +0000)]
Only give capture to wxPopupTransientWindow child if it's the only one.
This removes the arbitrariness of using the first child which didn't make any
sense when the popup had several controls inside it, e.g. in wxRichToolTip
case this resulted in the mouse capture being given to wxStaticBitmap showing
the tooltip icon even though it didn't need it at all.
This probably doesn't really change the observable behaviour but seems more
logical.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:23 +0000 (13:28 +0000)]
Use wxFindWindowAtPoint() for hit testing in wxPopupTransientWindow.
This works even with irregularly shaped windows such as wxRichToolTip unlike
the old naive test using wxRect::Contains() which didn't and resulted in us
believing that the mouse was outside the window when it was still in it and
(somehow, the details are not totally clear) recapturing the mouse again and
again in the same window which resulted in assert failures with the new checks
in wxWindowBase::CaptureMouse() or the capture stack corruption before this.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:19 +0000 (13:28 +0000)]
Return NULL from wxWindow::GetCapture() when the capture is being lost.
Make GetCapture() return NULL during wxEVT_MOUSE_CAPTURE_{LOST,CHANGED} events
processing in wxMSW to help their handlers to avoid calling ReleaseCapture():
this shouldn't be done as the mouse capture is being lost anyhow and results
in reentrancy problems between NotifyCaptureLost() and ReleaseCapture() if
it's called.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:16 +0000 (13:28 +0000)]
Make mouse capture checking asserts stronger and more detailed.
Verify not only that we don't destroy the window having the capture now but
also that this window is not in the mouse capture stack at all, not
necessarily on top. This is important as keeping a dangling pointer in the
capture stack would result in difficult to diagnose bugs later.
Also check that we don't recapture the mouse in the same window as this should
never be necessary.
Finally, give more details in the assert checking that the window does have
capture in ReleaseMouse().
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:13 +0000 (13:28 +0000)]
Don't set even try to set focus to wxPopupWindow itself in wxMSW.
This doesn't work anyhow with our popup window implementation (it's a child of
the desktop and we can't set focus to it) and provokes error messages due to
::SetFocus() failures, so simply don't do this at all.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:06 +0000 (13:28 +0000)]
No changes, just use wxRecursionGuard instead of manual boolean flag.
Use wxRecursionGuard with the flag indicating whether the mouse capture is
changing to ensure that we always reset it correctly and make the code
slightly shorter.
Vadim Zeitlin [Sun, 18 Aug 2013 13:28:02 +0000 (13:28 +0000)]
No changes, just move mouse capturing bookkeeping data out of wxWindow.
All mouse capture-related data doesn't have to be declared in wxWindow itself
and can just be global in wincmn.cpp, so move it there, this will facilitate
further changes as they won't require recompiling everything any more.
Paul Cornett [Sat, 17 Aug 2013 16:25:13 +0000 (16:25 +0000)]
Avoid calling gtk_window_get_position() from "configure-event" handler, if possible.
This avoids a round trip to the X server, which is expensive over a remote connection.
Closes #15116
Vadim Zeitlin [Fri, 16 Aug 2013 11:04:39 +0000 (11:04 +0000)]
Replace wxFONTFAMILY_DEFAULT with wxFONTFAMILY_SWISS when comparing fonts.
Otherwise comparison always failed as no existing fonts had
wxFONTFAMILY_DEFAULT as their family in all ports except wxOSX, which does
keep wxFONTFAMILY_DEFAULT.
r72935 introduced code that created a temporary wxComboBox control to
take measurements. This is very expensive in MSW and adds noticeable
delay when creating more than a few controls.
Replace with equivalent wxMSW code that computes the height in the same
way other wxMSW controls do.
The wxGTK version cannot be eliminated in the same way, so at least add
some basic caching there. It's much less of a problem, because GTK+
controls creation is much cheaper than MSW one.