From 8801366f085da667d5fcc4bd229d53c2731780a2 Mon Sep 17 00:00:00 2001 From: Dustin Bensing Date: Sun, 15 Feb 2015 17:28:58 +0100 Subject: [PATCH] stuff cmake for osx ; osx xcode linux cmake --- XInputSimulator/.DS_Store | Bin 0 -> 6148 bytes XInputSimulator/.idea/.name | 1 + XInputSimulator/.idea/XInputSimulator.iml | 8 + XInputSimulator/.idea/misc.xml | 15 + XInputSimulator/.idea/modules.xml | 8 + XInputSimulator/.idea/vcs.xml | 6 + XInputSimulator/.idea/workspace.xml | 339 ++++++++++++++++++ XInputSimulator/CMakeLists.txt | 37 ++ .../XInputSimulator.xcodeproj/project.pbxproj | 293 +++++++++++++++ .../contents.xcworkspacedata | 7 + .../UserInterfaceState.xcuserstate | Bin 0 -> 16122 bytes .../xcdebugger/Breakpoints_v2.xcbkptlist | 23 ++ .../xcschemes/XInputSimulator.xcscheme | 86 +++++ .../xcschemes/xcschememanagement.plist | 22 ++ XInputSimulator/XInputSimulator/.DS_Store | Bin 0 -> 6148 bytes XInputSimulator/main.cpp | 55 +-- XInputSimulator/xinputsimulator.h | 1 + XInputSimulator/xinputsimulatorimpllinux.cpp | 15 +- XInputSimulator/xinputsimulatorimplmacos.cpp | 100 +++++- 19 files changed, 978 insertions(+), 38 deletions(-) create mode 100644 XInputSimulator/.DS_Store create mode 100644 XInputSimulator/.idea/.name create mode 100644 XInputSimulator/.idea/XInputSimulator.iml create mode 100644 XInputSimulator/.idea/misc.xml create mode 100644 XInputSimulator/.idea/modules.xml create mode 100644 XInputSimulator/.idea/vcs.xml create mode 100644 XInputSimulator/.idea/workspace.xml create mode 100644 XInputSimulator/CMakeLists.txt create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/project.pbxproj create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/xcuserdata/naikon.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/XInputSimulator.xcscheme create mode 100644 XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 XInputSimulator/XInputSimulator/.DS_Store diff --git a/XInputSimulator/.DS_Store b/XInputSimulator/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 + + + + + + + \ No newline at end of file diff --git a/XInputSimulator/.idea/misc.xml b/XInputSimulator/.idea/misc.xml new file mode 100644 index 0000000..9601a91 --- /dev/null +++ b/XInputSimulator/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/XInputSimulator/.idea/modules.xml b/XInputSimulator/.idea/modules.xml new file mode 100644 index 0000000..83ec3aa --- /dev/null +++ b/XInputSimulator/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/XInputSimulator/.idea/vcs.xml b/XInputSimulator/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/XInputSimulator/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/XInputSimulator/.idea/workspace.xml b/XInputSimulator/.idea/workspace.xml new file mode 100644 index 0000000..09d9f31 --- /dev/null +++ b/XInputSimulator/.idea/workspace.xml @@ -0,0 +1,339 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1423944103583 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/XInputSimulator/CMakeLists.txt b/XInputSimulator/CMakeLists.txt new file mode 100644 index 0000000..8e2b620 --- /dev/null +++ b/XInputSimulator/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 2.8.4) +project(XInputSimulator) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +set(SOURCE_FILES + main.cpp + notimplementedexception.cpp + notimplementedexception.h + xinputsimulator.cpp + xinputsimulator.h + xinputsimulatorimpl.cpp + xinputsimulatorimpl.h + xinputsimulatorimpllinux.cpp + xinputsimulatorimpllinux.h + xinputsimulatorimplmacos.cpp + xinputsimulatorimplmacos.h + xinputsimulatorimplwin.cpp + xinputsimulatorimplwin.h) + + # Linux + if(UNIX AND NOT APPLE) + find_library(X_11 X11) + find_library(X_TST Xtst) + set(EXTRA_LIBS ${X_11} ${X_TST}) + endif(UNIX AND NOT APPLE) + + # Apple + if(APPLE) + find_library(APP_SERVICES ApplicationServices) + find_library(CARBON Carbon) + find_library(CORE_FOUNDATION CoreFoundation ) + set(EXTRA_LIBS ${APP_SERVICES_LIBRARY} ${CARBON} ${CORE_FOUNDATION}) + endif(APPLE) + +add_executable(XInputSimulator ${SOURCE_FILES}) +target_link_libraries(XInputSimulator ${EXTRA_LIBS} ) \ No newline at end of file diff --git a/XInputSimulator/XInputSimulator.xcodeproj/project.pbxproj b/XInputSimulator/XInputSimulator.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5390d98 --- /dev/null +++ b/XInputSimulator/XInputSimulator.xcodeproj/project.pbxproj @@ -0,0 +1,293 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + D2C6A1F61A8FD9E900CAA80C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1E81A8FD9E900CAA80C /* main.cpp */; }; + D2C6A1F71A8FD9E900CAA80C /* notimplementedexception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1E91A8FD9E900CAA80C /* notimplementedexception.cpp */; }; + D2C6A1F81A8FD9E900CAA80C /* xinputsimulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1EB1A8FD9E900CAA80C /* xinputsimulator.cpp */; }; + D2C6A1F91A8FD9E900CAA80C /* xinputsimulatorimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1EE1A8FD9E900CAA80C /* xinputsimulatorimpl.cpp */; }; + D2C6A1FA1A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1F01A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp */; }; + D2C6A1FB1A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1F21A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp */; }; + D2C6A1FC1A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D2C6A1F41A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp */; }; + D2C6A1FE1A8FDBF400CAA80C /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C6A1FD1A8FDBF400CAA80C /* ApplicationServices.framework */; }; + D2C6A2001A8FF30700CAA80C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C6A1FF1A8FF30700CAA80C /* Carbon.framework */; }; + D2C6A2021A8FF33300CAA80C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2C6A2011A8FF33300CAA80C /* CoreFoundation.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D2C6A1D81A8FD8CF00CAA80C /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + D2C6A1DA1A8FD8CF00CAA80C /* XInputSimulator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = XInputSimulator; sourceTree = BUILT_PRODUCTS_DIR; }; + D2C6A1E61A8FD9E900CAA80C /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; + D2C6A1E71A8FD9E900CAA80C /* COPYING.LESSER */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING.LESSER; sourceTree = ""; }; + D2C6A1E81A8FD9E900CAA80C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + D2C6A1E91A8FD9E900CAA80C /* notimplementedexception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = notimplementedexception.cpp; sourceTree = ""; }; + D2C6A1EA1A8FD9E900CAA80C /* notimplementedexception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notimplementedexception.h; sourceTree = ""; }; + D2C6A1EB1A8FD9E900CAA80C /* xinputsimulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulator.cpp; sourceTree = ""; }; + D2C6A1EC1A8FD9E900CAA80C /* xinputsimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulator.h; sourceTree = ""; }; + D2C6A1ED1A8FD9E900CAA80C /* XInputSimulator.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XInputSimulator.pro; sourceTree = ""; }; + D2C6A1EE1A8FD9E900CAA80C /* xinputsimulatorimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimpl.cpp; sourceTree = ""; }; + D2C6A1EF1A8FD9E900CAA80C /* xinputsimulatorimpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimpl.h; sourceTree = ""; }; + D2C6A1F01A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimpllinux.cpp; sourceTree = ""; }; + D2C6A1F11A8FD9E900CAA80C /* xinputsimulatorimpllinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimpllinux.h; sourceTree = ""; }; + D2C6A1F21A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimplmacos.cpp; sourceTree = ""; }; + D2C6A1F31A8FD9E900CAA80C /* xinputsimulatorimplmacos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimplmacos.h; sourceTree = ""; }; + D2C6A1F41A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimplwin.cpp; sourceTree = ""; }; + D2C6A1F51A8FD9E900CAA80C /* xinputsimulatorimplwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimplwin.h; sourceTree = ""; }; + D2C6A1FD1A8FDBF400CAA80C /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; + D2C6A1FF1A8FF30700CAA80C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; + D2C6A2011A8FF33300CAA80C /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D2C6A1D71A8FD8CF00CAA80C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D2C6A2021A8FF33300CAA80C /* CoreFoundation.framework in Frameworks */, + D2C6A2001A8FF30700CAA80C /* Carbon.framework in Frameworks */, + D2C6A1FE1A8FDBF400CAA80C /* ApplicationServices.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D2C6A1D11A8FD8CF00CAA80C = { + isa = PBXGroup; + children = ( + D2C6A2011A8FF33300CAA80C /* CoreFoundation.framework */, + D2C6A1FF1A8FF30700CAA80C /* Carbon.framework */, + D2C6A1FD1A8FDBF400CAA80C /* ApplicationServices.framework */, + D2C6A1E61A8FD9E900CAA80C /* COPYING */, + D2C6A1E71A8FD9E900CAA80C /* COPYING.LESSER */, + D2C6A1E81A8FD9E900CAA80C /* main.cpp */, + D2C6A1E91A8FD9E900CAA80C /* notimplementedexception.cpp */, + D2C6A1EA1A8FD9E900CAA80C /* notimplementedexception.h */, + D2C6A1EB1A8FD9E900CAA80C /* xinputsimulator.cpp */, + D2C6A1EC1A8FD9E900CAA80C /* xinputsimulator.h */, + D2C6A1ED1A8FD9E900CAA80C /* XInputSimulator.pro */, + D2C6A1EE1A8FD9E900CAA80C /* xinputsimulatorimpl.cpp */, + D2C6A1EF1A8FD9E900CAA80C /* xinputsimulatorimpl.h */, + D2C6A1F01A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp */, + D2C6A1F11A8FD9E900CAA80C /* xinputsimulatorimpllinux.h */, + D2C6A1F21A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp */, + D2C6A1F31A8FD9E900CAA80C /* xinputsimulatorimplmacos.h */, + D2C6A1F41A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp */, + D2C6A1F51A8FD9E900CAA80C /* xinputsimulatorimplwin.h */, + D2C6A1DC1A8FD8CF00CAA80C /* XInputSimulator */, + D2C6A1DB1A8FD8CF00CAA80C /* Products */, + ); + sourceTree = ""; + }; + D2C6A1DB1A8FD8CF00CAA80C /* Products */ = { + isa = PBXGroup; + children = ( + D2C6A1DA1A8FD8CF00CAA80C /* XInputSimulator */, + ); + name = Products; + sourceTree = ""; + }; + D2C6A1DC1A8FD8CF00CAA80C /* XInputSimulator */ = { + isa = PBXGroup; + children = ( + ); + path = XInputSimulator; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D2C6A1D91A8FD8CF00CAA80C /* XInputSimulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = D2C6A1E11A8FD8CF00CAA80C /* Build configuration list for PBXNativeTarget "XInputSimulator" */; + buildPhases = ( + D2C6A1D61A8FD8CF00CAA80C /* Sources */, + D2C6A1D71A8FD8CF00CAA80C /* Frameworks */, + D2C6A1D81A8FD8CF00CAA80C /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = XInputSimulator; + productName = XInputSimulator; + productReference = D2C6A1DA1A8FD8CF00CAA80C /* XInputSimulator */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D2C6A1D21A8FD8CF00CAA80C /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = "Peter Mueller inc."; + TargetAttributes = { + D2C6A1D91A8FD8CF00CAA80C = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = D2C6A1D51A8FD8CF00CAA80C /* Build configuration list for PBXProject "XInputSimulator" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = D2C6A1D11A8FD8CF00CAA80C; + productRefGroup = D2C6A1DB1A8FD8CF00CAA80C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D2C6A1D91A8FD8CF00CAA80C /* XInputSimulator */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + D2C6A1D61A8FD8CF00CAA80C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D2C6A1FB1A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp in Sources */, + D2C6A1F81A8FD9E900CAA80C /* xinputsimulator.cpp in Sources */, + D2C6A1F71A8FD9E900CAA80C /* notimplementedexception.cpp in Sources */, + D2C6A1F91A8FD9E900CAA80C /* xinputsimulatorimpl.cpp in Sources */, + D2C6A1FA1A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp in Sources */, + D2C6A1FC1A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp in Sources */, + D2C6A1F61A8FD9E900CAA80C /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D2C6A1DF1A8FD8CF00CAA80C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + D2C6A1E01A8FD8CF00CAA80C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + D2C6A1E21A8FD8CF00CAA80C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + D2C6A1E31A8FD8CF00CAA80C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D2C6A1D51A8FD8CF00CAA80C /* Build configuration list for PBXProject "XInputSimulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D2C6A1DF1A8FD8CF00CAA80C /* Debug */, + D2C6A1E01A8FD8CF00CAA80C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D2C6A1E11A8FD8CF00CAA80C /* Build configuration list for PBXNativeTarget "XInputSimulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D2C6A1E21A8FD8CF00CAA80C /* Debug */, + D2C6A1E31A8FD8CF00CAA80C /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = D2C6A1D21A8FD8CF00CAA80C /* Project object */; +} diff --git a/XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..41fcde0 --- /dev/null +++ b/XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/xcuserdata/naikon.xcuserdatad/UserInterfaceState.xcuserstate b/XInputSimulator/XInputSimulator.xcodeproj/project.xcworkspace/xcuserdata/naikon.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..216aaf3c71e63e02b2dfed69fdf1a92ca1f6544c GIT binary patch literal 16122 zcmcJ031Cyz(*Id*y0@fF(l*ePq)D5!O`4@U$kG*%tI_bA;}RD%*BJbs_5_44 z-nu6quS4M|0x6IZsgMQbAS<#VJ9400l!x+B0V+gAs1%isF2qIn zJUj-M;8I+PC*a9=3a-L4@GM-5=i+&|885*uycD-!H|oZ1cm-aGSK-xo1HKerhBx9H z@QwH;df#*%SlJSiciq>M}@)5vsEMdp%u zWIkCyn#mI4BCTW@5y%B(9l4NPgw~Ra$))6Sas|1PTtl{!?c{c{lk6h*kSEDgD&ERHo)m#lXi>u{k zb91;Rj^`G0&D=81%Pr?tb8EN@xQn?%F<<- zGK(xn=8zT2M$5*{GPHHL-A7R*ibByS1`R_Av!_+(wD8@&x$qf0L$!uRx6|kAL9r-~ z5k`BE9K|z^Jc)eEN&M{LwaOD=_mskkqKp@ER@BDF*&=OUBRwmTiGG@G;_m$BY?e9FYjz=_qf{p zzLG}2tJCS{o9gAm%lXC54!6Ie$>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2v_&6sP6t7-t*j8W$KB85@j#qhP$)xWTy5 zc$IOp@p|Kp#=DHWjSm?gF+Og5()hITS>rL|YsS}&ZyHY+e>a{n5tGamVTv*(nTDG* zCapI`%oUldGg;=k%!@NOWZs;4Yv#7h-pt!G@66nld3WaC%>9}7XCBV{DDy;C zSXO+NG3)%Sg;}nw&aCdNRatAZF37qtYj@T|S&w8rp7mtb(^=1Ey^!@*)`wZ2WF61? zGV8mnAF@tm{gU-tc1HHt?Aq-5?1pSUyE)sRy)OIW>GCoP;sYtdUWESVOwCC9SJ;n%4~Zn4~E z* z)--FjHOFeV=2|CP=UAQACTp{GskPPGY3;VIvaYcT)^*m6*6Xa>tPfeAvA%3QVtvi} zru7}`r`F@vFRWi%zpvK z_WSJz?T^}@us>-(W`EEAt%Eu=jv~is#~83gLk+cU5+h|I~_Y6yB&KR_d1?+ zJm+}P@rvW9<2A?oj!zuN9bY=WcKqTv?f5en=f>s6=PGg&b4|JVxkb67bI0V?=GNuT z%UzheDA$$i&h_Lj%UzMXJ$GmB(cE|QNM1O+i8wB=Jn#HK1cV5YK4lZ6&(QC@DgO_u C<`$d) literal 0 HcmV?d00001 diff --git a/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..1d789d4 --- /dev/null +++ b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/XInputSimulator.xcscheme b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/XInputSimulator.xcscheme new file mode 100644 index 0000000..12048d2 --- /dev/null +++ b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/XInputSimulator.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/xcschememanagement.plist b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..649d2c3 --- /dev/null +++ b/XInputSimulator/XInputSimulator.xcodeproj/xcuserdata/naikon.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + XInputSimulator.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + D2C6A1D91A8FD8CF00CAA80C + + primary + + + + + diff --git a/XInputSimulator/XInputSimulator/.DS_Store b/XInputSimulator/XInputSimulator/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0charToKeyCode(c); std::cout << "key code: " << keyCode << std::endl; - this->keyClick(keyCode); + + if (isupper(c)) { + std::cout << "upper " << c << std::endl; + + this->keyDown(XKeysymToKeycode(display, XK_Shift_L)); + this->keyClick(keyCode); + this->keyUp(XKeysymToKeycode(display, XK_Shift_L)); + } + else { + this->keyClick(keyCode); + } + + std::cout << std::endl; } diff --git a/XInputSimulator/xinputsimulatorimplmacos.cpp b/XInputSimulator/xinputsimulatorimplmacos.cpp index ea56afe..f4ebf9d 100644 --- a/XInputSimulator/xinputsimulatorimplmacos.cpp +++ b/XInputSimulator/xinputsimulatorimplmacos.cpp @@ -20,16 +20,13 @@ #include -//quartz CG... stuff -#include - //sleep #include #include "xinputsimulatorimplmacos.h" #include "notimplementedexception.h" -#include +//#include XInputSimulatorImplMacOs::XInputSimulatorImplMacOs() @@ -83,7 +80,7 @@ void XInputSimulatorImplMacOs::mouseMoveRelative(int x, int y) if(newX < 0 || newX > this->displayX || newY < 0 || newY > this->displayY ) { - std::cout << "mouse moved beyound screensize." << endl; + std::cout << "mouse moved beyound screensize." << std::endl; return; } @@ -193,26 +190,109 @@ void XInputSimulatorImplMacOs::mouseScrollY(int length) void XInputSimulatorImplMacOs::keyDown(int key) { - throw NotImplementedException(); + CGKeyCode keycode = key; + CGEventRef commandDown = CGEventCreateKeyboardEvent(NULL, keycode, true); + CGEventPost(kCGAnnotatedSessionEventTap, commandDown); + CFRelease(commandDown); } void XInputSimulatorImplMacOs::keyUp(int key) { - throw NotImplementedException(); + CGKeyCode keycode = key; + CGEventRef commandUp = CGEventCreateKeyboardEvent(NULL, keycode, false); + CGEventPost(kCGAnnotatedSessionEventTap, commandUp); + CFRelease(commandUp); } void XInputSimulatorImplMacOs::keyClick(int key) { - throw NotImplementedException(); + std::cout << "key click: " << key << std::endl; + + this->keyDown(key); + this->keyUp(key); +} + +CFStringRef XInputSimulatorImplMacOs::createStringForKey(CGKeyCode keyCode) +{ + TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); + //CFDataRef layoutData = TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); + CFDataRef layoutData = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); + + const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); + + UInt32 keysDown = 0; + UniChar chars[4]; + UniCharCount realLength; + + UCKeyTranslate(keyboardLayout, + keyCode, + kUCKeyActionDisplay, + 0, + LMGetKbdType(), + kUCKeyTranslateNoDeadKeysBit, + &keysDown, + sizeof(chars) / sizeof(chars[0]), + &realLength, + chars); + + CFRelease(currentKeyboard); + + return CFStringCreateWithCharacters(kCFAllocatorDefault, chars, 1); + + return NULL; } int XInputSimulatorImplMacOs::charToKeyCode(char key_char) { - throw NotImplementedException(); + static CFMutableDictionaryRef charToCodeDict = NULL; + CGKeyCode code; + UniChar character = key_char; + CFStringRef charStr = NULL; + + /* Generate table of keycodes and characters. */ + if (charToCodeDict == NULL) { + size_t i; + charToCodeDict = CFDictionaryCreateMutable(kCFAllocatorDefault, + 128, + &kCFCopyStringDictionaryKeyCallBacks, + NULL); + if (charToCodeDict == NULL) return UINT16_MAX; + + /* Loop through every keycode (0 - 127) to find its current mapping. */ + for (i = 0; i < 128; ++i) { + CFStringRef string = createStringForKey((CGKeyCode)i); + if (string != NULL) { + CFDictionaryAddValue(charToCodeDict, string, (const void *)i); + CFRelease(string); + } + } + } + + charStr = CFStringCreateWithCharacters(kCFAllocatorDefault, &character, 1); + + /* Our values may be NULL (0), so we need to use this function. */ + if (!CFDictionaryGetValueIfPresent(charToCodeDict, + charStr, + (const void **)&code)) { + code = UINT16_MAX; + } + + CFRelease(charStr); + return code; } void XInputSimulatorImplMacOs::keySequence(const std::string &sequence) { - throw NotImplementedException(); + std::cout << "key seq: " << sequence << std::endl; + + for(const char c : sequence) { + std::cout << "cahr: " << c << std::endl; + int keyCode = this->charToKeyCode(c); + std::cout << "key code: " << keyCode << std::endl; + this->keyClick(keyCode); + std::cout << std::endl; + } + + //throw NotImplementedException(); } #endif //apple