X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fengine.c;h=53e10debebf80701741ae03f7cba282a43e2063e;hb=fb1696659672386bcfc0f753b67f9eeda74e93b9;hp=75446efc659704727fede7e349f9c554110b16fc;hpb=3921ce3067cb12f8472d44bd53d840a80a85b506;p=chaz%2Fopenbox diff --git a/openbox/engine.c b/openbox/engine.c index 75446efc..53e10deb 100644 --- a/openbox/engine.c +++ b/openbox/engine.c @@ -1,5 +1,5 @@ #include "engine.h" -#include "parse.h" +#include "config.h" #include #include @@ -7,13 +7,20 @@ # include #endif -char *engine_name; -char *engine_theme; -char *engine_layout; -char *engine_font; -gboolean engine_shadow; -int engine_shadow_offset; -int engine_shadow_tint; +EngineFrameNew *engine_frame_new; +EngineFrameGrabClient *engine_frame_grab_client; +EngineFrameReleaseClient *engine_frame_release_client; +EngineFrameAdjustArea *engine_frame_adjust_area; +EngineFrameAdjustShape *engine_frame_adjust_shape; +EngineFrameAdjustState *engine_frame_adjust_state; +EngineFrameAdjustFocus *engine_frame_adjust_focus; +EngineFrameAdjustTitle *engine_frame_adjust_title; +EngineFrameAdjustIcon *engine_frame_adjust_icon; +EngineFrameShow *engine_frame_show; +EngineFrameHide *engine_frame_hide; +EngineGetContext *engine_get_context; +EngineRenderLabel *engine_render_label; +EngineSizeLabel *engine_size_label; static GModule *module = NULL; static EngineStartup *estartup = NULL; @@ -31,19 +38,21 @@ static gboolean load(char *name) g_assert(module == NULL); - path = g_build_filename(ENGINEDIR, name, NULL); + path = g_build_filename(g_get_home_dir(), ".openbox", "engines", name, + NULL); module = g_module_open(path, 0); g_free(path); if (module == NULL) { - path = g_build_filename(g_get_home_dir(), ".openbox", "engines", name, - NULL); - module = g_module_open(path, 0); - g_free(path); + path = g_build_filename(ENGINEDIR, name, NULL); + module = g_module_open(path, 0); + g_free(path); } - if (module == NULL) + if (module == NULL) { + g_warning(g_module_error()); return FALSE; + } /* load the engine's symbols */ LOADSYM(startup, estartup); @@ -60,6 +69,8 @@ static gboolean load(char *name) LOADSYM(frame_show, engine_frame_show); LOADSYM(frame_hide, engine_frame_hide); LOADSYM(get_context, engine_get_context); + LOADSYM(render_label, engine_render_label); + LOADSYM(size_label, engine_size_label); if (!estartup()) return FALSE; @@ -67,81 +78,21 @@ static gboolean load(char *name) return TRUE; } -static void parse_assign(char *name, ParseToken *value) -{ - if (!g_ascii_strcasecmp(name, "engine")) { - if (value->type != TOKEN_STRING) - yyerror("invalid value"); - else { - g_free(engine_name); - engine_name = g_strdup(value->data.string); - } - } else if (!g_ascii_strcasecmp(name, "theme")) { - if (value->type != TOKEN_STRING) - yyerror("invalid value"); - else { - g_free(engine_theme); - engine_theme = g_strdup(value->data.string); - } - } else if (!g_ascii_strcasecmp(name, "titlebarlayout")) { - if (value->type != TOKEN_STRING) - yyerror("invalid value"); - else { - g_free(engine_layout); - engine_layout = g_strdup(value->data.string); - } - } else if (!g_ascii_strcasecmp(name, "font.title")) { - if (value->type != TOKEN_STRING) - yyerror("invalid value"); - else { - g_free(engine_font); - engine_font = g_strdup(value->data.string); - } - } else if (!g_ascii_strcasecmp(name, "font.title.shadow")) { - if (value->type != TOKEN_BOOL) - yyerror("invalid value"); - else { - engine_shadow = value->data.bool; - } - } else if (!g_ascii_strcasecmp(name, "font.title.shadow.offset")) { - if (value->type != TOKEN_INTEGER) - yyerror("invalid value"); - else { - engine_shadow_offset = value->data.integer; - } - } else if (!g_ascii_strcasecmp(name, "font.title.shadow.tint")) { - if (value->type != TOKEN_INTEGER) - yyerror("invalid value"); - else { - engine_shadow_tint = value->data.integer; - if (engine_shadow_tint < -100) engine_shadow_tint = -100; - else if (engine_shadow_tint > 100) engine_shadow_tint = 100; - } - } else - yyerror("invalid option"); - parse_free_token(value); -} - void engine_startup() { module = NULL; - engine_name = g_strdup(DEFAULT_ENGINE); - engine_theme = NULL; - engine_layout = g_strdup("NDSLIMC"); - engine_font = g_strdup("Sans-7"); - engine_shadow = FALSE; - engine_shadow_offset = 1; - engine_shadow_tint = 25; - - parse_reg_section("engine", NULL, parse_assign); } void engine_load() { - if (load(engine_name)) + if (load(config_engine_name)) return; - g_warning("Failed to load the engine '%s'", engine_name); + g_warning("Failed to load the engine '%s'", config_engine_name); g_message("Falling back to the default: '%s'", DEFAULT_ENGINE); + if (module != NULL) { + g_module_close(module); + module = NULL; + } if (!load(DEFAULT_ENGINE)) { g_critical("Failed to load the engine '%s'. Aborting", DEFAULT_ENGINE); exit(1); @@ -150,7 +101,6 @@ void engine_load() void engine_shutdown() { - g_free(engine_name); if (module != NULL) { eshutdown(); g_module_close(module);