Commit Graph

65326 Commits

Author SHA1 Message Date
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
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