mirror of
https://github.com/robotn/gohook.git
synced 2024-11-24 05:13:17 +08:00
f0ddfd620c
* Part 1 of supporting async events made the dispatch process send events via json through a channel (the c kind), made another function that receives it and sends it trough another channel (the go kind) todo: remove usage of function-local data trough channel todo:find error that is causing the c channel to fill up? * Part 2 of making the lib async - New event struct mimiking C structs - changed c channel library to eb_chan - changed API to something more palatable * General cleanup * updated go.mod oopsie * Probably final touches i swear this time * Changed constants, keychar type and test function now Keychar is a rune, so it can be used as a regular character. * WIP adding better support for conversion between Scancodes and Keychars added table, will add rest of support soon(tm) * finished conversion table * Satisfied stringer interface for easier debug and logging, returned old function what the title says * Satisfied stringer interface for easier debug and logging, returned old function what the title says * forgot to import unsafe
50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
#pragma once
|
|
#ifndef OS_H
|
|
#define OS_H
|
|
|
|
/* Python versions under 2.5 don't support this macro, but it's not
|
|
* terribly difficult to replicate: */
|
|
#ifndef PyModule_AddIntMacro
|
|
#define PyModule_AddIntMacro(module, macro) \
|
|
PyModule_AddIntConstant(module, #macro, macro)
|
|
#endif /* PyModule_AddIntMacro */
|
|
|
|
#if !defined(IS_MACOSX) && defined(__APPLE__) && defined(__MACH__)
|
|
#define IS_MACOSX
|
|
#endif /* IS_MACOSX */
|
|
|
|
#if !defined(IS_WINDOWS) && (defined(WIN32) || defined(_WIN32) || \
|
|
defined(__WIN32__) || defined(__WINDOWS__) || defined(__CYGWIN__))
|
|
#define IS_WINDOWS
|
|
#endif /* IS_WINDOWS */
|
|
|
|
#if !defined(USE_X11) && !defined(NUSE_X11) && !defined(IS_MACOSX) && !defined(IS_WINDOWS)
|
|
#define USE_X11
|
|
#endif /* USE_X11 */
|
|
|
|
#if defined(IS_WINDOWS)
|
|
// #define STRICT /* Require use of exact types. */
|
|
#define WIN32_LEAN_AND_MEAN 1 /* Speed up compilation. */
|
|
#include <windows.h>
|
|
#elif !defined(IS_MACOSX) && !defined(USE_X11)
|
|
#error "Sorry, this platform isn't supported yet!"
|
|
#endif
|
|
|
|
/* Interval to align by for large buffers (e.g. bitmaps). */
|
|
/* Must be a power of 2. */
|
|
#ifndef BYTE_ALIGN
|
|
#define BYTE_ALIGN 4 /* Bytes to align pixel buffers to. */
|
|
/* #include <stddef.h> */
|
|
/* #define BYTE_ALIGN (sizeof(size_t)) */
|
|
#endif /* BYTE_ALIGN */
|
|
|
|
#if BYTE_ALIGN == 0
|
|
/* No alignment needed. */
|
|
#define ADD_PADDING(width) (width)
|
|
#else
|
|
/* Aligns given width to padding. */
|
|
#define ADD_PADDING(width) (BYTE_ALIGN + (((width) - 1) & ~(BYTE_ALIGN - 1)))
|
|
#endif
|
|
|
|
#endif /* OS_H */
|