9 static GModule
*module;
10 static EngineStartup
*estartup
;
11 static EngineShutdown
*eshutdown
;
13 #define LOADSYM(name, var) \
14 if (!g_module_symbol(module, #name, (gpointer*)&var)) { \
15 g_warning("Failed to load symbol %s from engine", #name); \
19 static gboolean
load(char *name
)
23 g_assert(module == NULL
);
25 path
= g_build_filename(ENGINEDIR
, name
, NULL
);
26 module = g_module_open(path
, 0);
30 path
= g_build_filename(g_get_home_dir(), ".openbox", "engines", name
,
32 module = g_module_open(path
, 0);
39 /* load the engine's symbols */
40 LOADSYM(startup
, estartup
);
41 LOADSYM(shutdown
, eshutdown
);
42 LOADSYM(frame_new
, engine_frame_new
);
43 LOADSYM(frame_grab_client
, engine_frame_grab_client
);
44 LOADSYM(frame_release_client
, engine_frame_release_client
);
45 LOADSYM(frame_adjust_size
, engine_frame_adjust_size
);
46 LOADSYM(frame_adjust_position
, engine_frame_adjust_position
);
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
);
62 void engine_startup(char *engine
)
69 g_warning("Failed to load the engine '%s'", engine
);
70 g_message("Falling back to the default: '%s'", DEFAULT_ENGINE
);
72 if (!load(DEFAULT_ENGINE
)) {
73 g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE
);
78 void engine_shutdown()
82 g_module_close(module);