Commit Graph

61701 Commits

Author SHA1 Message Date
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
8e76aab544 Demonstrate simulating menu item selection in the uiaction sample
This just checks that pressing a key with "Alt" modifier can be used to open a
menu and that pressing the menu item letter then selects an item from it.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
594d916dcb Support DPI scaling in wxUIActionSimulator when using GTK+ 3
Scale the coordinates passed to MouseMove() by the GTK scaling factor to
ensure that the mouse clicks are really delivered to the correct windows,
without this change wxUIActionSimulator was unusable on systems using high DPI
(i.e. GDK_SCALE of 2).

Per-monitor DPI scaling is still not supported however.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
38c8a10b79 Don't even compile in wxUIActionSimulatorX11Impl when using GTK+3
This code can never work anyhow, there is no reason to compile and link it.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
e2c98afd5a Sync with X server before simulating mouse clicks
Adding a call to XSync() to wxUIActionSimulatorX11Impl seems to fix the
problems with the focus snapping back to the control having it previously
after simulating a mouse click and changing the focus afterwards using
wxWindow::SetFocus(), as the uiaction sample did.

Admittedly, it's not really clear why does doing it help, but at the very
leasy this XSync() call shouldn't do any harm.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
7cf5804465 Determine wxUIActionSimulatorX11Impl version to use dynamically
Choose between wxUIActionSimulatorXTestImpl and
wxUIActionSimulatorPlainX11Impl dynamically, depending on whether XTest
extension is available during run-time or not.

Also decouple the two implementation to keep them clearly separated.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
4a0938d2b7 Allow "moving" wxX11Display objects
This is not a real move-ctor but std::auto_ptr<>-like "stealing" ctor. It
still allows to pass Display ownership to another function which is all that
is needed for our purposes.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
746b91c5d3 Open the display only once in wxUIActionSimulatorX11Impl
Instead of opening connection to X display in every method, do it once in
ctor, as we can store the display across multiple calls after the recent
refactoring.

This does require allocating a separate "impl" object for each public object,
but should still be much less wasteful than opening and closing the display
connections all the time.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
d1b537f953 Refactor: move SendButtonEvent() into wxUIActionSimulatorX11Impl
Make the function a method of the class in preparation for the next commit.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
cfc1681b4c Virtualize wxUIActionSimulator implementation
Extract platform-specific code in a wxUIActionSimulatorImpl-derived class
instead of keeping it in wxUIActionSimulator itself.

This will allow determining which implementation to use dynamically (i.e. at
run-time and not compile-time) to use later and already allows to get rid of
an __WXOSX__ #ifdef in common code.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
e82c619402 Only define wxUSE_XTEST in Unix-specific headers
This symbol is not needed and doesn't make sense in wxMSW.
2016-05-23 03:00:48 +02:00
Vadim Zeitlin
54a6c44a77 Disable wxUIActionSimulator if XTest not found when using GTK+ 3
The implementation using XSendEvent() with classic input events can't work
with GTK+ 3 anyhow because it uses XInput2 which is incompatible with them, so
warn the user about this and don't compile useless code into the library.
2016-05-23 03:00:48 +02:00
Vadim Zeitlin
ec4a41f3b7 Don't test for XTest when not using X11 wxUIActionSimulator
There is no need to check (and give a warning about it being not found) when
building wxMSW, wxOSX or even wxQt.
2016-05-23 03:00:48 +02:00
Scott Talbert
a4716916b7 Add support for using the XTest extension in wxUIActionSimulator
Fixes wxUIActionSimulator under wxGTK3, see #17530.
2016-05-23 03:00:48 +02:00
Vadim Zeitlin
a31a7522c4 Add accelerators for the menu items in wxUIActionSimulator sample
No real changes, just make it more convenient to test using this sample.
2016-05-23 02:02:20 +02:00
Vadim Zeitlin
42b53f156d Show the time taken by the simulation in the uiaction sample
If nothing else, it allows it to see when the simulation is done.
2016-05-23 02:01:11 +02: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