10 EngineFrameNew
*engine_frame_new
;
11 EngineFrameGrabClient
*engine_frame_grab_client
;
12 EngineFrameReleaseClient
*engine_frame_release_client
;
13 EngineFrameAdjustArea
*engine_frame_adjust_area
;
14 EngineFrameAdjustShape
*engine_frame_adjust_shape
;
15 EngineFrameAdjustState
*engine_frame_adjust_state
;
16 EngineFrameAdjustFocus
*engine_frame_adjust_focus
;
17 EngineFrameAdjustTitle
*engine_frame_adjust_title
;
18 EngineFrameAdjustIcon
*engine_frame_adjust_icon
;
19 EngineFrameShow
*engine_frame_show
;
20 EngineFrameHide
*engine_frame_hide
;
21 EngineGetContext
*engine_get_context
;
22 EngineRenderLabel
*engine_render_label
;
23 EngineSizeLabel
*engine_size_label
;
25 static GModule
*module = NULL
;
26 static EngineStartup
*estartup
= NULL
;
27 static EngineShutdown
*eshutdown
= NULL
;
29 #define LOADSYM(name, var) \
30 if (!g_module_symbol(module, #name, (gpointer*)&var)) { \
31 g_warning("Failed to load symbol %s from engine", #name); \
35 static gboolean
load(char *name
)
39 g_assert(module == NULL
);
41 path
= g_build_filename(g_get_home_dir(), ".openbox", "engines", name
,
43 module = g_module_open(path
, 0);
47 path
= g_build_filename(ENGINEDIR
, name
, NULL
);
48 module = g_module_open(path
, 0);
53 g_warning(g_module_error());
57 /* load the engine's symbols */
58 LOADSYM(startup
, estartup
);
59 LOADSYM(shutdown
, eshutdown
);
60 LOADSYM(frame_new
, engine_frame_new
);
61 LOADSYM(frame_grab_client
, engine_frame_grab_client
);
62 LOADSYM(frame_release_client
, engine_frame_release_client
);
63 LOADSYM(frame_adjust_area
, engine_frame_adjust_area
);
64 LOADSYM(frame_adjust_shape
, engine_frame_adjust_shape
);
65 LOADSYM(frame_adjust_state
, engine_frame_adjust_state
);
66 LOADSYM(frame_adjust_focus
, engine_frame_adjust_focus
);
67 LOADSYM(frame_adjust_title
, engine_frame_adjust_title
);
68 LOADSYM(frame_adjust_icon
, engine_frame_adjust_icon
);
69 LOADSYM(frame_show
, engine_frame_show
);
70 LOADSYM(frame_hide
, engine_frame_hide
);
71 LOADSYM(get_context
, engine_get_context
);
72 LOADSYM(render_label
, engine_render_label
);
73 LOADSYM(size_label
, engine_size_label
);
88 if (load(config_engine_name
))
90 g_warning("Failed to load the engine '%s'", config_engine_name
);
91 g_message("Falling back to the default: '%s'", DEFAULT_ENGINE
);
93 g_module_close(module);
96 if (!load(DEFAULT_ENGINE
)) {
97 g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE
);
102 void engine_shutdown()
104 if (module != NULL
) {
106 g_module_close(module);