Add support for using the XTest extension in wxUIActionSimulator
Fixes wxUIActionSimulator under wxGTK3, see #17530.
This commit is contained in:
committed by
Vadim Zeitlin
parent
a31a7522c4
commit
a4716916b7
124
configure
vendored
124
configure
vendored
@@ -945,6 +945,8 @@ WEBKIT_LIBS
|
||||
WEBKIT_CFLAGS
|
||||
COND_PYTHON
|
||||
PYTHON
|
||||
XTST_LIBS
|
||||
XTST_CFLAGS
|
||||
LIBNOTIFY_LIBS
|
||||
LIBNOTIFY_CFLAGS
|
||||
GNOMEVFS_LIBS
|
||||
@@ -1092,6 +1094,7 @@ with_gtkprint
|
||||
with_gnomevfs
|
||||
with_libnotify
|
||||
with_opengl
|
||||
with_xtest
|
||||
with_dmalloc
|
||||
with_sdl
|
||||
with_regex
|
||||
@@ -1397,6 +1400,8 @@ GNOMEVFS_CFLAGS
|
||||
GNOMEVFS_LIBS
|
||||
LIBNOTIFY_CFLAGS
|
||||
LIBNOTIFY_LIBS
|
||||
XTST_CFLAGS
|
||||
XTST_LIBS
|
||||
WEBKIT_CFLAGS
|
||||
WEBKIT_LIBS
|
||||
CAIRO_CFLAGS
|
||||
@@ -2318,6 +2323,7 @@ Optional Packages:
|
||||
--with-gnomevfs use GNOME VFS for associating MIME types
|
||||
--with-libnotify use libnotify for notifications
|
||||
--with-opengl use OpenGL (or Mesa)
|
||||
--with-xtest use XTest extension
|
||||
--with-dmalloc use dmalloc library (http://dmalloc.com/)
|
||||
--with-sdl use SDL for audio on Unix
|
||||
--with-regex enable support for wxRegEx class
|
||||
@@ -2391,6 +2397,8 @@ Some influential environment variables:
|
||||
C compiler flags for LIBNOTIFY, overriding pkg-config
|
||||
LIBNOTIFY_LIBS
|
||||
linker flags for LIBNOTIFY, overriding pkg-config
|
||||
XTST_CFLAGS C compiler flags for XTST, overriding pkg-config
|
||||
XTST_LIBS linker flags for XTST, overriding pkg-config
|
||||
WEBKIT_CFLAGS
|
||||
C compiler flags for WEBKIT, overriding pkg-config
|
||||
WEBKIT_LIBS linker flags for WEBKIT, overriding pkg-config
|
||||
@@ -4823,6 +4831,35 @@ fi
|
||||
eval "$wx_cv_use_opengl"
|
||||
|
||||
|
||||
withstring=
|
||||
defaultval=$wxUSE_ALL_FEATURES
|
||||
if test -z "$defaultval"; then
|
||||
if test x"$withstring" = xwithout; then
|
||||
defaultval=yes
|
||||
else
|
||||
defaultval=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --with-xtest was given.
|
||||
if test "${with_xtest+set}" = set; then :
|
||||
withval=$with_xtest;
|
||||
if test "$withval" = yes; then
|
||||
wx_cv_use_xtest='wxUSE_XTEST=yes'
|
||||
else
|
||||
wx_cv_use_xtest='wxUSE_XTEST=no'
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
wx_cv_use_xtest='wxUSE_XTEST=${'DEFAULT_wxUSE_XTEST":-$defaultval}"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
eval "$wx_cv_use_xtest"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -33532,6 +33569,93 @@ if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
|
||||
$as_echo "#define wxUSE_UIACTIONSIMULATOR 1" >>confdefs.h
|
||||
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS uiaction"
|
||||
if test "$wxUSE_XTEST" = "yes" ; then
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XTST" >&5
|
||||
$as_echo_n "checking for XTST... " >&6; }
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$XTST_CFLAGS"; then
|
||||
pkg_cv_XTST_CFLAGS="$XTST_CFLAGS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xtst\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "xtst") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_XTST_CFLAGS=`$PKG_CONFIG --cflags "xtst" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$XTST_LIBS"; then
|
||||
pkg_cv_XTST_LIBS="$XTST_LIBS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xtst\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "xtst") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_XTST_LIBS=`$PKG_CONFIG --libs "xtst" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
XTST_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "xtst"`
|
||||
else
|
||||
XTST_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xtst"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$XTST_PKG_ERRORS" >&5
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: XTest extension not found" >&5
|
||||
$as_echo "$as_me: WARNING: XTest extension not found" >&2;}
|
||||
wxUSE_XTEST="no"
|
||||
|
||||
|
||||
elif test $pkg_failed = untried; then
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: XTest extension not found" >&5
|
||||
$as_echo "$as_me: WARNING: XTest extension not found" >&2;}
|
||||
wxUSE_XTEST="no"
|
||||
|
||||
|
||||
else
|
||||
XTST_CFLAGS=$pkg_cv_XTST_CFLAGS
|
||||
XTST_LIBS=$pkg_cv_XTST_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $XTST_LIBS"
|
||||
CFLAGS="$XTST_CFLAGS $CFLAGS"
|
||||
CXXFLAGS="$XTST_CFLAGS $CXXFLAGS"
|
||||
$as_echo "#define wxUSE_XTEST 1" >>confdefs.h
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DC_TRANSFORM_MATRIX" = "yes" ; then
|
||||
|
15
configure.in
15
configure.in
@@ -542,6 +542,7 @@ WX_ARG_WITHOUT(gtkprint, [ --without-gtkprint don't use GTK printing sup
|
||||
WX_ARG_WITH(gnomevfs, [ --with-gnomevfs use GNOME VFS for associating MIME types], wxUSE_LIBGNOMEVFS)
|
||||
WX_ARG_WITH(libnotify, [ --with-libnotify use libnotify for notifications], wxUSE_LIBNOTIFY)
|
||||
WX_ARG_WITH(opengl, [ --with-opengl use OpenGL (or Mesa)], wxUSE_OPENGL)
|
||||
WX_ARG_WITH(xtest, [ --with-xtest use XTest extension], wxUSE_XTEST)
|
||||
|
||||
fi
|
||||
dnl for GUI only
|
||||
@@ -6360,6 +6361,20 @@ fi
|
||||
if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
|
||||
AC_DEFINE(wxUSE_UIACTIONSIMULATOR)
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS uiaction"
|
||||
if test "$wxUSE_XTEST" = "yes" ; then
|
||||
PKG_CHECK_MODULES(XTST, xtst,
|
||||
[
|
||||
GUI_TK_LIBRARY="$GUI_TK_LIBRARY $XTST_LIBS"
|
||||
CFLAGS="$XTST_CFLAGS $CFLAGS"
|
||||
CXXFLAGS="$XTST_CFLAGS $CXXFLAGS"
|
||||
AC_DEFINE(wxUSE_XTEST)
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([XTest extension not found])
|
||||
wxUSE_XTEST="no"
|
||||
]
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DC_TRANSFORM_MATRIX" = "yes" ; then
|
||||
|
@@ -85,6 +85,7 @@ All (GUI):
|
||||
|
||||
wxGTK:
|
||||
|
||||
- Make wxUIActionSimulator work with GTK+ 3 (Scott Talbert).
|
||||
- Implement setting link colours in wxHyperlinkCtrl for GTK+3 (Hanmac).
|
||||
- Support background colour in wxDataViewCtrl attributes.
|
||||
- Improve wxSpinCtrl best size calculation.
|
||||
|
@@ -267,6 +267,7 @@ library:
|
||||
@itemdef{wxUSE_LIBSDL, Use SDL for wxSound implementation.}
|
||||
@itemdef{wxUSE_PLUGINS, See also wxUSE_LIBSDL.}
|
||||
@itemdef{wxUSE_UNIX, Enabled on Unix Platform.}
|
||||
@itemdef(wxUSE_XTEST, Use XTest extension.}
|
||||
@endDefList
|
||||
|
||||
|
||||
|
@@ -1403,6 +1403,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1231,6 +1231,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_XRC) */
|
||||
|
||||
#ifndef wxUSE_XTEST
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_XTEST must be defined, please read comment near the top of this file."
|
||||
# else
|
||||
# define wxUSE_XTEST 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_XTEST) */
|
||||
|
||||
#endif /* wxUSE_GUI */
|
||||
|
||||
/*
|
||||
|
@@ -1404,6 +1404,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1404,6 +1404,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1404,6 +1404,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1405,6 +1405,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1400,6 +1400,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -1403,6 +1403,9 @@
|
||||
// Compile wxUIActionSimulator class?
|
||||
#define wxUSE_UIACTIONSIMULATOR 1
|
||||
|
||||
// Use the XTest extension for wxUIActionSimulator?
|
||||
#define wxUSE_XTEST 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDC classes for various output formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -570,6 +570,8 @@
|
||||
|
||||
#define wxUSE_UIACTIONSIMULATOR 0
|
||||
|
||||
#define wxUSE_XTEST 0
|
||||
|
||||
|
||||
#define wxUSE_POSTSCRIPT 0
|
||||
|
||||
|
@@ -20,6 +20,9 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#if wxUSE_XTEST
|
||||
#include <X11/extensions/XTest.h>
|
||||
#endif
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
@@ -48,6 +51,10 @@ void SendButtonEvent(int button, bool isDown)
|
||||
wxX11Display display;
|
||||
wxCHECK_RET(display, "No display available!");
|
||||
|
||||
#if wxUSE_XTEST
|
||||
XTestFakeButtonEvent(display, xbutton, isDown, 0);
|
||||
|
||||
#else // !wxUSE_XTEST
|
||||
XEvent event;
|
||||
memset(&event, 0x00, sizeof(event));
|
||||
|
||||
@@ -71,6 +78,7 @@ void SendButtonEvent(int button, bool isDown)
|
||||
}
|
||||
|
||||
XSendEvent(display, PointerWindow, True, 0xfff, &event);
|
||||
#endif // !wxUSE_XTEST
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -86,8 +94,13 @@ bool wxUIActionSimulator::MouseMove(long x, long y)
|
||||
wxX11Display display;
|
||||
wxASSERT_MSG(display, "No display available!");
|
||||
|
||||
#if wxUSE_XTEST
|
||||
XTestFakeMotionEvent(display, -1, x, y, 0);
|
||||
|
||||
#else // !wxUSE_XTEST
|
||||
Window root = display.DefaultRoot();
|
||||
XWarpPointer(display, None, root, 0, 0, 0, 0, x, y);
|
||||
#endif // !wxUSE_XTEST
|
||||
|
||||
// At least with wxGTK we must always process the pending events before the
|
||||
// mouse position change really takes effect, so just do it from here
|
||||
@@ -130,6 +143,14 @@ bool wxUIActionSimulator::DoKey(int keycode, int modifiers, bool isDown)
|
||||
if ( xkeycode == NoSymbol )
|
||||
return false;
|
||||
|
||||
#if wxUSE_XTEST
|
||||
wxUnusedVar(modifiers);
|
||||
wxUnusedVar(mask);
|
||||
wxUnusedVar(type);
|
||||
XTestFakeKeyEvent(display, xkeycode, isDown, 0);
|
||||
return true;
|
||||
|
||||
#else // !wxUSE_XTEST
|
||||
Window focus;
|
||||
int revert;
|
||||
XGetInputFocus(display, &focus, &revert);
|
||||
@@ -164,6 +185,7 @@ bool wxUIActionSimulator::DoKey(int keycode, int modifiers, bool isDown)
|
||||
XSendEvent(event.display, event.window, True, mask, (XEvent*) &event);
|
||||
|
||||
return true;
|
||||
#endif // !wxUSE_XTEST
|
||||
}
|
||||
|
||||
#endif // wxUSE_UIACTIONSIMULATOR
|
||||
|
Reference in New Issue
Block a user