aboutsummaryrefslogtreecommitdiffstats
path: root/fakekey/fakekey.h
diff options
context:
space:
mode:
Diffstat (limited to 'fakekey/fakekey.h')
-rw-r--r--fakekey/fakekey.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/fakekey/fakekey.h b/fakekey/fakekey.h
new file mode 100644
index 0000000..da83223
--- /dev/null
+++ b/fakekey/fakekey.h
@@ -0,0 +1,131 @@
+#ifndef _HAVE_LIBFAKEKEY_H
+#define _HAVE_LIBFAKEKEY_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/cursorfont.h>
+#include <X11/keysymdef.h>
+#include <X11/keysym.h>
+#include <X11/extensions/XTest.h>
+#include <X11/Xos.h>
+#include <X11/Xproto.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup FakeKey FakeKey -
+ * @brief yada yada yada
+ *
+ *
+ * Always remember to release held keys
+ * @{
+ */
+
+
+/**
+ * @typedef FakeKey
+ *
+ * Opaque structure used for all operations.
+ */
+typedef struct FakeKey FakeKey;
+
+/**
+ * @typedef FakeKeyModifier
+ *
+ * enumerated types for #mb_pixbuf_img_transform
+ */
+typedef enum
+{
+ FAKEKEYMOD_SHIFT = (1<<1),
+ FAKEKEYMOD_CONTROL = (1<<2),
+ FAKEKEYMOD_ALT = (1<<3),
+ FAKEKEYMOD_META = (1<<4)
+
+} FakeKeyModifier;
+
+/**
+ * Initiates FakeKey.
+ *
+ * @param xdpy X Display connection.
+ *
+ * @return new #FakeKey reference on success, NULL on fail.
+ */
+FakeKey*
+fakekey_init(Display *xdpy);
+
+
+/**
+ * Sends a Keypress to the server for the supplied UTF8 character.
+ *
+ * @param fk #FakeKey refernce from #fakekey_init
+ * @param utf8_char_in Pointer to a single UTF8 Character data.
+ * @param len_bytes Lenth in bytes of character, or -1 in ends with 0
+ * @param modifiers OR'd list of #FakeKeyModifier modifiers keys
+ * to press with the key.
+ *
+ *
+ * @return
+ */
+int
+fakekey_press(FakeKey *fk,
+ unsigned char *utf8_char_in,
+ int len_bytes,
+ int modifiers);
+
+/**
+ * Repreats a press of the currently held key ( from #fakekey_press )
+ *
+ * @param fk #FakeKey refernce from #fakekey_init
+ */
+void
+fakekey_repeat(FakeKey *fk);
+
+
+/**
+ * Releases the currently held key ( from #fakekey_press )
+ *
+ * @param fk #FakeKey refernce from #fakekey_init
+ */
+void
+fakekey_release(FakeKey *fk);
+
+/**
+ * Resyncs the internal list of keysyms with the server.
+ * Should be called if a MappingNotify event is recieved.
+ *
+ * @param fk #FakeKey refernce from #fakekey_init
+ *
+ * @return
+ */
+int
+fakekey_reload_keysyms(FakeKey *fk);
+
+/**
+ *
+ *
+ * @param fk #FakeKey refernce from #fakekey_init
+ * @param keycode X Keycode to send
+ * @param is_press Is this a press ( or release )
+ * @param modifiers
+ *
+ * @return
+ */
+int
+fakekey_send_keyevent(FakeKey *fk,
+ KeyCode keycode,
+ Bool is_press,
+ int modifiers);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HAVE_LIBFAKEKEY_H */