9 char *engine_name = NULL;
10 char *engine_theme = NULL;
11 char *engine_layout = "NDSLIMC";
12 char *engine_font = "Sans-7";
13 gboolean engine_shadow = FALSE;
14 int engine_shadow_offset = 1;
15 int engine_shadow_tint = 25;
17 static GModule *module = NULL;
18 static EngineStartup *estartup = NULL;
19 static EngineShutdown *eshutdown = NULL;
21 #define LOADSYM(name, var) \
22 if (!g_module_symbol(module, #name, (gpointer*)&var)) { \
23 g_warning("Failed to load symbol %s from engine", #name); \
27 static gboolean load(char *name)
31 g_assert(module == NULL);
33 path = g_build_filename(ENGINEDIR, name, NULL);
34 module = g_module_open(path, 0);
38 path = g_build_filename(g_get_home_dir(), ".openbox", "engines", name,
40 module = g_module_open(path, 0);
47 /* load the engine's symbols */
48 LOADSYM(startup, estartup);
49 LOADSYM(shutdown, eshutdown);
50 LOADSYM(frame_new, engine_frame_new);
51 LOADSYM(frame_grab_client, engine_frame_grab_client);
52 LOADSYM(frame_release_client, engine_frame_release_client);
53 LOADSYM(frame_adjust_area, engine_frame_adjust_area);
54 LOADSYM(frame_adjust_shape, engine_frame_adjust_shape);
55 LOADSYM(frame_adjust_state, engine_frame_adjust_state);
56 LOADSYM(frame_adjust_focus, engine_frame_adjust_focus);
57 LOADSYM(frame_adjust_title, engine_frame_adjust_title);
58 LOADSYM(frame_adjust_icon, engine_frame_adjust_icon);
59 LOADSYM(frame_show, engine_frame_show);
60 LOADSYM(frame_hide, engine_frame_hide);
61 LOADSYM(get_context, engine_get_context);
76 if (load(engine_name))
78 g_warning("Failed to load the engine '%s'", engine_name);
79 g_message("Falling back to the default: '%s'", DEFAULT_ENGINE);
80 if (!load(DEFAULT_ENGINE)) {
81 g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE);
86 void engine_shutdown()
91 g_module_close(module);