cmake for osx ; osx xcode

linux cmake
This commit is contained in:
Dustin Bensing 2015-02-15 17:28:58 +01:00
parent 958fdfeda9
commit 8801366f08
19 changed files with 978 additions and 38 deletions

BIN
XInputSimulator/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
XInputSimulator

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/XInputSimulator.iml" filepath="$PROJECT_DIR$/.idea/XInputSimulator.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,339 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeRunConfigurationManager" shouldGenerate="true">
<generated>
<config projectName="XInputSimulator" targetName="XInputSimulator" />
</generated>
</component>
<component name="CMakeSettings" AUTO_RELOAD="false" GENERATION_PASS_SYSTEM_ENVIRONMENT="true">
<ADDITIONAL_GENERATION_ENVIRONMENT>
<envs />
</ADDITIONAL_GENERATION_ENVIRONMENT>
</component>
<component name="ChangeListManager">
<list default="true" id="f00b9f57-887a-46f7-b28b-2cb0df5a921d" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/COPYING.LESSER" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/COPYING" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/XInputSimulator.pro" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/main.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/notimplementedexception.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/notimplementedexception.h" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulator.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulator.h" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimpl.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimpl.h" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimpllinux.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimpllinux.h" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimplmacos.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimplmacos.h" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimplwin.cpp" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/xinputsimulatorimplwin.h" />
<change type="DELETED" beforePath="$PROJECT_DIR$/XInputSimulator/main.cpp" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/XInputSimulator.xcodeproj/project.pbxproj" afterPath="$PROJECT_DIR$/XInputSimulator.xcodeproj/project.pbxproj" />
</list>
<ignored path="XInputSimulator.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="XInputSimulator" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="CMakeLists.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="26" column="63" selection-start-line="26" selection-start-column="63" selection-end-line="26" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.cpp" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-1.5854839">
<caret line="33" column="49" selection-start-line="33" selection-start-column="49" selection-end-line="33" selection-end-column="49" />
<folding>
<element signature="e#744#763#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Carbon.h" pinned="false" current-in-tab="false">
<entry file="file:///Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="xinputsimulatorimpllinux.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/xinputsimulatorimpllinux.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="xinputsimulatorimplmacos.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/xinputsimulatorimplmacos.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="138" column="31" selection-start-line="138" selection-start-column="31" selection-end-line="138" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="notimplementedexception.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/notimplementedexception.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="xinputsimulatorimpl.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/xinputsimulatorimpl.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="28" column="17" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="xinputsimulatorimplmacos.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/xinputsimulatorimplmacos.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="40" column="17" selection-start-line="40" selection-start-column="17" selection-end-line="40" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/main.cpp" />
</list>
</option>
</component>
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
</component>
<component name="NamedScopeManager">
<order />
</component>
<component name="ProjectFrameBounds">
<option name="y" value="23" />
<option name="width" value="1916" />
<option name="height" value="1057" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
</navigator>
<panes>
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="XInputSimulator" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="XInputSimulator" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$1$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="XInputSimulator" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="recentsLimit" value="5" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
<property name="settings.editor.splitter.proportion" value="0.2" />
</component>
<component name="RunManager" selected="Application.XInputSimulator">
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="XInputSimulator" TARGET_NAME="XInputSimulator" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<method />
</configuration>
<configuration default="false" name="XInputSimulator" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="XInputSimulator" TARGET_NAME="XInputSimulator" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Application.XInputSimulator" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="f00b9f57-887a-46f7-b28b-2cb0df5a921d" name="Default" comment="" />
<created>1423944103583</created>
<option name="number" value="Default" />
<updated>1423944103583</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1916" height="1057" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.55751294" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24940239" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.13931398" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.3284974" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="VcsManagerConfiguration">
<option name="myTodoPanelSettings">
<TodoPanelSettings />
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/xinputsimulatorimpllinux.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/xinputsimulatorimplmacos.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="40" column="17" selection-start-line="40" selection-start-column="17" selection-end-line="40" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/xinputsimulatorimpl.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="28" column="17" selection-start-line="28" selection-start-column="17" selection-end-line="28" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/xinputsimulatorimplmacos.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="138" column="31" selection-start-line="138" selection-start-column="31" selection-end-line="138" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/notimplementedexception.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="26" column="63" selection-start-line="26" selection-start-column="63" selection-end-line="26" selection-end-column="63" />
<folding />
</state>
</provider>
</entry>
<entry file="file:///Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/main.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-1.5854839">
<caret line="33" column="49" selection-start-line="33" selection-start-column="49" selection-end-line="33" selection-end-column="49" />
<folding>
<element signature="e#744#763#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -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} )

