示例#1
0
void str2ul_anything(t_str2ul *x, t_symbol *s, long argc, t_atom *argv)
{
	long i;
	char temp[4096];
	
	x->s_hotbuf[0] = 0;
	strcpy(x->s_hotbuf, s->s_name);
	for(i = 0; i < argc; i++){
		strcat(x->s_hotbuf, " ");
		temp[0] = 0;
		if(argv[i].a_type == A_LONG){
			sprintf(temp, "%ld", argv[i].a_w.w_long);
		}else if(argv[i].a_type == A_FLOAT){
			sprintf(temp, "%.6f", argv[i].a_w.w_float);	
		}else if(argv[i].a_type = A_SYM){
			strcpy(temp, argv[i].a_w.w_sym->s_name);
		}
		if((strlen(x->s_hotbuf) + strlen(temp)) < 4096){
			strcat(x->s_hotbuf, temp);
		}else{
			return;
		}
	}
	str_action(x);

}
示例#2
0
void strpbrk_int(t_strpbrk *x, long n)
{
	x->s_inletNumber = MP_PROXY_GETINLET(x);
	
	if(x->s_inletNumber == 0){
		sprintf(x->s_hotbuf, "%ld", n);	
		str_action(x);
	}else if(x->s_inletNumber == 1){
		sprintf(x->s_coldbuf, "%ld", n);
	}
}
示例#3
0
void strpbrk_float(t_strpbrk *x, double f)
{
	x->s_inletNumber = MP_PROXY_GETINLET(x);
	
	if(x->s_inletNumber == 0){
		sprintf(x->s_hotbuf, "%.6f", f);	
		str_action(x);
	}else if(x->s_inletNumber == 1){
		sprintf(x->s_coldbuf, "%.6f", f);
	}
}
示例#4
0
void strpbrk_anything(t_strpbrk *x, t_symbol *s, long argc, t_atom *argv)
{
	long i;
	char temp[4096];
	
	x->s_inletNumber = MP_PROXY_GETINLET(x);
	
	if(x->s_inletNumber == 0){
		x->s_hotbuf[0] = 0;
		strcpy(x->s_hotbuf, s->s_name);
		for(i = 0; i < argc; i++){
			strcat(x->s_hotbuf, " ");
			temp[0] = 0;
			if(argv[i].a_type == A_LONG){
				sprintf(temp, "%lld", argv[i].a_w.w_long);
			}else if(argv[i].a_type == A_FLOAT){
				sprintf(temp, "%.6f", argv[i].a_w.w_float);	
			}else if(argv[i].a_type == A_SYM){
				strcpy(temp, argv[i].a_w.w_sym->s_name);
			}
			if((strlen(x->s_hotbuf) + strlen(temp)) < 4096){
				strcat(x->s_hotbuf, temp);
			}else{
				return;
			}
		}
		str_action(x);
	}else if(x->s_inletNumber == 1){	
		x->s_coldbuf[0] = 0;
		strcpy(x->s_coldbuf, s->s_name);
		for(i = 0; i < argc; i++){
			strcat(x->s_coldbuf, " ");
			temp[0] = 0;
			if(argv[i].a_type == A_LONG){
				sprintf(temp, "%lld", argv[i].a_w.w_long);
			}else if(argv[i].a_type == A_FLOAT){
				sprintf(temp, "%.6f", argv[i].a_w.w_float);	
			}else if(argv[i].a_type == A_SYM){
				strcpy(temp, argv[i].a_w.w_sym->s_name);
			}
			if((strlen(x->s_coldbuf) + strlen(temp)) < 4096){
				strcat(x->s_coldbuf, temp);
			}else{
				return;
			}
		}
	}
}
示例#5
0
char *
str_lower(char *s)
{
	return str_action(s, tolower);
}
示例#6
0
char *
str_upper(char *s)
{
	return str_action(s, toupper);
}
示例#7
0
void str2ul_float(t_str2ul *x, double f)
{
	sprintf(x->s_hotbuf, "%.6f", f);	
	str_action(x);
}
示例#8
0
void str2ul_int(t_str2ul *x, long n)
{	
	sprintf(x->s_hotbuf, "%ld", n);	
	str_action(x);
}
示例#9
0
void str2ul_bang(t_str2ul *x)
{	
	str_action(x);
}
示例#10
0
void strpbrk_bang(t_strpbrk *x)
{
	str_action(x);
}
示例#11
0
void memset_bang(t_memset *x)
{
	str_action(x);
}
示例#12
0
void strstr_bang(t_strstr *x)
{
	str_action(x);
}
示例#13
0
void memcpy_bang(t_memcpy *x)
{
	str_action(x);
}
示例#14
0
文件: config.c 项目: segin/matwm2
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);
}