Commit Graph

61539 Commits

Author SHA1 Message Date
Vadim Zeitlin
6d54c49b2a Fix build with classic MinGW in strict ANSI mode when using PCH
The hack used in cc774bb301 to include some
standard headers after undefining __STRICT_ANSI__ doesn't work when
precompiled headers are used because the headers had been already included
from wx/wxprec.h then.

So instead bite the bullet and just reproduce MinGW stdlib.h declarations to
define "environ" ourselves, it's not that bad and hopefully won't need much
maintenance as later versions won't need the strict ANSI workarounds at all.
As for tzset(), wxDECL_FOR_STRICT_MINGW32() can be used for it without any
problems at all, not sure why hasn't it been done like this since the
beginning.

See #16984.
2016-05-30 19:30:14 +02:00
Vadim Zeitlin
78bfde8ac0 Fix link errors with older MinGW due to use of GetLayout()
This function is not present in older MinGW import libraries, up to at least
MinGW 4.8.1, so we can't use it directly as it was done in
22f0801378 and we need to load it dynamically.

This was already done in wxDC code, so just reuse the same wrapper function
after extracting it (and a few others, for consistency) into a new header.
2016-05-30 19:30:07 +02:00
Artur Wieczorek
5e500de7e8 Fixed minor typos in the drawing sample 2016-05-26 17:57:11 +02:00
Artur Wieczorek
7923cb222e Fixed cloning wxD2DPathData.
In addition to copying the underlying geometry sink itself also auxiliary data, like collection of transformed geometries and positional data have to copied the the new wxD2DPathData instance.
2016-05-26 17:55:34 +02:00
Artur Wieczorek
2b13dc7473 Modified wxGraphicsPath concatenation (with AddPath) for Direct2D renderer.
Because wxGraphicsPath comprises current ID2D1PathGeometry object and the collection of transformed (sub-)geometries (ID2D1TransformedGeometry objects) so to concatenate two paths we need to concatenate their current geometries as well as to combine the collections of transformed geometries.
2016-05-26 17:54:45 +02:00
Artur Wieczorek
fa01392788 Fixed transformation of wxGraphicsPath for Direct2D renderer.
Unfortunately, it seems that this is not a straightforward method to apply transformation to the current underlying path geometry (ID2D1PathGeometry object) "in-place" (ie. transform it and use for further graphics operations). Some simple methods offered by Direct2D are not useful for these purposes:
1. ID2D1Factory::CreateTransformedGeometry() converts ID2D1PathGeometry object to ID2D1TransformedGeometry object and ID2D1TransformedGeometry inherits from ID2D1Geometry (not from ID2D1PathGeometry) and cannot be used for path operations.
2. ID2D1Geometry::CombineWithGeometry() which could be used to get final geometry by combining empty geometry with transformed geometry doesn't offer any combine mode which would produce a "sum" of geometries (D2D1_COMBINE_MODE_UNION gives kind of outline). Moreover the result is stored in ID2D1SimplifiedGeometrySink not in ID2DGeometrySink.

So, it seems that ability to transform the wxGraphicsPath (even several times) and still use it after this operation(s) can be achieved by using a geometry group object (ID2D1GeometryGroup) this way:
1. After applying transformation to the current path geometry with ID2D1Factory::CreateTransformedGeometry() the result is stored in the collection of transformed geometries (an auxiliary array) and after that a new (empty) geometry is open (in the same state as just closed one) and this geometry is used as a current one for further graphics operations.
2. Above steps are done at every transformation so our effective geometry will be a superposition of all previously transformed geometries stored in the collection (array) and the current operational geometry.
3. If there is necessary to use this combined effective geometry in any operation then ID2D1GeometryGroup created with ID2D1Factory::CreateGeometryGroup() from the collection of stored geometries will act as a proxy geometry.

