-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'developement' into 'main'
Developement See merge request jesture/actions!28
- Loading branch information
Showing
37 changed files
with
1,226 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
#include "actions/action/keystroke.h" | ||
|
||
namespace actions::action {} // namespace actions::action | ||
namespace actions::action { | ||
absl::StatusOr<std::vector<Key> > ParseKeystroke(std::string str) noexcept { | ||
#if defined(__x11__) | ||
return internal::x11::ParseKeystroke(str); | ||
#else | ||
return std::vector<Key>(); | ||
#endif | ||
} | ||
} // namespace actions::action |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef ACTIONS_ACTION_MOUSE_CLICK_H | ||
#define ACTIONS_ACTION_MOUSE_CLICK_H | ||
|
||
namespace actions::action { | ||
|
||
typedef struct CursorMove { | ||
double x = 0; | ||
double y = 0; | ||
bool relative = true; | ||
} CursorMove; | ||
|
||
typedef enum MouseClick { LeftClick, RightClick, MiddleClick } MouseClick; | ||
|
||
typedef enum MousePress { LeftPress, RightPress, MiddlePress } MousePress; | ||
|
||
typedef enum MouseRelease { | ||
LeftRelease, | ||
RightRelease, | ||
MiddleRelease | ||
} MouseRelease; | ||
|
||
} // namespace actions::action | ||
|
||
#endif // ACTIONS_ACTION_MOUSE_CLICK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include <iostream> | ||
|
||
#include "absl/status/status.h" | ||
#include "actions/action.h" | ||
#include "actions/actions.h" | ||
|
||
using namespace actions; | ||
|
||
absl::Status run() { | ||
auto keysequence = action::ParseKeystroke("shift"); | ||
|
||
if (!keysequence.ok()) return keysequence.status(); | ||
|
||
auto actions = Actions::Create(); | ||
|
||
if (!actions.ok()) return actions.status(); | ||
|
||
absl::Status status = actions | ||
->Perform(action::KeysPress{keysequence.value()}, | ||
action::target::Focused()) | ||
.get(); | ||
|
||
if (!status.ok()) return status; | ||
|
||
status = | ||
actions | ||
->Perform(action::MousePress::LeftPress, action::target::Focused()) | ||
.get(); | ||
|
||
if (!status.ok()) return status; | ||
|
||
status = actions | ||
->Perform(action::CursorMove{.x = 0.1, .y = 0}, | ||
action::target::Focused()) | ||
.get(); | ||
|
||
if (!status.ok()) return status; | ||
|
||
status = actions | ||
->Perform(action::KeysRelease{keysequence.value()}, | ||
action::target::Focused()) | ||
.get(); | ||
|
||
if (!status.ok()) return status; | ||
|
||
return actions | ||
->Perform(action::MouseRelease::LeftRelease, action::target::Focused()) | ||
.get(); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
std::cout << "Running Example" << std::endl; | ||
absl::Status status = run(); | ||
|
||
if (!status.ok()) { | ||
std::cout << status << std::endl; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <iostream> | ||
|
||
#include "absl/status/status.h" | ||
#include "actions/action.h" | ||
#include "actions/actions.h" | ||
|
||
using namespace actions; | ||
|
||
absl::Status run() { | ||
auto actions = Actions::Create(); | ||
|
||
if (!actions.ok()) return actions.status(); | ||
|
||
absl::Status status = actions | ||
->Perform(action::CursorMove{.x = 0.1, .y = 0.1}, | ||
action::target::Focused()) | ||
.get(); | ||
|
||
if (!status.ok()) return status; | ||
|
||
return actions | ||
->Perform(action::MouseClick::LeftClick, action::target::Focused()) | ||
.get(); | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
std::cout << "Running Example" << std::endl; | ||
absl::Status status = run(); | ||
|
||
if (!status.ok()) { | ||
std::cout << status << std::endl; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.