Hello, Here some documentation fixes and debug code cleanups in FvwmIconMan. Please see attached patch's ChangeLog section for more information.
Bye. -- Serge Koksharov, Free Software user & supporter GPG public key ID: 0x3D330896 (pgp.mit.edu) Key fingerprint: 5BC4 0475 CB03 6A31 0076 82C2 C240 72F0 3D33 0896
diff -Naur fvwmCVS-orig/modules/ChangeLog fvwmCVS-fixed/modules/ChangeLog --- fvwmCVS-orig/modules/ChangeLog 2006-08-07 11:54:31.000000000 +0400 +++ fvwmCVS-fixed/modules/ChangeLog 2006-08-07 20:59:43.000000000 +0400 @@ -1,3 +1,58 @@ +2006-08-07 Serge Koksharov <gentoosiast dog yandex dot ru> + + * FvwmIconMan/FvwmIconMan.1.in: + documented printdebug, refresh, searchback and searchforward builtin + commands. + fixed typos. + + * FvwmIconMan/FvwmIconMan.c (main): + changed ifdef from ELECTRIC_FENCE to HAVE_LIBEFENCE. + removed now useless 'ifdef DEBUG_ATTACH' construction with hardcoded + paths. + removed now useless 'if 0' construction. + (PrintMemuse): + fixed compiler warning. + + * FvwmIconMan/FvwmIconMan.h: + changed ifdef from DMALLOC to HAVE_DMALLOC_H. + + * FvwmIconMan/debug.c (ConsoleDebug): + * FvwmIconMan/globals.c (print_managers): + * FvwmIconMan/readconfig.c (parse_format_dependencies): + (print_args): + (print_binding): + * FvwmIconMan/winlist.c (iconmanager_show): + * FvwmIconMan/xmanager.c (check_managers_consistency): + (print_button_info): + changed ifdefs from PRINT_DEBUG to FVWM_DEBUG_MSGS. + + * FvwmIconMan/debug.h: + removed now useless 'if 0' construction. + + * FvwmIconMan/debuglevels.h: + fixed typo. + + * FvwmIconMan/functions.c (builtin_gotomanager): + fixed typo in debug message. + + * FvwmIconMan/globals.c: + removed useless commented definitions of Module & ModuleLen which now + aren't hardcoded. + + * FvwmIconMan/readconfig.c: + removed ancient 'if FVWM_VERSION == 1' construction. + (print_binding): + compilation fix. + fixed compiler warnings. + + * FvwmIconMan/xmanager.c (print_buttons): + removed (this function defined but isn't used anywhere in the + code and its functionality superseded by print_button_info + function). + fixed compiler warnings. + (print_button_info): + fixed compiler warnings. + 2006-08-05 Serge Koksharov <gentoosiast dog yandex dot ru> * FvwmIconMan/FvwmIconMan.1.in: diff -Naur fvwmCVS-orig/modules/FvwmIconMan/debug.c fvwmCVS-fixed/modules/FvwmIconMan/debug.c --- fvwmCVS-orig/modules/FvwmIconMan/debug.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/debug.c 2006-08-07 15:25:18.000000000 +0400 @@ -60,7 +60,7 @@ { assert(console != NULL); -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS if (flag) { va_list args; diff -Naur fvwmCVS-orig/modules/FvwmIconMan/debug.h fvwmCVS-fixed/modules/FvwmIconMan/debug.h --- fvwmCVS-orig/modules/FvwmIconMan/debug.h 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/debug.h 2006-08-07 15:26:52.000000000 +0400 @@ -3,10 +3,6 @@ #define IN_DEBUG_H #if 0 -# define PRINT_DEBUG -#endif - -#if 0 # define OUTPUT_FILE "/dev/console" /* # define OUTPUT_FILE "/tmp/FvwmIconMan" */ #else diff -Naur fvwmCVS-orig/modules/FvwmIconMan/debuglevels.h fvwmCVS-fixed/modules/FvwmIconMan/debuglevels.h --- fvwmCVS-orig/modules/FvwmIconMan/debuglevels.h 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/debuglevels.h 2006-08-07 20:59:42.000000000 +0400 @@ -9,7 +9,7 @@ /* I'm finding lots of the debugging is dereferencing pointers to zero. I fixed some of them, until I grew tired of the game. - If you want to turn these back on, be perpared for lots of core + If you want to turn these back on, be prepared for lots of core dumps. dje 11/15/98. */ int CORE = 0; int FUNCTIONS = 0; diff -Naur fvwmCVS-orig/modules/FvwmIconMan/functions.c fvwmCVS-fixed/modules/FvwmIconMan/functions.c --- fvwmCVS-orig/modules/FvwmIconMan/functions.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/functions.c 2006-08-07 13:51:25.000000000 +0400 @@ -221,7 +221,7 @@ case SelectButton: case FocusButton: ConsoleMessage( - "gotomanger: \"select\" or \"focus\" does not specify" + "gotomanager: \"select\" or \"focus\" does not specify" " a manager\n"); break; diff -Naur fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.1.in fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.1.in --- fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.1.in 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.1.in 2006-08-07 20:40:43.000000000 +0400 @@ -101,7 +101,7 @@ Font 8x13 Foreground default text color white Format describes button label "%c: %i" -IconName manger icon name FvwmIconMan +IconName manager icon name FvwmIconMan IconButton style for icon buttons up black grey IconColorset ManagerGeometry size of manager in buttons 0x1 @@ -150,7 +150,7 @@ for all managers. .IP "*FvwmIconMan: ManagerId OptionName OptionValue" To specify that the option \fIOptionName\fP takes the value \fIOptionValue\fP -for manager \fIManagerId\fP. \fIMangerId\fP may either be a positive integer, +for manager \fIManagerId\fP. \fIManagerId\fP may either be a positive integer, or the string "transient". An integer id refers to managers which FvwmIconMan creates when running normally, and an id of "transient" refers to the single manager which FvwmIconMan creates when running transiently. @@ -578,12 +578,28 @@ .IP "print \fIString\fP" Prints \fIString\fP to the console. Useful for debugging actions. +.IP "printdebug" +Prints defined actions to the console. Should only be used by developers. +To enable this command, set CONFIG and FUNCTIONS variables to '1' in the +modules/FvwmIconMan/debuglevels.h and recompile this module. + .IP "quit" Quits FvwmIconMan. +.IP "refresh" +Causes all manager windows to redraw themselves. + .IP "ret" Stop executing the entire action. +.IP "searchback \fIString\fP" +Sets button to button before the current one whose printed string in the +manager window matches specified \fIString\fP, which may contain wildcards. + +.IP "searchforward \fIString\fP" +Sets button to button after the current one whose printed string in the +manager window matches specified \fIString\fP, which may contain wildcards. + .IP "select" Selects the current button, if any. If a select action has been specified, it will then be run. Therefore, it is considered unwise to set the select diff -Naur fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.c fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.c --- fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.c 2006-08-07 19:44:58.000000000 +0400 @@ -92,7 +92,7 @@ void PrintMemuse(void) { - ConsoleDebug(CORE, "Memory used: %d\n", MemUsed); + ConsoleDebug(CORE, "Memory used: %ld\n", MemUsed); } #else @@ -205,42 +205,17 @@ char *s; int i; -#ifdef ELECTRIC_FENCE +#ifdef HAVE_LIBEFENCE extern int EF_PROTECT_BELOW, EF_PROTECT_FREE; EF_PROTECT_BELOW = 1; EF_PROTECT_FREE = 1; #endif -#ifdef DEBUG_ATTACH - { - char buf[256]; - sprintf(buf, "%d", getpid()); - if (fork() == 0) - { - chdir("/home/bradym/src/FvwmIconMan"); - execl( - "/usr/local/bin/ddd", "/usr/local/bin/ddd", - "FvwmIconMan", buf, NULL); - } - else - { - int i, done = 0; - for (i = 0; i < (1 << 27) && !done; i++) ; - } - } -#endif - FlocaleInit(LC_CTYPE, "", "", "FvwmIconMan"); OpenConsole(OUTPUT_FILE); -#if 0 - ConsoleMessage("PID = %d\n", getpid()); - ConsoleMessage("Waiting for GDB to attach\n"); - sleep(10); -#endif - init_globals(); init_winlists(); diff -Naur fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.h fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.h --- fvwmCVS-orig/modules/FvwmIconMan/FvwmIconMan.h 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/FvwmIconMan.h 2006-08-07 17:37:20.000000000 +0400 @@ -47,8 +47,7 @@ #endif -#ifdef DMALLOC -/* What the heck is this?? */ +#ifdef HAVE_DMALLOC_H #include <dmalloc.h> #endif diff -Naur fvwmCVS-orig/modules/FvwmIconMan/globals.c fvwmCVS-fixed/modules/FvwmIconMan/globals.c --- fvwmCVS-orig/modules/FvwmIconMan/globals.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/globals.c 2006-08-07 20:50:46.000000000 +0400 @@ -36,9 +36,7 @@ int fvwm_fd[2]; int x_fd; -/* char *Module = "*FvwmIconMan"; */ char *Module; -/* int ModuleLen = 12; */ int ModuleLen; /* This is solely so that we can turn a string constant into something @@ -95,7 +93,7 @@ void print_managers(void) { -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS int i; for (i = 0; i < globals.num_managers; i++) diff -Naur fvwmCVS-orig/modules/FvwmIconMan/readconfig.c fvwmCVS-fixed/modules/FvwmIconMan/readconfig.c --- fvwmCVS-orig/modules/FvwmIconMan/readconfig.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/readconfig.c 2006-08-07 19:59:10.000000000 +0400 @@ -81,11 +81,6 @@ static int num_builtins = sizeof(builtin_functions) / sizeof(FunctionType); -#if FVWM_VERSION == 1 -static FILE *config_fp = NULL; -#endif - - /* This is only used for printing out the .fvwmrc line if an error occured */ @@ -112,7 +107,7 @@ void print_args(int numargs, BuiltinArg *args) { -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS int i; for (i = 0; i < numargs; i++) { @@ -168,13 +163,13 @@ #endif } -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS static void print_binding(Binding *binding) { int i; Function *func; - if (binding->type == MOUSE_BINDING) + if (binding->type == BIND_BUTTONPRESS) { ConsoleDebug(CONFIG, "\tMouse: %d\n", binding->Button_Key); } @@ -186,8 +181,9 @@ } ConsoleDebug(CONFIG, "\tModifiers: %d\n", binding->Modifier); - ConsoleDebug(CONFIG, "\tAction: %s\n", binding->Action); - ConsoleDebug(CONFIG, "\tFunction struct: 0x%x\n", binding->Action2); + ConsoleDebug(CONFIG, "\tAction: %s\n", (char *) binding->Action); + ConsoleDebug(CONFIG, "\tFunction struct: 0x%x\n", + (unsigned int) binding->Action2); func = (Function *)(binding->Action2); while (func) { @@ -197,7 +193,8 @@ { ConsoleDebug( CONFIG, "\tFunction: %s 0x%x ", - builtin_functions[i].name, func->func); + builtin_functions[i].name, + (unsigned int) func->func); break; } } @@ -205,7 +202,7 @@ { ConsoleDebug( CONFIG, "\tFunction: not found 0x%x ", - func->func); + (unsigned int) func->func); } print_args(func->numargs, func->args); func = func->next; @@ -1037,7 +1034,7 @@ } } } -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS ConsoleDebug(CONFIG, "Format depends on: "); if (flags & ICON_NAME) { diff -Naur fvwmCVS-orig/modules/FvwmIconMan/winlist.c fvwmCVS-fixed/modules/FvwmIconMan/winlist.c --- fvwmCVS-orig/modules/FvwmIconMan/winlist.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/winlist.c 2006-08-07 15:28:16.000000000 +0400 @@ -206,14 +206,14 @@ assert (man); -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS ConsoleDebug (WINLIST, "In iconmanager_show: %s:%s : %s %s\n", tname, iname, rname, cname); ConsoleDebug (WINLIST, "dontshow:\n"); print_stringlist (&man->dontshow); ConsoleDebug (WINLIST, "show:\n"); print_stringlist (&man->show); -#endif /*PRINT_DEBUG*/ +#endif /* FVWM_DEBUG_MSGS */ for (string = man->dontshow.list; string; string = string->next) { ConsoleDebug (WINLIST, "Matching: %s\n", string->string); diff -Naur fvwmCVS-orig/modules/FvwmIconMan/xmanager.c fvwmCVS-fixed/modules/FvwmIconMan/xmanager.c --- fvwmCVS-orig/modules/FvwmIconMan/xmanager.c 2006-08-07 11:54:29.000000000 +0400 +++ fvwmCVS-fixed/modules/FvwmIconMan/xmanager.c 2006-08-07 15:33:41.000000000 +0400 @@ -2638,7 +2638,7 @@ void check_managers_consistency(void) { -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS int i, j; Button **b; @@ -2662,33 +2662,16 @@ static void print_button_info(Button *b) { -#ifdef PRINT_DEBUG +#ifdef FVWM_DEBUG_MSGS ConsoleMessage("button: %d\n", b->index); - ConsoleMessage("win: 0x%x\n", b->drawn_state.win); + ConsoleMessage("win: 0x%x\n", (unsigned int) b->drawn_state.win); ConsoleMessage("dirty: 0x%x\n", b->drawn_state.dirty_flags); if (b->drawn_state.win) { ConsoleMessage("name: %s\n", b->drawn_state.display_string); ConsoleMessage("iconified: %d state %d\n", b->drawn_state.iconified, b->drawn_state.state); - ConsoleMessage("win->button: 0x%x\n", b->drawn_state.win->button); + ConsoleMessage("win->button: 0x%x\n", + (unsigned int) b->drawn_state.win->button); } #endif } - -#ifdef PRINT_DEBUG -static void print_buttons(WinManager *man) -{ - int i; - Button *b; - - ConsoleMessage("Buttons for manager: %s\n", man->titlename); - - for (i = 0; i < man->buttons.num_buttons; i++) { - b = man->buttons.buttons[i]; - ConsoleMessage("Button: %d, index = %d\n", i, b->index); - ConsoleMessage("\tdirty flags: 0x%x\n", b->drawn_state.dirty_flags); - ConsoleMessage("\twin: 0x%x\n", b->drawn_state.win); - } -} -#endif -