Esempio n. 1
0
 static int compareFontFamilyString(const void* key, const void* element)
 {
     CFX_ByteString str_key((FX_LPCSTR)key);
     if (str_key.Find(((_AltFontFamily*)element)->m_pFontName) != -1) {
         return 0;
     }
     return FXSYS_stricmp((FX_LPCSTR)key, ((_AltFontFamily*)element)->m_pFontName);
 }
Esempio n. 2
0
struct t_hashtable *
weechat_js_object_to_hashtable (v8::Handle<v8::Object> obj,
                                int size,
                                const char *type_keys,
                                const char *type_values)
{
    struct t_hashtable *hashtable;
    unsigned int i;
    v8::Handle<v8::Array> keys;
    v8::Handle<v8::Value> key, value;

    hashtable = weechat_hashtable_new (size, type_keys, type_values,
                                       NULL, NULL);

    if (!hashtable)
        return NULL;

    keys = obj->GetPropertyNames();
    for (i = 0; i < keys->Length(); i++)
    {
        key = keys->Get(i);
        value = obj->Get(key);
        v8::String::Utf8Value str_key(key);
        v8::String::Utf8Value str_value(value);
        if (strcmp (type_values, WEECHAT_HASHTABLE_STRING) == 0)
        {
            weechat_hashtable_set (hashtable, *str_key, *str_value);
        }
        else if (strcmp (type_values, WEECHAT_HASHTABLE_POINTER) == 0)
        {
            weechat_hashtable_set (hashtable, *str_key,
                                   plugin_script_str2ptr (weechat_js_plugin,
                                                          NULL, NULL,
                                                          *str_value));
        }
    }

    return hashtable;
}
Esempio n. 3
0
void cfg_set_opt(char *key, char *value, int initial) {
	#ifdef USE_XFT
	XftFont *newxftfont;
	#endif
	XFontStruct *newfont;
	long i;
	if(strcmp(key, "resetkeys") == 0)
		keys_free();
	if(!value)
		return;
	if(strcmp(key, "key") == 0)
		key_bind(value);
	if(strcmp(key, "exec") == 0 && initial)
		spawn(value);
	if(strcmp(key, "exec_onload") == 0)
		spawn(value);
	if(strcmp(key, "background") == 0)
		str_color(value, &bg);
	if(strcmp(key, "inactive_background") == 0)
		str_color(value, &ibg);
	if(strcmp(key, "foreground") == 0)
		str_color(value, &fg);
	if(strcmp(key, "inactive_foreground") == 0)
		str_color(value, &ifg);
	if(strcmp(key, "border_color") == 0)
		str_color(value, &bfg);
	if(strcmp(key, "inactive_border_color") == 0)
		str_color(value, &ibfg);
	if(strcmp(key, "font") == 0) {
		newfont = XLoadQueryFont(dpy, value);
		if(newfont) {
			if(font)
				XFreeFont(dpy, font);
			#ifdef USE_XFT
			if(xftfont) {
				XftFontClose(dpy, xftfont);
				xftfont = NULL;
			}
			#endif
			font = newfont;
		}
		#ifdef USE_XFT
		else {
			newxftfont = XftFontOpenName(dpy, screen, value);
			if(newxftfont) {
				if(xftfont)
					XftFontClose(dpy, xftfont);
				if(font) {
					XFreeFont(dpy, font);
					font = NULL;
				}
				xftfont = newxftfont;
			}
		}
		#endif
	}
	if(strcmp(key, "border_width") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
		  border_width = i;
	}
	if(strcmp(key, "border_spacing") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
			border_spacing = i;
	}
	if(strcmp(key, "title_spacing") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
			title_spacing = i;
	}
	if(strcmp(key, "button_spacing") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
			button_spacing = i;
	}
	if(strcmp(key, "wlist_margin") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
			wlist_margin = i;
	}
	if(strcmp(key, "wlist_maxwidth") == 0) {
		i = strtol(value, NULL, 0);
		if(i >= 0)
			wlist_maxwidth = i;
	}
	if(strcmp(key, "doubleclick_time") == 0) {
		i = strtol(value, NULL, 0);
		if(i > 0)
			doubleclick_time = i;
	}
	if(strcmp(key, "snap") == 0)
		snapat = strtol(value, NULL, 0);
	if(strcmp(key, "desktops") == 0) {
		i = strtol(value, NULL, 0);
		if(i > 0)
			dc = i;
	}
	if(strcmp(key, "ewmh_screen") == 0) {
		i = strtol(value, NULL, 0);
		if(i > 0)
			ewmh_screen = i;
	}
	if(strcmp(key, "button1") == 0)
	 	str_action(value, &button1);
	if(strcmp(key, "button2") == 0)
		str_action(value, &button2);
	if(strcmp(key, "button3") == 0)
		str_action(value, &button3);
	if(strcmp(key, "button4") == 0)
		str_action(value, &button4);
	if(strcmp(key, "button5") == 0)
		str_action(value, &button5);
	if(strcmp(key, "double1") == 0)
		str_action(value, &double1);
	if(strcmp(key, "double2") == 0)
		str_action(value, &double2);
	if(strcmp(key, "double3") == 0)
		str_action(value, &double3);
	if(strcmp(key, "double4") == 0)
		str_action(value, &double4);
	if(strcmp(key, "double5") == 0)
		str_action(value, &double5);
	if(strcmp(key, "root_button1") == 0)
	 	str_action(value, &root_button1);
	if(strcmp(key, "root_button2") == 0)
		str_action(value, &root_button2);
	if(strcmp(key, "root_button3") == 0)
		str_action(value, &root_button3);
	if(strcmp(key, "root_button4") == 0)
		str_action(value, &root_button4);
	if(strcmp(key, "root_button5") == 0)
		str_action(value, &root_button5);
	if(strcmp(key, "root_double1") == 0)
		str_action(value, &root_double1);
	if(strcmp(key, "root_double2") == 0)
		str_action(value, &root_double2);
	if(strcmp(key, "root_double3") == 0)
		str_action(value, &root_double3);
	if(strcmp(key, "root_double4") == 0)
		str_action(value, &root_double4);
	if(strcmp(key, "root_double5") == 0)
		str_action(value, &double5);
	if(strcmp(key, "click_focus") == 0)
		str_bool(value, &click_focus);
	if(strcmp(key, "click_raise") == 0)
		str_bool(value, &click_raise);
	if(strcmp(key, "focus_new") == 0)
		str_bool(value, &focus_new);
	if(strcmp(key, "fullscreen_stacking") == 0)
		str_fsstacking(value, &fullscreen_stacking);
	if(strcmp(key, "taskbar_ontop") == 0)
		str_bool(value, &taskbar_ontop);
	if(strcmp(key, "center_title") == 0)
		str_bool(value, &center_title);
	if(strcmp(key, "center_wlist_items") == 0)
		str_bool(value, &center_wlist_items);
	if(strcmp(key, "map_center") == 0)
		str_bool(value, &map_center);
	if(strcmp(key, "drag_warp") == 0)
		str_bool(value, &drag_warp);
	if(strcmp(key, "allow_focus_stealing") == 0)
		str_bool(value, &allow_focus_stealing);
	if(strcmp(key, "correct_center") == 0)
		str_bool(value, &correct_center);
	if(strcmp(key, "correct_center_unmanaged") == 0)
		str_bool(value, &correct_center_unmanaged);
	if(strcmp(key, "correct_center_separate") == 0)
		str_bool(value, &correct_center_separate);
	if(strcmp(key, "click_root") == 0)
		str_bool(value, &click_root);
	if(strcmp(key, "mouse_modifier") == 0)
		str_key(&value, &mousemodmask);
	if(strcmp(key, "no_snap_modifier") == 0)
		str_key(&value, &nosnapmodmask);
	if(strcmp(key, "ignore_modifier") == 0) {
		if(mod_ignore) {
			nmod_ignore = 0;
			free((void *) mod_ignore);
			mod_ignore = NULL;
		}
		while(value) {
			mod_ignore = (unsigned int *) _realloc((void *) mod_ignore, (nmod_ignore + nmod_ignore + 1) * sizeof(unsigned int));
			skiprealloc:
			mod_ignore[nmod_ignore] = str_modifier(eat(&value, " \t"));
			if(mod_ignore[nmod_ignore] == None)
				goto skiprealloc;
			for(i = 0; i < nmod_ignore; i++)
				mod_ignore[nmod_ignore + 1 + i] = mod_ignore[i] | mod_ignore[nmod_ignore];
			nmod_ignore += nmod_ignore + 1;
		}
	}
	if(strcmp(key, "buttons_left") == 0)
		str_buttons(value, &buttons_left, &nbuttons_left);
	if(strcmp(key, "buttons_right") == 0)
		str_buttons(value, &buttons_right, &nbuttons_right);
}