summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-02-14 08:52:17 +0100
committerDave Davenport <qball@gmpclient.org>2017-02-14 08:52:17 +0100
commitfb0540936566788699a5ca4758f4430e0470c8b4 (patch)
tree6a13c0162c95a41687b904d8510e437b3dd8ed34
parent97be4e9c7298a86a747115b7288cceb3c0f6a9e7 (diff)
Start of making SardemFF7 happy
Allow mode's to be loaded as dynamic plugins.
-rw-r--r--configure.ac2
-rw-r--r--include/rofi.h1
-rw-r--r--source/dialogs/run.c2
-rw-r--r--source/rofi.c23
-rw-r--r--source/view.c1
5 files changed, 27 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 96a2faca..74538e17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,7 +102,7 @@ PKG_PROG_PKG_CONFIG
dnl ---------------------------------------------------------------------
dnl PKG_CONFIG based dependencies
dnl ---------------------------------------------------------------------
-PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0])
+PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0])
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama])
PKG_CHECK_MODULES([pango], [pango pangocairo])
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
diff --git a/include/rofi.h b/include/rofi.h
index bfa66d28..87e571e4 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -5,7 +5,6 @@
#include <glib.h>
#include <string.h>
#include <stdlib.h>
-#include "timings.h"
#include "keyb.h"
#include "mode.h"
#include "view.h"
diff --git a/source/dialogs/run.c b/source/dialogs/run.c
index 9324a995..6138e2d1 100644
--- a/source/dialogs/run.c
+++ b/source/dialogs/run.c
@@ -49,6 +49,8 @@
#include "dialogs/run.h"
#include "mode-private.h"
+
+#include "timings.h"
/**
* Name of the history file where previously choosen commands are stored.
*/
diff --git a/source/rofi.c b/source/rofi.c
index 4dfa58fe..3019853d 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <time.h>
#include <locale.h>
+#include <gmodule.h>
#include <xcb/xcb.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_ewmh.h>
@@ -66,6 +67,8 @@
#include "theme.h"
+#include "timings.h"
+
// Pidfile.
char *pidfile = NULL;
const char *cache_dir = NULL;
@@ -441,6 +444,26 @@ static int add_mode ( const char * token )
modi[num_modi] = &combi_mode;
num_modi++;
}
+ else if ( g_str_has_suffix ( token, G_MODULE_SUFFIX ) )
+ {
+ TICK_N("Loading module");
+ // Load module.
+ GModule *mod = g_module_open ( token, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL );
+ if ( mod ) {
+ gpointer m = NULL;
+ if ( g_module_symbol ( mod, "mode", &m) ){
+ modi[num_modi] = m;
+ num_modi++;
+ } else {
+ fprintf(stderr, "Symbol 'mode' not found in module: %s\n", token);
+ g_module_close ( mod );
+ }
+
+ } else {
+ fprintf ( stderr, "Failed to open module: %s\n", token);
+ }
+ TICK_N("Loading module done");
+ }
else {
// If not build in, use custom modi.
Mode *sw = script_switcher_parse_setup ( token );
diff --git a/source/view.c b/source/view.c
index 385b857d..d00a8b47 100644
--- a/source/view.c
+++ b/source/view.c
@@ -45,6 +45,7 @@
#define SN_API_NOT_YET_FROZEN
#include <libsn/sn.h>
+#include "timings.h"
#include "settings.h"
#include "rofi.h"