Closes #17549
2016-05-26 17:51:53 +02:00
Artur Wieczorek
b92c91bafb Fixed flushing underlying graphics path data for Direct2D renderer
Don't attempt to close already closed geometry sink.
2016-05-26 17:33:59 +02:00
Artur Wieczorek
a64a204749 Add more error checks to Direct2D wxGraphicsRenderer code.
Check the results of the native Direct2D operations.
2016-05-26 17:32:58 +02:00
Artur Wieczorek
993fcdac7d Added missing references to some dynamically loaded Direct2D API's.
Without this fix invoking D2D1::Matrix3x2F::IsInvertible() or D2D1::Matrix3x2F::Skew() functions breaks the build.
2016-05-26 17:32:09 +02:00
Paul Cornett
7e41ac405f Avoid blank menubar/toolbar when using wx[MT]B_DOCKABLE with GTK+ 3.20
A GTK+ bug involving GtkHandleBox somehow prevents drawing of its child
since 3.19.7.  Avoid this by disabling the docking functionality, which
is preferable to having the bar be blank.
See #17539
2016-05-25 09:39:50 -07:00
Vadim Zeitlin
9c30da08c0 Document that wxLongLong is obsolete nowadays
People should just use "long long" or "int64_t" instead.
2016-05-20 02:43:28 +02:00
Vadim Zeitlin
7d95278021 Document wxULongLong separately from wxLongLong
These classes don't have exactly the same API, e.g. the former provides
ToULong() while the latter has ToLong().

Closes #17533.
2016-05-20 02:43:28 +02:00
Vadim Zeitlin
4c09d12a91 Don't crash in wxDisplay::GetCurrentMode() if there is no support
Display sample crashed on startup if XFree86-VidModeExtension extension was
not available.

Add missing error checking to avoid this.
2016-05-19 23:52:27 +02:00
Vadim Zeitlin
596399f2ec Remove wxLogDebug() from wxColour::FromString()
Just returning false is enough, there is no need to log a debug message as
well.

Also simplify the logic of this function a little by always returning true at
the end and returning false before on failure.

Closes #13759.
2016-05-19 22:05:11 +02:00
Vadim Zeitlin
5817911863 Merge fixes for CVE-2016-0718 in Expat
This merges a branch with a (slightly tweaked to apply) copy of the
cve-2016-0718-fix-2-2-1 branch from the official Expat repository at
https://sourceforge.net/p/expat/code_git/
2016-05-18 14:52:26 +02:00
Lauri Nurmi
d51ce354c1 Document that wxFileSystemWatcher requires a running event loop
On Gtk and OS X, but unfortunately not MSW, an assert fails if a
wxFileSystemWatcher is created too early. Therefore give a hint about
where and when one should be created.

Closes https://github.com/wxWidgets/wxWidgets/pull/287
2016-05-18 14:51:31 +02:00
Pascal Cuoq
06ea3e152c Do not compare an out-of-bounds pointer. See https://lwn.net/Articles/278137/ 2016-05-18 14:50:03 +02:00
Pascal Cuoq
6a3374989c Avoid undefined behavior when computing larger blockSize. The compiler might reason that (end - start)*2 is negative only if (end - start) is negative, see https://godbolt.org/g/wVEoTM 2016-05-18 14:50:03 +02:00
Sebastian Pipping
b6bc23c9b4 Complete XmlConvert return value handling 2016-05-18 14:50:03 +02:00
Sebastian Pipping
7f6194038a Do not grow pool to out-of-memory for incomplete input 2016-05-18 14:50:03 +02:00
Sebastian Pipping
d8d581a382 Make converters tell state on termination (v3) 2016-05-18 14:50:03 +02:00
Sebastian Pipping
a398ccf8ec Prevent out-of-bounds access in text conversion
* big2_toUtf8
* little2_toUtf8
* utf8_toUtf8
* utf8_toUtf16
2016-05-18 14:47:55 +02:00
Gustavo Grieco
a4d77355e3 Fix two integer overflows 2016-05-18 14:47:55 +02:00
Karl Waclawek
0f0c5aa731 Fix overflow (v2)
(Some post-processing by Sebastian Pipping)
2016-05-18 14:47:55 +02:00
Vadim Zeitlin
5b597cd0e8 Fix widgets sample build with MinGW-w64 4.9.1
The headers for this compiler, at least in the version packaged under Debian,
define BCN_DROPDOWN but not the NMBCDROPDOWN struct we also need, so we have
no choice but to redeclare the struct ourselves to allow this code to compile.
2016-05-17 23:36:06 +02:00
Vadim Zeitlin
fb4ff2449c Correct test for MSVC in wxStackWalker::Walk()
Use "#if defined" instead of "#if" for the check for __VISUALC__ added in
e405bf1607 to avoid -Wundef warnings when
compiling this code with gcc.
2016-05-17 20:26:16 +02:00
Vadim Zeitlin
6a2a4ef38b Use "int" instead of "long" for TLW geometry storage
For some reason, "long" was used for window coordinates even though they're
really "int", and implicitly converting from the former to the latter resulted
in warnings in user code including this header with e.g. Apple clang.

