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.
Vadim Zeitlin [Tue, 13 Aug 2013 17:36:47 +0000 (17:36 +0000)]
Don't hide the window in its dtor in wxGTK.
This results in sending an unexpected wxShowEvent to an already half-destroyed
(because the derived class dtor had been already executed) by now object which
could provoke crashes. And it also seems to be completely unnecessary as the
window is going to be destroyed anyhow -- and the other ports don't hide it
before this happens (unless it's a TLW in which case it is already hidden in
wxTopLevelWindowBase::Destroy()).
Vadim Zeitlin [Fri, 9 Aug 2013 20:55:20 +0000 (20:55 +0000)]
Remove never implemented wxDateTime::IsGregorianDate().
This method was declared and even documented but never actually implemented,
and GregorianAdoption enum used by it had many incorrectly defined elements.
Just remove both the method and the enum instead of fixing/implementing them
as they are not that important (as witnessed by the fact that nobody has
complained about the method being missing since almost 15 years).
Václav Slavík [Wed, 7 Aug 2013 17:33:42 +0000 (17:33 +0000)]
Make wxOwnerDrawnComboBox::DoGetBestSize() twice as fast.
Don't call the very expensive wxComboCtrlBase::DoGetBestSize() method
when not needed - it calls wxComboCtrlBase::DoGetSizeFromTextSize(),
which is very expensive.
Also fix the code so that it doesn't apply GetSizeFromTextSize() twice
(once in the base class' DoGetBestSize(), once here).
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:38 +0000 (11:08 +0000)]
Document light grey colour handling in wxMSW wxBitmap::LoadFile().
For historical/compatibility reasons we handle this colour as transparent in
wxMSW when loading the bitmaps from resources, but this is rather not obvious
for the new users, so document it and provide a way of compensating for this
in the documentation as well.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:33 +0000 (11:08 +0000)]
Define __VISUALC__ for ICC under Windows again.
During the refactoring of r74496, the logic of the check for Intel compiler
was slightly altered resulting in not defining __VISUALC__ for it any longer
which broke compilation with it.
Restore this definition now to fix it, even though it could admittedly be
better to explicitly check for __INTELC__ in the places where we currently
only check for __VISUALC__ and reserve the latter only for the case when we
are really using MSVC.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:21 +0000 (11:08 +0000)]
Update Travis configuration to run tests and build more configurations.
Install libcppunit-dev in order to be able to run the unit tests (at least the
non-GUI ones for now).
Also build in several configurations: shared/static, multilib/monolithic and
also STL. This should help to find problems appearing only in some specific
build variants.
Vadim Zeitlin [Wed, 7 Aug 2013 11:08:12 +0000 (11:08 +0000)]
Don't use DDEExec registry key in wxMSW wxExecute() if it's empty.
Some file types have DDEExec subkey in the registry but no value for it, don't
use DDE for launching the files of these types in this case as this only
results in errors.
Vadim Zeitlin [Tue, 6 Aug 2013 17:00:00 +0000 (17:00 +0000)]
Don't generate any events from wxSpinCtrl and wxSpinCtrlDouble methods.
After the changes of r53758 wxMSW didn't generate any wxEVT_TEXT events but
this was still the case for the generic version (and hence for
wxSpinCtrlDouble under MSW too) and wasn't documented.
Fix all versions to avoid sending events for programmatic actions, add unit
tests checking this behaviour and document it.
Vadim Zeitlin [Tue, 6 Aug 2013 16:59:54 +0000 (16:59 +0000)]
Add test for absence of events from wxSpinCtrlDouble ctor.
Run the same NoEventsInCtor() test as we already had for wxSpinCtrl for
wxSpinCtrlDouble as well.
Unfortunately currently there is no way to reuse the tests between these two
classes, we should refactor these test cases to use a common
SpinCtrlTestCaseBase<T> base class.