]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxUSE_UIACTIONSIMULATOR and turn it off by default.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Mar 2010 11:40:35 +0000 (11:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 22 Mar 2010 11:40:35 +0000 (11:40 +0000)
Disable the recently added wxUIActionSimulator class until the issues with it
mentioned at http://article.gmane.org/gmane.comp.lib.wxwidgets.devel/119792/
are fixed.

Also use "" around wx headers instead of <> in wx code itself.

See #11801.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63736 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

19 files changed:
configure
configure.in
include/wx/chkconf.h
include/wx/motif/setup0.h
include/wx/msw/setup0.h
include/wx/msw/wince/setup.h
include/wx/os2/setup0.h
include/wx/osx/setup0.h
include/wx/palmos/setup0.h
include/wx/setup_inc.h
include/wx/uiaction.h
include/wx/univ/setup0.h
interface/wx/uiaction.h
samples/uiaction/uiaction.cpp
setup.h.in
src/common/uiactioncmn.cpp
src/msw/uiaction.cpp
src/osx/uiaction_osx.cpp
src/unix/uiactionx11.cpp

index ee0c8da219fc4a265f833afc11da5651e33357af..048e3b291bc5569fe9282051079226e69bdd9b6c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1883,6 +1883,7 @@ Optional Features:
   --enable-metafiles      use wxMetaFile (Win32 only)
   --enable-dragimage      use wxDragImage
   --enable-accessibility  enable accessibility support
+  --enable-uiactionsim    use wxUIActionSimulator (experimental)
   --enable-palette        use wxPalette class
   --enable-image          use wxImage class
   --enable-gif            use gif images (GIF file format)
@@ -2969,6 +2970,7 @@ DEFAULT_wxUSE_LIBSDL=no
 DEFAULT_wxUSE_ACCESSIBILITY=no
 DEFAULT_wxUSE_IPV6=no
 DEFAULT_wxUSE_GSTREAMER8=no
+DEFAULT_wxUSE_UIACTIONSIMULATOR=no
 
 DEFAULT_wxUSE_UNICODE_UTF8=auto
 DEFAULT_wxUSE_OPENGL=auto
 echo "${ECHO_T}$result" >&6; }
 
 
