> Suspend Lua execution while waiting for a result from the callback.

It doesn't suspend, `keygrab()` just sleep loops 
[here](https://github.com/geany/geany-plugins/blob/2665511f731e613944815ab62885ecf52e3037e6/geanylua/glspi_app.c#L589)
 and seems to use the global variable `km` to communicate between the callback 
from the widget filter (X11 or Windows version of) `keygrab_cb()`.

What I'm suggesting is that it be rewritten to not use window filters but to 
replace 
[this](https://github.com/geany/geany-plugins/blob/2665511f731e613944815ab62885ecf52e3037e6/geanylua/glspi_app.c#L588)
 with a call to `g_signal_connect` similar to 
[`keybindings.c`](https://github.com/geany/geany/blob/2509e21526d36034f5251381a76555e7300fbfc0/src/keybindings.c#L754)
 in Geany itself.

It will require rewriting the signal handler since the returned event data is 
different to either existing one, but its the same for all platforms so its 
portable.  Also Glib/GTK does the keymap crap before it returns the event, so 
all that can be deleted, yay less code.

Since it seems to work for those who use it, the sleep loop approach can 
probably be kept no matter how smelly it is :nose: 

> What are the use cases for geany.keygrab?

Just because neither you nor I am smart enough to figure a use-case immediately 
doesn't mean someone else hasn't, the function has been there for a long time 
(at least since 2009 when the plugin was moved to geany-plugins), so no it 
can't be removed.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1230#issuecomment-1454943556
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/issues/1230/[email protected]>

Reply via email to