As pointed out in #3, Hudkit currently passes through all input events. This is by design, but that's because the design is not ambitious enough. :fire:
[x] Is it possible to send synthetic events?
→ :heavy_check_mark: Yes. gdk_event_new(GDK_KEY_PRESS), gtk_main_do_event. Gist w/ makefile here.
[ ] Is it possible to capture all input events globally?
→ :grey_question: Probably not. GDK appears not to consider this sort of generality.
[ ] Is it possible to cause GdkEvents to be sent to the desktop?
→ :grey_question: Maybe. The above example Gist only ever sends events to itself, even if I focus a different window before the on_timeout triggers. But maybe there's a low-level alternative to gtk_main_do_event.
[ ] Can this be done with a combination of X11 and GDK/GTK?
[x] Is it possible to capture all input events globally at X11 level (keylogger style) such that they're still delivered to the focused application?
→ :heavy_check_mark: Yes. I have written such an X11 program.
[ ] Is it possible to convert XEvents to GdkEvents?
→ :white_check_mark: Ostensibly yes; GDK does it internally like this. The function isn't exported to the public interface, but we could pull in GTK sources; they're big (13MiB zipped), but LGPL-licensed. Need to figure out the right compiler incantations, and hopefully not having to compile whole damn GTK with us because nooope.
[ ] Is it possible to interleave a GTK and X11 event loop, or otherwise coordinate?
→ :white_check_mark: Again yeah in principle; GDK must interleave them internally. And could always fork and do it via socket.
[ ] Is it possible to send a GdkEvent converted from an XEvent directly to a window?
→ :grey_question: Unsure. I thought gdk_event_put might do that, but the doc's wording of "Appends a copy of the given event onto the front of the event queue for event->any.window’s display" sounds to me like the event will be plopped into the top level queue for this GdkDisplay, before input mask filtering, and then it's just pointless, because it'll be pruned anyhow. But maybe it's worth a try.
If anyone reading knows anything even a little bit related to this, please link!
As pointed out in #3, Hudkit currently passes through all input events. This is by design, but that's because the design is not ambitious enough. :fire:
If desktop input events could be duplicated to the Hudkit page in addition to the passthrough, that would open up many interactive "applications"—which is to say I really wanna resurrect this ancient hypergurl.com mouse-trailing clock that I thought was cool when I was 12, and I was so disappointed that the page said "This script works on webpages only and cannot be installed to desktops". Now, 15 years of programming later, something is flickering at the end of this tunnel. Maybe.
Notes for possible implementation paths:
[ ] Can this be done in GDK/GTK only?
[x] Is it possible to send synthetic events? → :heavy_check_mark: Yes.
gdk_event_new(GDK_KEY_PRESS)
,gtk_main_do_event
. Gist w/makefile
here.[ ] Is it possible to capture all input events globally? → :grey_question: Probably not. GDK appears not to consider this sort of generality.
[ ] Is it possible to cause GdkEvents to be sent to the desktop? → :grey_question: Maybe. The above example Gist only ever sends events to itself, even if I focus a different window before the
on_timeout
triggers. But maybe there's a low-level alternative togtk_main_do_event
.[ ] Can this be done with a combination of X11 and GDK/GTK?
[x] Is it possible to capture all input events globally at X11 level (keylogger style) such that they're still delivered to the focused application? → :heavy_check_mark: Yes. I have written such an X11 program.
[ ] Is it possible to convert
XEvent
s toGdkEvent
s? → :white_check_mark: Ostensibly yes; GDK does it internally like this. The function isn't exported to the public interface, but we could pull in GTK sources; they're big (13MiB zipped), but LGPL-licensed. Need to figure out the right compiler incantations, and hopefully not having to compile whole damn GTK with us because nooope.[ ] Is it possible to interleave a GTK and X11 event loop, or otherwise coordinate? → :white_check_mark: Again yeah in principle; GDK must interleave them internally. And could always fork and do it via socket.
[ ] Is it possible to send a
GdkEvent
converted from anXEvent
directly to a window? → :grey_question: Unsure. I thoughtgdk_event_put
might do that, but the doc's wording of "Appends a copy of the given event onto the front of the event queue for event->any.window’s display" sounds to me like the event will be plopped into the top level queue for thisGdkDisplay
, before input mask filtering, and then it's just pointless, because it'll be pruned anyhow. But maybe it's worth a try.If anyone reading knows anything even a little bit related to this, please link!