Just use int to avoid conversions.
2016-05-15 20:23:01 +02:00
Paul Cornett
8809cb68cf remove disabling comment accidentally committed in 5819b9c 2016-05-15 09:17:46 -07:00
Paul Cornett
5819b9cbc5 Avoid resetting global cursor if no global cursor is set
see #17503
2016-05-15 09:06:09 -07:00
Paul Cornett
4c6dddec21 Fix single line wxTextCtrl selection colors when foreground or background color is set with GTK3
see #17527
2016-05-14 11:38:36 -07:00
Eric Raijmakers
5d671d8136 Fix keyboard navigation crash in single column generic wxDataViewCtrl
Selecting a leaf node in a wxDataViewCtrl and then pressing the right arrow
key resulted in using an out-of-bounds index for accessing the columns list.

Fix this by setting the current column to the first one, and not to the second
one which might not exist.

Closes #17537.
2016-05-14 16:18:14 +02:00
lcrees
311b4d1b14 Fix wxOSX build on case-sensitive filesystem
Use the correct case for AppKit.h to fix the problem with not finding the file
when using a case-sensitive filesystem for the build.

Closes https://github.com/wxWidgets/wxWidgets/pull/284
2016-05-14 15:46:09 +02:00
Benjamin Drung
bc41cbeb25 Define wxIsNaN() as std::isnan() in C++11 mode
std::isnan() is always available when using C++11, so just use it.

Also pout the test for C++11 implementations of both wxIsNaN() and wxFinite()
first, eventually the rest of the checks will become obsolete and will be
removed.

Closes https://github.com/wxWidgets/wxWidgets/pull/283
2016-05-14 00:13:47 +02:00
Vadim Zeitlin
a5d2f53f41 Inherit wxGauge from wxGaugeBase in wxGTK
Ensure the proper class hierarchy in wxGTK, this notably allows to override
SetValue() in classes derived from wxGauge, which didn't work in wxGTK (but
did in wxMSW and wxOSX) before.

Also remove the now unnecessary IsVertical().
2016-05-13 22:32:16 +02:00
Vadim Zeitlin
189e4c5024 Null-terminate arrays returned from wxCmdLineArgsArray
This is required for compatibility with the real argv array that this class is
supposed to emulate.

Closes #17531.
2016-05-13 15:40:22 +02:00
Jonathan Dagresta
306597c4fa Ensure wxGenericListCtrl item selected from keyboard is visible
When using the keyboard to select an item by typing the first characters of
its name, we need to make the item visible in addition to selecting it.

Closes #16336.
2016-05-13 15:30:13 +02:00
Artur Wieczorek
360416dfed Check if path geometry contents was successfully transferred while cloning wxD2DPathData.
Since only geometry with closed sink (immutable) can be transferred to another geometry object with ID2D1PathGeometry::Stream() so we have to check if actual transfer succeeded and return NULL if not.
2016-05-12 21:34:53 +02:00
Artur Wieczorek
bd55ce4d37 Fixed closing sub-path of wxGraphicsPath with Direct2D renderer.
To ensure compatibility with Cairo renderer the new sub-path should be started at the joined endpoint of the current (just closed) sub-path.

