Re: Key press synthesis (for WebKitGTK)



On Sat, Nov 24, 2018 at 09:59:00AM +0100, Pierre Neidhardt wrote:
Hi Gergely,

So if you change your handler’s return type from `void` to `gboolean`
and return `FALSE` if the lisp thingy doesn’t understand your key, it
will be automatically propagated to the next handler (which, hopefully,
will insert your "a" key.

Thanks for the tip.  Indeed, I had missed that.

That said, the current situation is a little more complex because the call to
Lisp is _asynchronous_.  Which means that I can only know the answer from the
callback of the Soup request, not within the key-press handler.  In the Soup
callback, the key press event is gone, hence my need to synthesize a new one.

I have successfully managed to synthesize a key-press event in a dummy program.
In the above scenario, it fails seemingly because it happens from within a Soup
callback.  Maybe Libsoup uses different threads, which causes threading issue
when manipulating GTK widgets?

No, it shouldn’t, at least not by default.

How about you send the event as `user_data` to `soup_request_send()` (or whatever method you use) and send 
that to the webkit widget?


I also tried to synthesize the key event from another callback started in a
g_idle_add() in the Soup callback, to no avail.
g_main_context_invoke() seems to make no difference.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/



-- 
You must believe in things that are not true.
Otherwise, how will they become?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]