2019-08-30 12:33:40 +00:00
|
|
|
#ifndef ESPANSO_BRIDGE_H
|
|
|
|
#define ESPANSO_BRIDGE_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2019-08-30 16:32:10 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called when a new keypress is made, the first argument is an int array,
|
|
|
|
* while the second is the size of the array.
|
|
|
|
*/
|
2019-09-05 17:36:53 +00:00
|
|
|
typedef void (*KeypressCallback)(void * self, int32_t *buffer, int32_t len, int32_t is_modifier, int32_t key_code);
|
2019-08-30 16:32:10 +00:00
|
|
|
|
2019-09-05 17:36:53 +00:00
|
|
|
extern KeypressCallback keypress_callback;
|
2019-08-30 19:24:03 +00:00
|
|
|
extern void * interceptor_instance;
|
2019-08-30 16:32:10 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Register the callback that will be called when a keypress was made
|
|
|
|
*/
|
2019-09-05 17:36:53 +00:00
|
|
|
extern "C" void register_keypress_callback(void *self, KeypressCallback callback);
|
2019-08-30 12:33:40 +00:00
|
|
|
|
2019-08-30 15:58:18 +00:00
|
|
|
/*
|
|
|
|
* Initialize the Windows worker's parameters
|
2019-08-30 16:32:10 +00:00
|
|
|
* return: 1 if OK, -1 otherwise.
|
2019-08-30 15:58:18 +00:00
|
|
|
*/
|
2019-08-30 17:45:27 +00:00
|
|
|
extern "C" int32_t initialize_window();
|
2019-08-30 15:58:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Start the event loop indefinitely. Blocking call.
|
|
|
|
*/
|
|
|
|
extern "C" void eventloop();
|
2019-08-30 12:33:40 +00:00
|
|
|
|
2019-08-30 19:24:03 +00:00
|
|
|
/*
|
|
|
|
* Type the given string by simulating Key Presses
|
|
|
|
*/
|
|
|
|
extern "C" void send_string(const wchar_t * string);
|
|
|
|
|
2019-09-06 08:21:33 +00:00
|
|
|
/*
|
|
|
|
* Send the given Virtual Key press
|
|
|
|
*/
|
|
|
|
extern "C" void send_vkey(int32_t vk);
|
|
|
|
|
2019-08-31 14:07:45 +00:00
|
|
|
/*
|
|
|
|
* Send the backspace keypress, *count* times.
|
|
|
|
*/
|
|
|
|
extern "C" void delete_string(int32_t count);
|
|
|
|
|
2019-09-07 20:23:04 +00:00
|
|
|
/*
|
|
|
|
* Return the active windows's title
|
|
|
|
*/
|
|
|
|
extern "C" int32_t get_active_window_name(wchar_t * buffer, int32_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the active windows's executable path
|
|
|
|
*/
|
|
|
|
extern "C" int32_t get_active_window_executable(wchar_t * buffer, int32_t size);
|
|
|
|
|
2019-09-07 22:51:08 +00:00
|
|
|
// UI
|
|
|
|
|
2019-09-08 11:37:58 +00:00
|
|
|
/*
|
|
|
|
* Initialize the notification window.
|
|
|
|
*/
|
2019-09-08 11:50:09 +00:00
|
|
|
extern "C" int32_t initialize_ui(wchar_t * icon_path);
|
2019-09-08 11:37:58 +00:00
|
|
|
|
2019-09-08 10:31:36 +00:00
|
|
|
/*
|
|
|
|
* Show a window containing the notification.
|
|
|
|
*/
|
2019-09-08 11:37:58 +00:00
|
|
|
extern "C" int32_t show_notification(wchar_t * message);
|
2019-09-07 22:51:08 +00:00
|
|
|
|
2019-09-08 10:31:36 +00:00
|
|
|
/*
|
|
|
|
* Close the notification if present
|
|
|
|
*/
|
|
|
|
extern "C" void close_notification();
|
|
|
|
|
|
|
|
|
2019-09-01 16:49:08 +00:00
|
|
|
#endif //ESPANSO_BRIDGE_H
|