--- kdebase/kwin/kompmgr/kompmgr.c.rhel4 2012-09-06 22:02:37.201586743 +0200 +++ kdebase/kwin/kompmgr/kompmgr.c 2012-09-06 22:04:39.529337359 +0200 @@ -89,6 +89,8 @@ #include #endif +#define ShapeInput 2 + typedef enum { WINTYPE_DESKTOP, WINTYPE_DOCK, @@ -403,6 +405,70 @@ #endif } +void +loadConfig(char *filename){ + FILE *file = NULL; + char line[ 1024 ]; + size_t length = 0; + Bool wasNull = False; + Bool section = False; + + if( filename == NULL ){ +#ifdef USE_ENV_HOME + const char *home = getenv("HOME"); +#else + const char *home; + struct passwd *p; + p = getpwuid(getuid()); + if (p) + home = p->pw_dir; + else + home = getenv("HOME"); +#endif + const char *configfile = "/.xcompmgrrc"; + int n = strlen(home)+strlen(configfile)+1; + filename = (char*)malloc(n*sizeof(char)); + memset(filename,0,n); + wasNull = True; + + strcat(filename, home); + strcat(filename, configfile); + } + + printf("trying '%s' as configfile\n\n", filename); + + if( (file = fopen(filename, "r")) == NULL ){ + printf("failed to open config file. does it exist?\n"); + if( wasNull ){ + free(filename); + filename = NULL; + } + return; + } + + /*find section*/ + while( !section && fgets(line, 1023, file) != NULL ){ + if( strcmp(line, "[xcompmgr]\n") == 0 ) + section = True; + } + /*read and set values*/ + while( section && fgets(line, 1023, file) != NULL ){ + int ret = strlen( line ); + if( ret > 1 ){ + if( *line == '[' )/*found new section - maybe check for '\n'?*/ + break; + *(line+ret-1) = '\0'; + setParameter(line); + } + } + printf("\nfinished parsing the config file\n"); + fclose(file); + if( wasNull ){ + free(filename); + filename = NULL; + } +} + void handle_siguser (int sig) { int uidnum; @@ -2992,69 +3058,6 @@ return 0; } -void -loadConfig(char *filename){ - FILE *file = NULL; - char line[ 1024 ]; - size_t length = 0; - Bool wasNull = False; - Bool section = False; - - if( filename == NULL ){ -#ifdef USE_ENV_HOME - const char *home = getenv("HOME"); -#else - const char *home; - struct passwd *p; - p = getpwuid(getuid()); - if (p) - home = p->pw_dir; - else - home = getenv("HOME"); -#endif - const char *configfile = "/.xcompmgrrc"; - int n = strlen(home)+strlen(configfile)+1; - filename = (char*)malloc(n*sizeof(char)); - memset(filename,0,n); - wasNull = True; - - strcat(filename, home); - strcat(filename, configfile); - } - - printf("trying '%s' as configfile\n\n", filename); - - if( (file = fopen(filename, "r")) == NULL ){ - printf("failed to open config file. does it exist?\n"); - if( wasNull ){ - free(filename); - filename = NULL; - } - return; - } - - /*find section*/ - while( !section && fgets(line, 1023, file) != NULL ){ - if( strcmp(line, "[xcompmgr]\n") == 0 ) - section = True; - } - /*read and set values*/ - while( section && fgets(line, 1023, file) != NULL ){ - int ret = strlen( line ); - if( ret > 1 ){ - if( *line == '[' )/*found new section - maybe check for '\n'?*/ - break; - *(line+ret-1) = '\0'; - setParameter(line); - } - } - printf("\nfinished parsing the config file\n"); - fclose(file); - if( wasNull ){ - free(filename); - filename = NULL; - } -} void usage (char *program)