Merge branch 'uisim-xtest'

Make wxUIActionSimulator work with GTK+3, including when using DPI scaling.
This commit is contained in:
Vadim Zeitlin
2016-06-04 22:44:25 +02:00
15 changed files with 705 additions and 100 deletions

View File

@@ -0,0 +1,44 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/private/uiaction.h
// Purpose: wxUIActionSimulatorImpl declaration
// Author: Vadim Zeitlin
// Created: 2016-05-21
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRIVATE_UIACTION_H_
#define _WX_PRIVATE_UIACTION_H_
// ----------------------------------------------------------------------------
// Platform-specific implementation of wxUIActionSimulator
// ----------------------------------------------------------------------------
class wxUIActionSimulatorImpl
{
public:
wxUIActionSimulatorImpl() { }
virtual ~wxUIActionSimulatorImpl() { }
// Low level mouse methods which must be implemented in the derived class.
virtual bool MouseMove(long x, long y) = 0;
virtual bool MouseDown(int button = wxMOUSE_BTN_LEFT) = 0;
virtual bool MouseUp(int button = wxMOUSE_BTN_LEFT) = 0;
// Higher level mouse methods which have default implementation in the base
// class but can be overridden if necessary.
virtual bool MouseClick(int button = wxMOUSE_BTN_LEFT);
virtual bool MouseDblClick(int button = wxMOUSE_BTN_LEFT);
virtual bool MouseDragDrop(long x1, long y1, long x2, long y2,
int button = wxMOUSE_BTN_LEFT);
// The low-level port-specific function which really generates the key
// presses. It should generate exactly one key event with the given
// parameters.
virtual bool DoKey(int keycode, int modifiers, bool isDown) = 0;
private:
wxDECLARE_NO_COPY_CLASS(wxUIActionSimulatorImpl);
};
#endif // _WX_PRIVATE_UIACTION_H_

View File

@@ -2,11 +2,10 @@
// Name: wx/uiaction.h
// Purpose: wxUIActionSimulator interface
// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
// Modified by:
// Created: 2010-03-06
// Copyright: (c) Kevin Ollivier
// Copyright: (c) 2010 Kevin Ollivier
// (c) 2010 Steven Lamerton
// (c) 2010 Vadim Zeitlin
// (c) 2010-2016 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@ -22,11 +21,8 @@
class WXDLLIMPEXP_CORE wxUIActionSimulator
{
public:
wxUIActionSimulator() { }
// Default dtor, copy ctor and assignment operator are ok (even though the
// last two don't make much sense for this class).
wxUIActionSimulator();
~wxUIActionSimulator();
// Mouse simulation
@@ -82,10 +78,12 @@ private:
void SimulateModifiers(int modifier, bool isDown);
// The low-level port-specific function which really generates the key
// presses. It should generate exactly one key event with the given
// parameters.
bool DoKey(int keycode, int modifiers, bool isDown);
// This pointer is allocated in the ctor and points to the
// platform-specific implementation.
class wxUIActionSimulatorImpl* const m_impl;
wxDECLARE_NO_COPY_CLASS(wxUIActionSimulator);
};
#endif // wxUSE_UIACTIONSIMULATOR

View File

@@ -41,3 +41,11 @@
# endif
# endif
#endif /* wxUSE_GSTREAMER */
#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) */

View File

@@ -67,6 +67,13 @@ public:
wxX11Display() { m_dpy = XOpenDisplay(NULL); }
~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
// Pseudo move ctor: steals the open display from the other object.
explicit wxX11Display(wxX11Display& display)
{
m_dpy = display.m_dpy;
display.m_dpy = NULL;
}
operator Display *() const { return m_dpy; }
// Using DefaultRootWindow() with an object of wxX11Display class doesn't