10 static GModule
*module;
11 static EngineStartup
*estartup
;
12 static EngineShutdown
*eshutdown
;
14 #define LOADSYM(name, var) \
15 if (!g_module_symbol(module, #name, (gpointer*)&var)) { \
16 g_warning("Failed to load symbol %s from engine", #name); \
20 static gboolean
load(char *name
)
24 g_assert(module == NULL
);
26 path
= g_build_filename(ENGINEDIR
, name
, NULL
);
27 module = g_module_open(path
, 0);
31 path
= g_build_filename(g_get_home_dir(), ".openbox", "engines", name
,
33 module = g_module_open(path
, 0);
40 /* load the engine's symbols */
41 LOADSYM(startup
, estartup
);
42 LOADSYM(shutdown
, eshutdown
);
43 LOADSYM(frame_new
, engine_frame_new
);
44 LOADSYM(frame_grab_client
, engine_frame_grab_client
);
45 LOADSYM(frame_release_client
, engine_frame_release_client
);
46 LOADSYM(frame_adjust_area
, engine_frame_adjust_area
);
47 LOADSYM(frame_adjust_shape
, engine_frame_adjust_shape
);
48 LOADSYM(frame_adjust_state
, engine_frame_adjust_state
);
49 LOADSYM(frame_adjust_focus
, engine_frame_adjust_focus
);
50 LOADSYM(frame_adjust_title
, engine_frame_adjust_title
);
51 LOADSYM(frame_adjust_icon
, engine_frame_adjust_icon
);
52 LOADSYM(frame_show
, engine_frame_show
);
53 LOADSYM(frame_hide
, engine_frame_hide
);
54 LOADSYM(get_context
, engine_get_context
);
67 g_message("ENGINE STARTUP");
68 if (config_get("engine", Config_String
, &engine
)) {
69 g_warning("GOT ENGINE %s", engine
.string
);
70 if (load(engine
.string
))
72 g_warning("Failed to load the engine '%s'", engine
.string
);
73 g_message("Falling back to the default: '%s'", DEFAULT_ENGINE
);
75 if (!load(DEFAULT_ENGINE
)) {
76 g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE
);
81 void engine_shutdown()
85 g_module_close(module);