[Geany-Devel] Order of plugin signal connections

Austin Green austin.green at xxxxx
Tue May 12 04:28:10 UTC 2020

Hi Lex,

On Tue, 12 May 2020 14:02:15 +1000
Lex Trotman <elextr at gmail.com> wrote:

> On Tue, 12 May 2020 at 12:00, Austin Green <austin.green at orcon.net.nz> wrote:
> > I need to ensure that one particular plugin will process keyboard events before other plugins get to see them (as some plugins may cause further handling of the event to be suppressed).  Is there a way to achieve that?  I'm guessing that the order of calling the plug init functions is what counts, but it's complicated by plugins being unloaded and reloaded dynamically.
> Correct, signals can be added before or after
> (https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-connect
> and connect_after) but in the face of non-determinism of the order of
> loading and enabling plugins (as the user can enable and disable them
> in any order) its not possible to guarantee the resulting signal
> order.  That appears to be a limitation of the gobject signals
> implementation.

Thanks for that.  My proposed fix is to register a new signal, say "pre-key-press-event", then, in Geany start-up (before any plugin loading) connect to "key-press-event".  In the handler for "key-press-event", Geany just emits "pre-key-press-event" with the same event data as was passed to it.  Thus, any plugin that needs to be assured of priority (and promises not to suppress the signal handling) will get first look-in.  Does that sound feasible?


More information about the Devel mailing list