2019-09-15 16:29:11 +00:00
|
|
|
/*
|
|
|
|
* This file is part of espanso.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 Federico Terzi
|
|
|
|
*
|
|
|
|
* espanso is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* espanso is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with espanso. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-09-09 13:15:01 +00:00
|
|
|
use std::os::raw::{c_void, c_char};
|
|
|
|
|
2019-09-13 12:35:46 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct MacMenuItem {
|
|
|
|
pub item_id: i32,
|
|
|
|
pub item_type: i32,
|
|
|
|
pub item_name: [c_char; 100],
|
|
|
|
}
|
|
|
|
|
2019-09-09 13:15:01 +00:00
|
|
|
#[allow(improper_ctypes)]
|
|
|
|
#[link(name="macbridge", kind="static")]
|
|
|
|
extern {
|
2019-09-13 12:35:46 +00:00
|
|
|
pub fn initialize(s: *const c_void, icon_path: *const c_char);
|
2019-09-13 09:55:42 +00:00
|
|
|
pub fn eventloop();
|
|
|
|
|
2019-09-09 13:46:57 +00:00
|
|
|
// System
|
2019-09-13 13:26:17 +00:00
|
|
|
pub fn check_accessibility() -> i32;
|
2019-09-09 13:46:57 +00:00
|
|
|
pub fn get_active_app_bundle(buffer: *mut c_char, size: i32) -> i32;
|
|
|
|
pub fn get_active_app_identifier(buffer: *mut c_char, size: i32) -> i32;
|
|
|
|
|
2019-09-09 14:43:32 +00:00
|
|
|
// Clipboard
|
|
|
|
pub fn get_clipboard(buffer: *mut c_char, size: i32) -> i32;
|
|
|
|
pub fn set_clipboard(text: *const c_char) -> i32;
|
|
|
|
|
2019-09-13 12:35:46 +00:00
|
|
|
// UI
|
|
|
|
pub fn register_icon_click_callback(cb: extern fn(_self: *mut c_void));
|
|
|
|
pub fn show_context_menu(items: *const MacMenuItem, count: i32) -> i32;
|
|
|
|
pub fn register_context_menu_click_callback(cb: extern fn(_self: *mut c_void, id: i32));
|
|
|
|
|
2019-09-09 13:46:57 +00:00
|
|
|
// Keyboard
|
2019-09-13 09:55:42 +00:00
|
|
|
pub fn register_keypress_callback(cb: extern fn(_self: *mut c_void, *const u8,
|
2019-09-09 13:15:01 +00:00
|
|
|
i32, i32, i32));
|
2019-09-13 09:55:42 +00:00
|
|
|
|
2019-09-09 13:15:01 +00:00
|
|
|
pub fn send_string(string: *const c_char);
|
|
|
|
pub fn send_vkey(vk: i32);
|
|
|
|
pub fn delete_string(count: i32);
|
2019-09-09 15:03:59 +00:00
|
|
|
pub fn trigger_paste();
|
2019-09-09 13:15:01 +00:00
|
|
|
}
|