Some debugging enabled.
Variable initialization. Moved font thread startup back to whence it came... for now.
This commit is contained in:
parent
59f242b1fa
commit
f6164dc9a4
1 changed files with 32 additions and 16 deletions
|
|
@ -301,7 +301,7 @@ extern WrapperData macosx;
|
||||||
#ifndef FORKED_FONTS
|
#ifndef FORKED_FONTS
|
||||||
static SDL_Thread *font_thread;
|
static SDL_Thread *font_thread;
|
||||||
#endif
|
#endif
|
||||||
static volatile long font_thread_done;
|
static volatile long font_thread_done = 0;
|
||||||
static void run_font_scanner(void);
|
static void run_font_scanner(void);
|
||||||
static int font_scanner_pid;
|
static int font_scanner_pid;
|
||||||
static int font_socket_fd;
|
static int font_socket_fd;
|
||||||
|
|
@ -1562,12 +1562,12 @@ typedef struct family_info {
|
||||||
static TTF_Font * medium_font, * small_font, * large_font, * locale_font;
|
static TTF_Font * medium_font, * small_font, * large_font, * locale_font;
|
||||||
|
|
||||||
static family_info **user_font_families;
|
static family_info **user_font_families;
|
||||||
static int num_font_families;
|
static int num_font_families = 0;
|
||||||
static int num_font_families_max;
|
static int num_font_families_max = 0;
|
||||||
|
|
||||||
static style_info **user_font_styles;
|
static style_info **user_font_styles;
|
||||||
static int num_font_styles;
|
static int num_font_styles = 0;
|
||||||
static int num_font_styles_max;
|
static int num_font_styles_max = 0;
|
||||||
|
|
||||||
static void receive_some_font_info(void);
|
static void receive_some_font_info(void);
|
||||||
|
|
||||||
|
|
@ -2024,7 +2024,8 @@ static void groupfonts(void)
|
||||||
parse_font_style(user_font_styles[i]);
|
parse_font_style(user_font_styles[i]);
|
||||||
|
|
||||||
qsort(user_font_styles, num_font_styles, sizeof user_font_styles[0], compar_fontgroup);
|
qsort(user_font_styles, num_font_styles, sizeof user_font_styles[0], compar_fontgroup);
|
||||||
printf("groupfonts() qsort(user_font_styles...)");
|
printf("groupfonts() qsort(user_font_styles...)\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
|
@ -2055,7 +2056,8 @@ static void groupfonts(void)
|
||||||
user_font_styles = NULL; // just to catch bugs
|
user_font_styles = NULL; // just to catch bugs
|
||||||
|
|
||||||
qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontkiller);
|
qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontkiller);
|
||||||
printf("groupfonts() qsort(user_font_families 1...)");
|
printf(stderr, "groupfonts() qsort(user_font_families 1...)\n");
|
||||||
|
fflush(stdout);
|
||||||
low = 0;
|
low = 0;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
|
@ -2073,7 +2075,8 @@ static void groupfonts(void)
|
||||||
low = high;
|
low = high;
|
||||||
}
|
}
|
||||||
qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontscore);
|
qsort(user_font_families, num_font_families, sizeof user_font_families[0], compar_fontscore);
|
||||||
printf("groupfonts() qsort(user_font_families 2...)");
|
printf("groupfonts() qsort(user_font_families 2...)\n");
|
||||||
|
fflush(stdout);
|
||||||
if(user_font_families[0]->score < 0)
|
if(user_font_families[0]->score < 0)
|
||||||
printf("sorted the wrong way, or all fonts were crap\n");
|
printf("sorted the wrong way, or all fonts were crap\n");
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -2558,6 +2561,10 @@ int main(int argc, char * argv[])
|
||||||
SDL_Rect dest;
|
SDL_Rect dest;
|
||||||
SDL_Rect src;
|
SDL_Rect src;
|
||||||
|
|
||||||
|
#ifdef FORKED_FONTS
|
||||||
|
run_font_scanner();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set up locale support */
|
/* Set up locale support */
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
|
@ -2566,9 +2573,7 @@ int main(int argc, char * argv[])
|
||||||
/* Set up! */
|
/* Set up! */
|
||||||
setup(argc, argv);
|
setup(argc, argv);
|
||||||
|
|
||||||
#ifdef FORKED_FONTS
|
|
||||||
run_font_scanner();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
while(!font_thread_done)
|
while(!font_thread_done)
|
||||||
|
|
@ -3133,13 +3138,12 @@ static void mainloop(void)
|
||||||
update_screen_rect(&r_toolopt);
|
update_screen_rect(&r_toolopt);
|
||||||
update_screen_rect(&r_ttoolopt);
|
update_screen_rect(&r_ttoolopt);
|
||||||
do_setcursor(cursor_watch);
|
do_setcursor(cursor_watch);
|
||||||
draw_tux_text(TUX_WAIT, "This is a slow computer with lots of fonts...", 1);
|
draw_tux_text(TUX_WAIT, gettext("Please wait..."), 1);
|
||||||
#ifdef FORKED_FONTS
|
#ifdef FORKED_FONTS
|
||||||
receive_some_font_info();
|
receive_some_font_info();
|
||||||
#else
|
#else
|
||||||
while(!font_thread_done)
|
while(!font_thread_done)
|
||||||
{
|
{
|
||||||
// FIXME: should respond to quit events
|
|
||||||
// FIXME: should have a read-depends memory barrier around here
|
// FIXME: should have a read-depends memory barrier around here
|
||||||
show_progress_bar();
|
show_progress_bar();
|
||||||
SDL_Delay(20);
|
SDL_Delay(20);
|
||||||
|
|
@ -6470,12 +6474,21 @@ static int charset_works(TTF_Font *font, const char *s)
|
||||||
surfs[count++] = tmp_surf;
|
surfs[count++] = tmp_surf;
|
||||||
}
|
}
|
||||||
was_bad_font = 0;
|
was_bad_font = 0;
|
||||||
printf("charset_works()");
|
printf("charset_works()\n");
|
||||||
|
fflush(stdout);
|
||||||
qsort(surfs, count, sizeof surfs[0], surfcmp);
|
qsort(surfs, count, sizeof surfs[0], surfcmp);
|
||||||
ret = !was_bad_font;
|
ret = !was_bad_font;
|
||||||
out:
|
out:
|
||||||
while(count--)
|
while(count--)
|
||||||
SDL_FreeSurface(surfs[count]);
|
{
|
||||||
|
if (surfs[count] == NULL)
|
||||||
|
printf("TRYING TO RE-FREE!");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_FreeSurface(surfs[count]);
|
||||||
|
surfs[count] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
free(surfs);
|
free(surfs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -6745,6 +6758,7 @@ static void loadfonts(const char * const dir)
|
||||||
{
|
{
|
||||||
char buf[TP_FTW_PATHSIZE];
|
char buf[TP_FTW_PATHSIZE];
|
||||||
unsigned dirlen = strlen(dir);
|
unsigned dirlen = strlen(dir);
|
||||||
|
|
||||||
memcpy(buf,dir,dirlen);
|
memcpy(buf,dir,dirlen);
|
||||||
tp_ftw(buf, dirlen, 1, loadfont_callback);
|
tp_ftw(buf, dirlen, 1, loadfont_callback);
|
||||||
}
|
}
|
||||||
|
|
@ -7405,6 +7419,8 @@ static void receive_some_font_info(void)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
family_info *fip;
|
family_info *fip;
|
||||||
|
|
||||||
|
printf("receive_some_font_info()\n");
|
||||||
|
|
||||||
fcntl(font_socket_fd, F_SETFL, O_NONBLOCK);
|
fcntl(font_socket_fd, F_SETFL, O_NONBLOCK);
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
|
@ -7414,7 +7430,7 @@ static void receive_some_font_info(void)
|
||||||
buf = realloc(buf, buf_size);
|
buf = realloc(buf, buf_size);
|
||||||
}
|
}
|
||||||
rc = read(font_socket_fd, buf+buf_fill, buf_size-buf_fill);
|
rc = read(font_socket_fd, buf+buf_fill, buf_size-buf_fill);
|
||||||
//printf("read: fd=%d buf_fill=%u buf_size=%u rc=%ld\n", font_socket_fd, buf_fill, buf_size, rc);
|
printf("read: fd=%d buf_fill=%u buf_size=%u rc=%ld\n", font_socket_fd, buf_fill, buf_size, rc);
|
||||||
if(rc==-1)
|
if(rc==-1)
|
||||||
{
|
{
|
||||||
switch(errno)
|
switch(errno)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue