diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 22:55:00 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 22:55:00 -0700 |
| commit | e008ac8d837ad11557c7625f3c311f230986d7f5 (patch) | |
| tree | eb199548bd6fa8cad186a301194e930cc8636bc5 /harness/include/plugin.h | |
| parent | 2d530e35ee67126c83afb89ed7a3066b65782f57 (diff) | |
| download | montis-e008ac8d837ad11557c7625f3c311f230986d7f5.tar.gz montis-e008ac8d837ad11557c7625f3c311f230986d7f5.tar.bz2 montis-e008ac8d837ad11557c7625f3c311f230986d7f5.zip | |
Added event handlers for map/unmap/destroy surfaces, added Alt+F5 for hot reload.
It turns out I could actually remove the metaload handler from the
plugin interface. As things turn out, when fully unloading the shared
object and reloading it, the Haskell runtime no longer complained. This
makes things much simpler, which is great.
I do wonder if I'm going to run into issues because of this, but I'll
cross that bridge when it's burning.
Diffstat (limited to 'harness/include/plugin.h')
| -rw-r--r-- | harness/include/plugin.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/harness/include/plugin.h b/harness/include/plugin.h index 651e2f1..7cee511 100644 --- a/harness/include/plugin.h +++ b/harness/include/plugin.h @@ -47,15 +47,6 @@ typedef struct PLUGIN { * will be NULL. */ const char *plugin_name; - /** - * This is the first thing called on the plugin when loading it. This is - * different from plugin_load in that it will not be called on a hot-reload. - * - * This is used as a hack to get around GHC's limitation where it can't - * start up the RTS once it has been shutdown. - */ - EXPORT(void (*plugin_metaload)(int argc, char** argv)); - /** Intializes the plugin with the given argc/argv. This is the first thing * called on the plugin and is called immediately after the library is loaded. */ @@ -97,6 +88,13 @@ typedef struct PLUGIN { */ EXPORT(opqst_t (*plugin_handle_keybinding)(uint32_t keysym, opqst_t state)); + /* + * Handles a surface being mapped, unmapped or destroyed. + */ + EXPORT(opqst_t (*plugin_handle_surface_map)(void* surface, opqst_t)); + EXPORT(opqst_t (*plugin_handle_surface_unmap)(void* surface, opqst_t)); + EXPORT(opqst_t (*plugin_handle_surface_destroy)(void* surface, opqst_t)); + } plugin_t; /** Loads a plugin from the dynamic library handle. Returns a non-zero error @@ -109,10 +107,10 @@ int load_plugin_from_dl(dlhandle_t library, plugin_t *out); * This function will call dlclose on the plugin's library handle if it is not * the same as 'library'. */ -int plugin_hot_reload(int argc, char **argv, dlhandle_t library, +int plugin_hot_reload(int argc, char **argv, const char* filepath, plugin_t *plugin); /* Reads a plugin from a filename. */ -int read_plugin_from_file(const char *filename, plugin_t *plugin); +int load_plugin_from_file(const char *filename, plugin_t *plugin); #endif /* _PLUGIN_H_ */ |