View File

@ -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 = "<group>"; };
D2C6A1E71A8FD9E900CAA80C /* COPYING.LESSER */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING.LESSER; sourceTree = "<group>"; };
D2C6A1E81A8FD9E900CAA80C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
D2C6A1E91A8FD9E900CAA80C /* notimplementedexception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = notimplementedexception.cpp; sourceTree = "<group>"; };
D2C6A1EA1A8FD9E900CAA80C /* notimplementedexception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = notimplementedexception.h; sourceTree = "<group>"; };
D2C6A1EB1A8FD9E900CAA80C /* xinputsimulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulator.cpp; sourceTree = "<group>"; };
D2C6A1EC1A8FD9E900CAA80C /* xinputsimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulator.h; sourceTree = "<group>"; };
D2C6A1ED1A8FD9E900CAA80C /* XInputSimulator.pro */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XInputSimulator.pro; sourceTree = "<group>"; };
D2C6A1EE1A8FD9E900CAA80C /* xinputsimulatorimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimpl.cpp; sourceTree = "<group>"; };
D2C6A1EF1A8FD9E900CAA80C /* xinputsimulatorimpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimpl.h; sourceTree = "<group>"; };
D2C6A1F01A8FD9E900CAA80C /* xinputsimulatorimpllinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimpllinux.cpp; sourceTree = "<group>"; };
D2C6A1F11A8FD9E900CAA80C /* xinputsimulatorimpllinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimpllinux.h; sourceTree = "<group>"; };
D2C6A1F21A8FD9E900CAA80C /* xinputsimulatorimplmacos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimplmacos.cpp; sourceTree = "<group>"; };
D2C6A1F31A8FD9E900CAA80C /* xinputsimulatorimplmacos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimplmacos.h; sourceTree = "<group>"; };
D2C6A1F41A8FD9E900CAA80C /* xinputsimulatorimplwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xinputsimulatorimplwin.cpp; sourceTree = "<group>"; };
D2C6A1F51A8FD9E900CAA80C /* xinputsimulatorimplwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xinputsimulatorimplwin.h; sourceTree = "<group>"; };
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 = "<group>";
};
D2C6A1DB1A8FD8CF00CAA80C /* Products */ = {
isa = PBXGroup;
children = (
D2C6A1DA1A8FD8CF00CAA80C /* XInputSimulator */,
);
name = Products;
sourceTree = "<group>";
};
D2C6A1DC1A8FD8CF00CAA80C /* XInputSimulator */ = {
isa = PBXGroup;
children = (
);
path = XInputSimulator;
sourceTree = "<group>";
};
/* 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 */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:XInputSimulator.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "xinputsimulatorimplmacos.h"
timestampString = "445707575.829681"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "41"
endingLineNumber = "41"
landmarkName = "class XInputSimulatorImplMacOs"
landmarkType = "3">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2C6A1D91A8FD8CF00CAA80C"
BuildableName = "XInputSimulator"
BlueprintName = "XInputSimulator"
ReferencedContainer = "container:XInputSimulator.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2C6A1D91A8FD8CF00CAA80C"
BuildableName = "XInputSimulator"
BlueprintName = "XInputSimulator"
ReferencedContainer = "container:XInputSimulator.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2C6A1D91A8FD8CF00CAA80C"
BuildableName = "XInputSimulator"
BlueprintName = "XInputSimulator"
ReferencedContainer = "container:XInputSimulator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D2C6A1D91A8FD8CF00CAA80C"
BuildableName = "XInputSimulator"
BlueprintName = "XInputSimulator"
ReferencedContainer = "container:XInputSimulator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>XInputSimulator.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>D2C6A1D91A8FD8CF00CAA80C</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