Closes #17532
2016-05-12 21:33:50 +02:00
Artur Wieczorek
4014000a98 Fixed wxGraphicsPath concatenation (with AddPath) for Direct2D renderer.
Because only ID2D1PathGeometry with closed sink (in the immutable state) can be transferred to another geometry object with ID2D1PathGeometry::Stream() so appending one wxGraphicsPath to another has to be done with source path geometry in the non-writable state and closing this geometry has to be done prior to any other operation.
But we want source wxGraphicsPath to stay in the writable state after appending it to another path so we have to prepare a writable copy of the source ID2D1PathGeometry and assign it to the source wxGraphicPath after the appending.

See #17532
2016-05-12 21:32:20 +02:00
Artur Wieczorek
43be7073cd Make closing sub-path of wxGraphicsPath with GDI+ renderer compatible with Cairo renderer.
Cairo renderer places MOVE_TO element into the path immediately after after the CLOSE_PATH element so to ensure that GDI+ will behave in the same way the new sub-path should be started at the joined endpoint of the current just closed sub-path.

See #17532
2016-05-12 21:26:25 +02:00
Artur Wieczorek
49a634e63f Fixed closing sub-path of wxGraphicsPath with GDI+ renderer.
Add additional point to the sub-path being closed only if this sub-path is empty (its native current point is not set).
2016-05-12 21:18:24 +02:00
Artur Wieczorek
5ffbc7c175 Fixed applying transformation to wxGraphicsPath with GDI+ renderer.
Auxiliary points as well as the native path points have to be the subject of the transformation.
2016-05-12 21:16:51 +02:00
Artur Wieczorek
08cb54c4c1 Fixed wxGraphicsPath concatenation with GDI+ renderer.
Since resulting wxGraphicPath should have the same state as appended path so we have to grab in wxGraphicsPath::AddPath also auxiliary data from appended wxGraphicsPath.

See #17532
2016-05-12 21:15:19 +02:00
Vadim Zeitlin
4eababc004 Don't document non-public wxEvtHandler::SearchEventTable()
This method is not part of public wxWidgets API, so don't document it.
2016-05-09 18:58:39 +02:00
Artur Wieczorek
66e3a3f724 Fixed adding a Bezier curve to wxGraphicsPath with Direct2D renderer.
When current point is not set before the call to wxGraphicsPath::AddCurveToPoint() then it should be set at first control point prior to adding a curve (function should behave as if preceded by MoveToPoint).

Closes #17526
2016-05-09 18:41:16 +02:00
Artur Wieczorek
22c520e3e8 Fixed adding a Bezier curve to wxGraphicsPath with GDI+ renderer.
When current point is not set before the call to wxGraphicsPath::AddCurveToPoint() then it should be set at first control point prior to adding a curve (function should behave as if preceded by MoveToPoint).

See #17526
2016-05-09 18:40:10 +02:00
Jouk
d3e57a1dcf define != operator for WatcherWithUserData needed for find on OpenVMS AXP 2016-05-09 10:21:13 +02:00
Artur Wieczorek
43ba49285b Fixed closing sub-path of wxGraphicsPath with Direct2D renderer.
Ensure that sub-path being closed contains at least one point.

Closes #17525
2016-05-08 21:54:11 +02:00
Artur Wieczorek
fa5f3818b9 Fixed adding a line to wxGraphicsPath with Direct2D renderer.
When current point is not yet set then wxGraphicsPath::AddLineToPoint() should behave as MoveToPoint(). We have to determine whether current point is set or not using additional flag because native renderer doesn't provide any support regarding this matter.

See #17525
2016-05-08 21:53:15 +02:00
Artur Wieczorek
24dfd62fc0 Fixed closing sub-path of wxGraphicsPath with GDI+ renderer.
Ensure that sub-path being closed contains at least one point.

See #17525.
2016-05-08 21:52:04 +02:00