Add wxWindow::EnableTouchEvents()

Don't request touch event generation for all windows by default, this
has an inherent overhead and is not needed for 99% of the application
windows, so require calling EnableTouchEvents() explicitly to do it
instead.

Note that this requires properly initializing gesture recognizers in
wxOSX now that they're not always allocated, otherwise releasing them
when destroying the window would crash.
This commit is contained in:
Vadim Zeitlin
2017-11-21 19:23:34 +01:00
parent e7f4e232fa
commit 842dd1cfd9
14 changed files with 131 additions and 36 deletions

View File

@@ -3649,6 +3649,10 @@ public:
/** @class wxGestureEvent
This is the base class for all supported gesture events.
@note Gesture events are not generated by default, you must call
wxWindow::EnableTouchEvents() with the appropriate parameter to
request their generation.
@library{wxcore}
@category{events}

View File

@@ -3424,6 +3424,19 @@ public:
*/
virtual void WarpPointer(int x, int y);
/**
Request generation of touch events for this window.
@param eventsMask Either wxTOUCH_NONE or wxTOUCH_ALL_GESTURES to
disable or enable gesture events for this window.
@return @true if the specified events were enabled or @false if the
current platform doesn't support touch events.
@since 3.1.1
*/
virtual bool EnableTouchEvents(int eventsMask);
//@}