View File

@ -29,35 +29,36 @@ int main()
cout << "Hello World!" << endl;
XInputSimulator &sim = XInputSimulator::getInstance();
waitABit();
sim.mouseMoveTo(500,400);
waitABit();
sim.mouseMoveRelative(400, -100);
waitABit();
sim.mouseDown(XInputSimulator::LEFT_MOUSE_BUTTON);
waitABit();
sim.mouseMoveRelative(0, 300);
waitABit();
sim.mouseUp(XInputSimulator::LEFT_MOUSE_BUTTON);
waitABit();
//scroll down and up
sim.mouseScrollY(10);
waitABit();
sim.mouseScrollY(-10);
//scroll left and right
waitABit();
sim.mouseScrollX(10);
waitABit();
sim.mouseScrollX(-10);
// char anA = 'a';
// cout << "a: " << (int)anA << " " << sim.charToKeyCode(anA) << endl;
// std::cout << std::endl;
waitABit();
// sim.mouseMoveTo(500,400);
// waitABit();
// sim.keyClick(sim.charToKeyCode(anA));
// std::cout << std::endl;
// sim.mouseMoveRelative(400, -100);
// waitABit();
// sim.keySequence(" Simple sentence Here 123 ");
// sim.mouseDown(XIS::LEFT_MOUSE_BUTTON);
// waitABit();
// sim.mouseMoveRelative(0, 300);
// waitABit();
// sim.mouseUp(XIS::LEFT_MOUSE_BUTTON);
// waitABit();
// //scroll down and up
// sim.mouseScrollY(10);
// waitABit();
// sim.mouseScrollY(-10);
// //scroll left and right
// waitABit();
// sim.mouseScrollX(10);
// waitABit();
// sim.mouseScrollX(-10);
char anA = 'a';
cout << "a: " << (int)anA << " " << sim.charToKeyCode(anA) << endl;
std::cout << std::endl;
waitABit();
sim.keyClick(sim.charToKeyCode(anA));
std::cout << std::endl;
waitABit();
sim.keySequence(" Simple sentence Here 123 ");
@ -68,5 +69,5 @@ int main()
void waitABit()
{
//std::this_thread::sleep_for(std::chrono::milliseconds(1000));
sleep(2);
sleep(1);
}

View File

@ -81,5 +81,6 @@ public:
static const int MIDDLE_MOUSE_BUTTON = 3;
};
typedef XInputSimulator XIS;
#endif // XINPUTSIMULATOR_H

View File

@ -168,6 +168,7 @@ int XInputSimulatorImplLinux::charToKeyCode(char key_char)
std::cout << "cchar: " << (int)key_char << std::endl;
int keyCode = XKeysymToKeycode(display, key_char);
// int keyCode = XKeysymToKeycode(display, XStringToKeysym(&key_char));
std::cout << "ccode: " << keyCode << std::endl;
return keyCode;
@ -180,7 +181,19 @@ void XInputSimulatorImplLinux::keySequence(const std::string &sequence)
std::cout << "cahr: " << c << std::endl;
int keyCode = this->charToKeyCode(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;
}

View File

@ -20,16 +20,13 @@
#include <iostream>
//quartz CG... stuff
#include <ApplicationServices/ApplicationServices.h>
//sleep
#include <unistd.h>
#include "xinputsimulatorimplmacos.h"
#include "notimplementedexception.h"
#include <QDebug>
//#include <QDebug>
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