+          enablestring=
+          defaultval=$wxUSE_ALL_FEATURES
+          if test -z "$defaultval"; then
+              if test x"$enablestring" = xdisable; then
+                  defaultval=yes
+              else
+                  defaultval=no
+              fi
+          fi
+
+          { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-uiactionsim" >&5
+echo $ECHO_N "checking for --${enablestring:-enable}-uiactionsim... $ECHO_C" >&6; }
+          # Check whether --enable-uiactionsim was given.
+if test "${enable_uiactionsim+set}" = set; then
+  enableval=$enable_uiactionsim;
+                          if test "$enableval" = yes; then
+                            wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=yes'
+                          else
+                            wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=no'
+                          fi
+
+else
+
+                          wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=${'DEFAULT_wxUSE_UIACTIONSIMULATOR":-$defaultval}"
+
+fi
+
+
+          eval "$wx_cv_use_uiactionsim"
+
+          if test x"$enablestring" = xdisable; then
+            if test $wxUSE_UIACTIONSIMULATOR = no; then
+              result=yes
+            else
+              result=no
+            fi
+          else
+            result=$wxUSE_UIACTIONSIMULATOR
+          fi
+
+          { echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
+
+
 
 
           enablestring=
@@ -46306,6 +46352,13 @@ _ACEOF
 
 fi
 
+if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
+    cat >>confdefs.h <<\_ACEOF
+#define wxUSE_UIACTIONSIMULATOR 1
+_ACEOF
+
+fi
+
 
 USES_CONTROLS=0
 if test "$wxUSE_CONTROLS" = "yes"; then
index ae0063162207767a73a328af0d1f5c31c532b43e..631465a68803f4c030a351d8e0c3b5fa26afd491 100644 (file)
@@ -387,6 +387,7 @@ dnl features disabled by default
 DEFAULT_wxUSE_ACCESSIBILITY=no
 DEFAULT_wxUSE_IPV6=no
 DEFAULT_wxUSE_GSTREAMER8=no
+DEFAULT_wxUSE_UIACTIONSIMULATOR=no
 
 dnl automatic features
 DEFAULT_wxUSE_UNICODE_UTF8=auto
@@ -1013,6 +1014,7 @@ WX_ARG_FEATURE(joystick,    [  --enable-joystick       use wxJoystick], wxUSE_JO
 WX_ARG_FEATURE(metafile,    [  --enable-metafiles      use wxMetaFile (Win32 only)], wxUSE_METAFILE)
 WX_ARG_FEATURE(dragimage,   [  --enable-dragimage      use wxDragImage], wxUSE_DRAGIMAGE)
 WX_ARG_FEATURE(accessibility,[  --enable-accessibility  enable accessibility support], wxUSE_ACCESSIBILITY)
+WX_ARG_FEATURE(uiactionsim,  [  --enable-uiactionsim    use wxUIActionSimulator (experimental)], wxUSE_UIACTIONSIMULATOR)
 
 dnl ---------------------------------------------------------------------------
 dnl support for image formats that do not rely on external library
@@ -6719,6 +6721,10 @@ if test "$wxUSE_MOUSEWHEEL" = "yes" ; then
   AC_DEFINE(wxUSE_MOUSEWHEEL)
 fi
 
+if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
+    AC_DEFINE(wxUSE_UIACTIONSIMULATOR)
+fi
+
 dnl ---------------------------------------------------------------------------
 dnl GUI controls
 dnl ---------------------------------------------------------------------------
index eb67a29a56968c82bd4dbd48eac1c6744fb1e2ff..38210b3e7554dfcd5d57df95be400bc446e31cc5 100644 (file)
 #   endif
 #endif /* !defined(wxUSE_TREECTRL) */
 
+#ifndef wxUSE_UIACTIONSIMULATOR
+#   ifdef wxABORT_ON_CONFIG_ERROR
+#       error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file."
+#   else
+#       define wxUSE_UIACTIONSIMULATOR 0
+#   endif
+#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */
+
 #ifndef wxUSE_VALIDATORS
 #   ifdef wxABORT_ON_CONFIG_ERROR
 #       error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file."
index 04353f0718d63b22fc340e395168979cd0077cd1..22177951f1bb4b37be1affa9a09476aceeedae75 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 97783379d8a4e81687e74c4f34c4c8e8381c6fb5..0391162f33af23e0429fb65ea2427b1fdb41fe78 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 79c6855a1ccfb04230f4bdf7f9c6af6cf0784923..615d2fa542dd32b3175407a7426923690b3259d1 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 77c87b7770d11399c18a84fe9ea563cd6b251343..b3d9ee1af8f4703d7312271259b6c656a7da2b49 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 87a34d35f97245022be3a192806245355150b88b..53c43ce1008050cb691b0e9ac17c8402468f6d8a 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 3d2bcaccb2e448aacc079f05edbe67b545b66b8c..5a235c70e11c688230086614a92a4258b229e585 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index 0cac75e3beda8470d53f62aaa467ead06eb39eda..fbeb660e29f6ecbc34a51519dc0077f67f232d86 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index ebce484040bcd7cbc25d3536a3eae0282d0dd598..a11bb347eb988015b4c55b26e9efa75548397233 100644 (file)
@@ -9,19 +9,22 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifndef _UIACTIONSIMULATOR_H_
-#define _UIACTIONSIMULATOR_H_
+#ifndef _WX_UIACTIONSIMULATOR_H_
+#define _WX_UIACTIONSIMULATOR_H_
 
-#include <wx/defs.h>
-#include <wx/event.h>
-#include <wx/dynarray.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/event.h"
+#include "wx/dynarray.h"
 
 class WXDLLIMPEXP_CORE wxUIActionSimulator
 {
 public:
     wxUIActionSimulator();
     ~wxUIActionSimulator();
-    
+
     // Mouse related
     bool        MouseMove(long x, long y);
     bool        MouseDown(int button = wxMOUSE_BTN_LEFT);
@@ -29,23 +32,25 @@ public:
     bool        MouseClick(int button = wxMOUSE_BTN_LEFT);
     bool        MouseDblClick(int button = wxMOUSE_BTN_LEFT);
     bool        MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT);
-    
+
     // Keyboard related:
 
     bool        KeyDown(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false)
                     { return Key(keycode, true, shiftDown, cmdDown, altDown); }
-    
+
     bool        KeyUp(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false)
                     { return Key(keycode, false, shiftDown, cmdDown, altDown); }
-    
+
     bool        Char(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
 
 protected:
     // Implementation-wise, since key events take more code to set up on GTK and Mac, it makes
     // sense to handle both key down and key up in one method. However, I wanted the API for pressing
-    // and releasing the mouse and keyboard to be consistent, and I don't really like using a bool 
-    // for pressed state, so I'm leaving this as an implementation detail. 
+    // and releasing the mouse and keyboard to be consistent, and I don't really like using a bool
+    // for pressed state, so I'm leaving this as an implementation detail.
     bool        Key(int keycode, bool isDown=true, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
 };
 
-#endif
+#endif // wxUSE_UIACTIONSIMULATOR
+
+#endif // _WX_UIACTIONSIMULATOR_H_
index 2e7d33f3fa6e98d57b2ee418bc23b228a24b087d..de3c88b727f2e8b1fa664b583f93220927a2ae4a 100644 (file)
 #define wxUSE_MOUSEWHEEL        1
                                 // Include mouse wheel support
 
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
 // ----------------------------------------------------------------------------
 // wxDC classes for various output formats
 // ----------------------------------------------------------------------------
index cc8ad98e31cd58d55b03978fb6c22c5adbf4f549..83eb71bdcb9a3cc6da7d85defec29bb995b64f59 100644 (file)
     @class wxUIActionSimulator
 
     wxUIActionSimulator is a class used to simulate user interface actions
-    such as a mouse click or a key press. 
-    
+    such as a mouse click or a key press.
+
+    @note that this class is currently experimental and disabled by default,
+    you must set @c wxUSE_UIACTIONSIMULATOR to 1 in your setup.h file or use
+    configure @c --enable-uiactionsim option to enable it.
+
     Common usages for this class would be to provide playback and record (aka macro recording)
     functionality for users, or to drive unit tests by simulating user sessions.
-    
+
     See the uiaction sample for example usage of this class.
-    
+
     NOTE: For keyboard operations, currently you must pass the keycode of the actual
     key on the keyboard. To simulate, e.g. IME actions, you'd need to simulate the actual
     keypresses needed to active the IME, then the keypresses needed to type and select
     the desired character.
-    
+
     @library{wxcore}
 */
 
@@ -33,43 +37,43 @@ class wxUIActionSimulator
     */
     wxUIActionSimulator();
     ~wxUIActionSimulator();
-    
+
     /**
         Move the mouse to the specified coordinates.
-        
+
         @param x
             x coordinate to move to, in screen coordinates.
-            
+
         @param y
             y coordinate to move to, in screen coordinates.
     */
     bool        MouseMove(long x, long y);
-    
+
     /**
         Press a mouse button.
-        
+
         @param button
             Button to press. Valid constants are wxMOUSE_BTN_LEFT, wxMOUSE_BTN_MIDDLE, and wxMOUSE_BTN_RIGHT.
     */
     bool        MouseDown(int button = wxMOUSE_BTN_LEFT);
-    
+
     /**
         Release a mouse button.
-        
+
         @param button
             Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
     */
     bool        MouseUp(int button = wxMOUSE_BTN_LEFT);
     /**
         Click a mouse button.
-        
+
         @param button
             Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
     */
     bool        MouseClick(int button = wxMOUSE_BTN_LEFT);
     /**
         Double-click a mouse button.
-        
+
         @param button
             Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
     */
@@ -77,70 +81,70 @@ class wxUIActionSimulator
 
     /**
         Perform a drag and drop operation.
-        
+
         @param x1
             x start coordinate, in screen coordinates.
-        
+
         @param y1
             y start coordinate, in screen coordinates.
-            
+
         @param x2
             x desintation coordinate, in screen coordinates.
-        
+
         @param y2
             y destination coordinate, in screen coordinates.
-        
+
         @param button
             Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
     */
     bool        MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT);
-    
+
     /**
-        Press a key. 
-        
+        Press a key.
+
         @param keycode
             key to operate on, as an integer.
-            
+
         @param shiftDown
             true if the shift key should be pressed, false otherwise.
-            
+
         @param cmdDown
             true if the cmd key should be pressed, false otherwise.
-            
+
         @param altDown
             true if the alt key should be pressed, false otherwise.
     */
     bool        KeyDown(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
-    
+
     /**
-        Release a key. 
-        
+        Release a key.
+
         @param keycode
             key to operate on, as an integer.
-        
+
         @param shiftDown
             true if the shift key should be pressed, false otherwise.
-            
+
         @param cmdDown
             true if the cmd key should be pressed, false otherwise.
-            
+
         @param altDown
             true if the alt key should be pressed, false otherwise.
     */
     bool        KeyUp(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
-    
+
     /**
-        Press and release a key. 
-        
+        Press and release a key.
+
         @param keycode
             key to operate on, as an integer.
-            
+
         @param shiftDown
             true if the shift key should be pressed, false otherwise.
-            
+
         @param cmdDown
             true if the cmd key should be pressed, false otherwise.
-            
+
         @param altDown
             true if the alt key should be pressed, false otherwise.
     */
index 86a6729d4057d0cc5991129853deb84e4f4d9110..b08767fdd3bba581ad859ea661f3e59a06d00f90 100644 (file)
@@ -24,6 +24,8 @@
     #pragma hdrstop
 #endif
 
+#if wxUSE_UIACTIONSIMULATOR
+
 // for all others, include the necessary headers (this file is usually all you
 // need because it includes almost all "standard" wxWidgets headers)
 #ifndef WX_PRECOMP
@@ -164,3 +166,5 @@ void MyFrame::OnButtonPressed(wxCommandEvent&)
 {
     m_buttonPressed = true;
 }
+
+#endif // wxUSE_UIACTIONSIMULATOR
index 74d7911cf9916b568802f8c8e14b6ad1553be7ce..9ce60367b4b3d73d0a8abe318f39364cd1a2da0f 100644 (file)
 #define wxUSE_MOUSEWHEEL        0
 
 
+#define wxUSE_UIACTIONSIMULATOR 0
+
 
 #define wxUSE_POSTSCRIPT  0
 
index 52747d12840687cc3d475dd6d1663c74f5e5f1bc..20c4141cab6787e00e926e48d7f6867364fb2f3b 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "wx/wxprec.h"
 
+#if wxUSE_UIACTIONSIMULATOR
+
 #include "wx/uiaction.h"
 
 wxUIActionSimulator::wxUIActionSimulator()
@@ -22,21 +24,21 @@ wxUIActionSimulator::~wxUIActionSimulator()
 }
 
 
-bool wxUIActionSimulator::MouseClick(int button) 
+bool wxUIActionSimulator::MouseClick(int button)
 {
     MouseDown(button);
     MouseUp(button);
-    
+
     return true;
 }
 
-bool wxUIActionSimulator::MouseDblClick(int button) 
+bool wxUIActionSimulator::MouseDblClick(int button)
 {
     MouseDown(button);
     MouseUp(button);
     MouseDown(button);
     MouseUp(button);
-    
+
     return true;
 }
 
@@ -44,9 +46,9 @@ bool wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2, int
 {
     MouseMove(x1, y1);
     MouseDown(button);
-    MouseMove(x2, y2);    
+    MouseMove(x2, y2);
     MouseUp(button);
-    
+
     return true;
 }
 
@@ -54,6 +56,8 @@ bool  wxUIActionSimulator::Char(int keycode, bool shiftDown, bool cmdDown, bool
 {
     Key(keycode, false, shiftDown, cmdDown, altDown);
     Key(keycode, true, shiftDown, cmdDown, altDown);
-    
+
     return true;
-} 
+}
+
+#endif // wxUSE_UIACTIONSIMULATOR
index 6bbbf1abdc1f17675e7ce1afe6ea4d1de4c4a4b6..d421b9a18f993515499029e3dd6f9f6e75c562e3 100644 (file)
 
 #include "wx/wxprec.h"
 
-#ifndef WX_PRECOMP
-#include "wx/defs.h"
-#endif
+#if wxUSE_UIACTIONSIMULATOR
 
 #include "wx/uiaction.h"
 
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
 
 DWORD EventTypeForMouseButton(int button, bool isDown)
 {
@@ -38,7 +36,7 @@ DWORD EventTypeForMouseButton(int button, bool isDown)
                 return MOUSEEVENTF_MIDDLEDOWN;
             else
                 return MOUSEEVENTF_MIDDLEUP;
-            
+
         default:
             wxFAIL_MSG("Unsupported button passed in.");
             return -1;
@@ -54,7 +52,7 @@ bool wxUIActionSimulator::MouseDown(int button)
 }
 
 bool wxUIActionSimulator::MouseMove(long x, long y)
-{   
+{
     mouse_event(MOUSEEVENTF_MOVE, x, y, 0, 0);
     return true;
 }
@@ -76,3 +74,4 @@ bool wxUIActionSimulator::Key(int keycode, bool isDown, bool shiftDown, bool cmd
     return true;
 }
 
+#endif // wxUSE_UIACTIONSIMULATOR
index bd4afa12c12ae2cdc909bc7f0e7e752920d1a83b..603b3039774b9678b0708c76dbc42d206f1c777a 100644 (file)
@@ -9,8 +9,11 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include <wx/defs.h>
-#include <wx/uiaction.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/uiaction.h"
 
 #include <ApplicationServices/ApplicationServices.h>
 
@@ -30,9 +33,9 @@ CGEventType CGEventTypeForMouseButton(int button, bool isDown)
                 return kCGEventRightMouseDown;
             else
                 return kCGEventRightMouseUp;
-                
-        // Apparently all other buttons use the constant OtherMouseDown 
-            
+
+        // Apparently all other buttons use the constant OtherMouseDown
+
         default:
             if (isDown)
                 return kCGEventOtherMouseDown;
@@ -55,13 +58,13 @@ bool wxUIActionSimulator::MouseDown(int button)
 {
     CGPoint pos;
     int x, y;
-    wxGetMousePosition(&x, &y); 
+    wxGetMousePosition(&x, &y);
     pos.x = x;
     pos.y = y;
     CGEventType type = CGEventTypeForMouseButton(button, true);
     CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, button);
     CGEventSetType(event, type);
-    
+
     if (event)
     {
         CGEventPost(tap, event);
@@ -78,13 +81,13 @@ bool wxUIActionSimulator::MouseMove(long x, long y)
     CGEventType type = kCGEventMouseMoved;
     CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, kCGMouseButtonLeft);
     CGEventSetType(event, type);
-    
+
     if (event)
     {
         CGEventPost(tap, event);
     }
     CFRelease(event);
-    
+
     return true;
 }
 
@@ -92,13 +95,13 @@ bool wxUIActionSimulator::MouseUp(int button)
 {
     CGPoint pos;
     int x, y;
-    wxGetMousePosition(&x, &y); 
+    wxGetMousePosition(&x, &y);
     pos.x = x;
     pos.y = y;
     CGEventType type = CGEventTypeForMouseButton(button, false);
     CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, button);
     CGEventSetType(event, type);
-    
+
     if (event)
     {
         CGEventPost(tap, event);
@@ -125,8 +128,9 @@ bool wxUIActionSimulator::Key(int keycode, bool isDown, bool shiftDown, bool cmd
         SendCharCode((CGCharCode)58, false);
     if (cmdDown)
         SendCharCode((CGCharCode)55, false);
-    
+
     return true;
 }
 
+#endif // wxUSE_UIACTIONSIMULATOR
 
index 05497efa036a6e36ba5b2fe37f7339de2b70ded7..778e9bbc38c1d112a752bb0a7566f1a491e32513 100644 (file)
@@ -9,8 +9,11 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include <wx/defs.h>
-#include <wx/uiaction.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/uiaction.h"
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -35,12 +38,12 @@ void SendButtonEvent(int button, bool isDown)
     }
 
     XEvent event;
-    
+
     Display *display = XOpenDisplay(0);
     wxASSERT_MSG(display, "No display available!");
-    
+
     memset(&event, 0x00, sizeof(event));
-    
+
     if (isDown)
         event.type = ButtonPress;
     else
@@ -48,16 +51,16 @@ void SendButtonEvent(int button, bool isDown)
 
     event.xbutton.button = xbutton;
     event.xbutton.same_screen = True;
-    
+
     XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &event.xbutton.root, &event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
     event.xbutton.subwindow = event.xbutton.window;
-    
+
     while (event.xbutton.subwindow)
     {
         event.xbutton.window = event.xbutton.subwindow;
         XQueryPointer(display, event.xbutton.window, &event.xbutton.root, &event.xbutton.subwindow, &event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
     }
-    
+
     XSendEvent(display, PointerWindow, True, 0xfff, &event);
     XFlush(display);
     XCloseDisplay(display);
@@ -70,7 +73,7 @@ bool wxUIActionSimulator::MouseDown(int button)
 }
 
 bool wxUIActionSimulator::MouseMove(long x, long y)
-{   
+{
     Display *display = XOpenDisplay(0);
     wxASSERT_MSG(display, "No display available!");
     Window root = DefaultRootWindow(display);
@@ -90,11 +93,11 @@ bool wxUIActionSimulator::Key(int keycode, bool isDown, bool WXUNUSED(shiftDown)
 {
     Display *display = XOpenDisplay(0);
     wxASSERT_MSG(display, "No display available!");
-    
+
     XKeyEvent event;
     int mask = 0xfff;
     memset(&event, 0x00, sizeof(event));
-    
+
     if (isDown) {
         event.type = KeyPress;
         mask = KeyPressMask;
@@ -104,16 +107,16 @@ bool wxUIActionSimulator::Key(int keycode, bool isDown, bool WXUNUSED(shiftDown)
         mask = KeyReleaseMask;
     }
     event.same_screen = True;
-    
+
     XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &event.root, &event.window, &event.x_root, &event.y_root, &event.x, &event.y, &event.state);
     event.subwindow = event.window;
-    
+
     while (event.subwindow)
     {
         event.window = event.subwindow;
         XQueryPointer(display, event.window, &event.root, &event.subwindow, &event.x_root, &event.y_root, &event.x, &event.y, &event.state);
     }
-    
+
     XSendEvent(display, PointerWindow, True, mask, (XEvent*) &event);
     XFlush(display);
     XCloseDisplay(display);
@@ -121,3 +124,4 @@ bool wxUIActionSimulator::Key(int keycode, bool isDown, bool WXUNUSED(shiftDown)
     return true;
 }
 
+#endif // wxUSE_UIACTIONSIMULATOR