void external_elm_init(void) { int argc = 0; char **argv = NULL; init_count++; DBG("elm_real_init\n"); if (init_count > 1) return; ecore_app_args_get(&argc, &argv); elm_init(argc, argv); }
/** * @brief Initializer for AtkObjectClass * * @param obj an AtkObject to be initialized * @param data additional initialization data (Evas_Object*) */ static void eail_app_initialize(AtkObject *obj, gpointer data) { int argc; char **argv; EailApp *eail_app = NULL; ATK_OBJECT_CLASS(eail_app_parent_class)->initialize(obj, data); ecore_app_args_get(&argc, &argv); obj->name = argv ? g_strdup((gchar *)ecore_file_file_get(argv[0])) : NULL; obj->role = ATK_ROLE_APPLICATION; obj->accessible_parent = NULL; /* storing last numbers of children to be for checking if children-changed * signal has to be propagated */ eail_app = EAIL_APP(obj); eail_app->child_count_last = atk_object_get_n_accessible_children(obj); }
/** * Sets the default properties for the given window. * * The default properties set for the window are @c WM_CLIENT_MACHINE and * @c _NET_WM_PID. * * @param win The given window. * @ingroup Ecore_X_Window_Properties_Group */ EAPI void ecore_x_window_defaults_set(Ecore_X_Window win) { long pid; char buf[MAXHOSTNAMELEN]; char *hostname[1]; int argc; char **argv; XTextProperty xprop; LOGFN(__FILE__, __LINE__, __FUNCTION__); /* * Set WM_CLIENT_MACHINE. */ gethostname(buf, MAXHOSTNAMELEN); buf[MAXHOSTNAMELEN - 1] = '\0'; hostname[0] = buf; /* The ecore function uses UTF8 which Xlib may not like (especially * with older clients) */ /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE, (char *)buf); */ if (XStringListToTextProperty(hostname, 1, &xprop)) { XSetWMClientMachine(_ecore_x_disp, win, &xprop); XFree(xprop.value); } /* * Set _NET_WM_PID */ pid = getpid(); ecore_x_netwm_pid_set(win, pid); ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); ecore_app_args_get(&argc, &argv); ecore_x_icccm_command_set(win, argc, argv); }
EINTERN int compiz_main(void) { CompIOCtx ctx; char *displayName = 0; char *plugin[256]; int i, nPlugin = 0; Bool disableSm = FALSE; char *clientId = NULL; char *refreshRateArg = NULL; ecore_app_args_get(&programArgc, &programArgv); programName = programArgv[0]; emptyRegion.rects = &emptyRegion.extents; emptyRegion.numRects = 0; emptyRegion.extents.x1 = 0; emptyRegion.extents.y1 = 0; emptyRegion.extents.x2 = 0; emptyRegion.extents.y2 = 0; emptyRegion.size = 0; infiniteRegion.rects = &infiniteRegion.extents; infiniteRegion.numRects = 1; infiniteRegion.extents.x1 = MINSHORT; infiniteRegion.extents.y1 = MINSHORT; infiniteRegion.extents.x2 = MAXSHORT; infiniteRegion.extents.y2 = MAXSHORT; memset(&ctx, 0, sizeof (ctx)); if (!clientId) { clientId = getenv("DESKTOP_AUTOSTART_ID"); } if (refreshRateArg) { ctx.refreshRateData = malloc(strlen(refreshRateArg) + 256); if (ctx.refreshRateData) sprintf(ctx.refreshRateData, "<min>1</min><default>%s</default>", refreshRateArg); } plugin[nPlugin++] = "ccp"; if (nPlugin) { int size = 256; for (i = 0; i < nPlugin; i++) size += strlen(plugin[i]) + 16; ctx.pluginData = malloc(size); if (ctx.pluginData) { char *ptr = ctx.pluginData; ptr += sprintf(ptr, "<type>string</type><default>"); for (i = 0; i < nPlugin; i++) ptr += sprintf(ptr, "<value>%s</value>", plugin[i]); ptr += sprintf(ptr, "</default>"); } initialPlugins = malloc(nPlugin * sizeof (char *)); if (initialPlugins) { memcpy(initialPlugins, plugin, nPlugin * sizeof (char *)); nInitialPlugins = nPlugin; } else { nInitialPlugins = 0; } } xmlInitParser(); LIBXML_TEST_VERSION; if (!compInitMetadata(&coreMetadata)) { compLogMessage("core", CompLogLevelFatal, "Couldn't initialize core metadata"); return 1; } if (!compAddMetadataFromIO(&coreMetadata, readCoreXmlCallback, NULL, &ctx)) return 1; if (ctx.refreshRateData) free(ctx.refreshRateData); if (ctx.pluginData) free(ctx.pluginData); compAddMetadataFromFile(&coreMetadata, "core"); if (!initCore()) return 1; coreInitialized = TRUE; if (!addDisplay(displayName)) return 1; return 0; }
/** * Parse the arguments set by @ref ecore_app_args_set and set properties * accordingly. * * @return @c ECORE_CONFIG_PARSE_CONTINUE if successful. * @c ECORE_CONFIG_PARSE_EXIT is returned if an unrecognised option * is found. @c ECORE_CONFIG_PARSE_HELP is returned if help was * displayed. */ int ecore_config_args_parse(void) { int argc; char **argv; int nextarg, next_short_opt, found, ret; char *arg; char *long_opt, short_opt; Ecore_Config_Prop *prop; _Ecore_Config_Arg_Callback *callback; ecore_app_args_get(&argc, &argv); nextarg = 1; while (nextarg < argc) { arg = argv[nextarg]; if (*arg != '-') { ERR("Unexpected attribute \"%s\"", arg); nextarg++; continue; } next_short_opt = 1; short_opt = *(arg + next_short_opt); if (short_opt == '-') { long_opt = arg + 2; if (!strcmp(long_opt, "help")) { ecore_config_args_display(); return ECORE_CONFIG_PARSE_HELP; } found = 0; prop = __ecore_config_bundle_local->data; while (prop) { if ((prop->long_opt && !strcmp(long_opt, prop->long_opt)) || !strcmp(long_opt, prop->key)) { found = 1; if ((ret = ecore_config_parse_set(prop, argv[++nextarg], long_opt, '\0')) != ECORE_CONFIG_PARSE_CONTINUE) return ret; break; } prop = prop->next; } if (!found) { callback = _ecore_config_arg_callbacks; while (callback) { if ((callback->long_opt && !strcmp(long_opt, callback->long_opt))) { found = 1; if (callback->type == ECORE_CONFIG_NIL) { callback->func(NULL, callback->data); } else { if (!argv[++nextarg]) { ERR("Missing expected argument for option --%s", long_opt); return ECORE_CONFIG_PARSE_EXIT; } callback->func(argv[nextarg], callback->data); } break; } callback = callback->next; } } if (!found) { ERR("Unrecognised option \"%s\"", long_opt); ERR("Try using -h or --help for more information.\n"); return ECORE_CONFIG_PARSE_EXIT; } } else { while (short_opt) { if (short_opt == 'h') { ecore_config_args_display(); return ECORE_CONFIG_PARSE_HELP; } else { found = 0; prop = __ecore_config_bundle_local->data; while (prop) { if (short_opt == prop->short_opt) { found = 1; if ((ret = ecore_config_parse_set(prop, argv[++nextarg], NULL, short_opt)) != ECORE_CONFIG_PARSE_CONTINUE) return ret; break; } prop = prop->next; } if (!found) { callback = _ecore_config_arg_callbacks; while (callback) { if (short_opt == callback->short_opt) { found = 1; if (callback->type == ECORE_CONFIG_NIL) { callback->func(NULL, callback->data); } else { if (!argv[++nextarg]) { ERR("Missing expected argument for option -%c", short_opt); return ECORE_CONFIG_PARSE_EXIT; } callback->func(argv[nextarg], callback->data); } break; } callback = callback->next; } } if (!found) { ERR("Unrecognised option '%c'", short_opt); ERR("Try using -h or --help for more information.\n"); return ECORE_CONFIG_PARSE_EXIT; } } short_opt = *(arg + ++next_short_opt); } } nextarg++; } return ECORE_CONFIG_PARSE_CONTINUE; }