On Tue, Nov 25, 2008 at 11:58:47PM +0000, Thomas Adam wrote:
> I've (perhaps crudely) implemented an option to BugOpts called
> TraceComplexFunctions.   Recently in #fvwm on irc.freenode.net,
> someone there had a nasty workaround in their file to stop some random
> application from taking focus, by using !FPFocusByFunction.  But not
> really knowing what it did, other than the effect it had, meant that
> most of his other complex functions weren't working if they were
> calling Focus.
[snip]

Good idea.  However, I see no reason to limit the debug output as
much:

  "function ('Function') called on window ('~/src/fvwm' : 0x800004)"

This isn't really helpful.  Why not simply print the while command
line that is being executed, and why limit it to just complex
functions (if that's what it does).  I'd rather have
"TraceFunctions" that prints *everything*.

--

The patch had some whitespace issues that I cleaned up in the
attached new patch:

 * long lines (> 80 characters)
 * identation by spaces instead of tabs
 * trailing whitespace
 * superfluous blank lines

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
Index: AUTHORS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v
retrieving revision 1.130
diff -u -r1.130 AUTHORS
--- AUTHORS	19 Oct 2008 12:04:12 -0000	1.130
+++ AUTHORS	26 Nov 2008 17:58:49 -0000
@@ -15,6 +15,7 @@
 StartShaded style option.
 Introduce the command expansion placeholder:  $[w.visiblename]
 Make style matching honour a window's visible name (c.f. $[w.visiblename])
+BugOpts TraceComplexFunctions options.
 
 Serge (gentoosiast) Koksharov:
 Documentation fixes, bug fixes.
Index: ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v
retrieving revision 1.3059
diff -u -r1.3059 ChangeLog
--- ChangeLog	19 Oct 2008 12:21:28 -0000	1.3059
+++ ChangeLog	26 Nov 2008 17:59:21 -0000
@@ -1,3 +1,21 @@
+2008-11-23  Thomas Adam <[EMAIL PROTECTED]>
+	
+	* AUTHORS:
+	* NEWS:
+	Mention user-visible option for BugOpts TraceComplexFunctions.
+
+	* fvwm/builtins.c (CMD_BugOpts):
+	Introduce the TraceComplexFunctions option to the BugOpts command.
+
+	* fvwm/screen.h:
+	Added a bitmask field to the ScreenInfo.bo struct to allow for BugOpts
+	reporting for TraceComplexFunctions.
+
+	* fvwm/functions.c (__execute_function):
+	Added fvwm_msg() routines to print the name of the function being
+	executed and the name and windowid of the window the function is running
+	on.
+
 2008-10-05  Thomas Adam <[EMAIL PROTECTED]>
 
 	* fvwm/style.c (fw_match_style_id):
Index: NEWS
===================================================================
RCS file: /home/cvs/fvwm/fvwm/NEWS,v
retrieving revision 1.765
diff -u -r1.765 NEWS
--- NEWS	19 Oct 2008 12:04:13 -0000	1.765
+++ NEWS	26 Nov 2008 17:59:24 -0000
@@ -9,7 +9,6 @@
 
    - New extended variable
        $[w.visiblename]
-
    - Style matching now honours the window's visible name which means it can
      be matched before the real name, hence:
 
@@ -18,6 +17,9 @@
         ... is now honoured.  Useful with IndexedWindowName as a style
         option.
 
+   - An option to BugOpts (TraceComplexFunctions) can be used to see which
+     functions are operating on a window for diagnostic purposes.
+
 * Bug fixes:
    - Fixed compilation without XRender support.
    - Fixed handling of _NET_MOVERESIZE_WINDOWS requests.
Index: doc/commands/BugOpts.xml
===================================================================
RCS file: /home/cvs/fvwm/fvwm/doc/commands/BugOpts.xml,v
retrieving revision 1.3
diff -u -r1.3 BugOpts.xml
--- doc/commands/BugOpts.xml	16 Jun 2007 12:38:45 -0000	1.3
+++ doc/commands/BugOpts.xml	26 Nov 2008 17:59:24 -0000
@@ -125,4 +125,11 @@
 you report a bug to the fvwm team we may ask you to enable this
 option.</para>
 
+<para>When the
+<fvwmopt cmd="BugOpts" opt="TraceComplexFunctions"/>
+option is enabled, fvwm will print to the console the name of the function
+currently running, and on which window, printing its name and its window id.
+This is useful sometimes to find out if a specific function is running on a
+window to help with diagnosing certain problems.</para>
+
 </section>
Index: fvwm/builtins.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/builtins.c,v
retrieving revision 1.431
diff -u -r1.431 builtins.c
--- fvwm/builtins.c	31 Jan 2008 22:02:00 -0000	1.431
+++ fvwm/builtins.c	26 Nov 2008 17:59:29 -0000
@@ -3701,6 +3701,22 @@
 				break;
 			}
 		}
+		else if (StrEquals(opt, "TraceComplexFunctions"))
+		{
+			switch (toggle)
+			{
+			case -1:
+				Scr.bo.do_trace_complex_functions ^=  1;
+				break;
+			case 0:
+			case 1:
+				Scr.bo.do_trace_complex_functions = toggle;
+				break;
+			default:
+				Scr.bo.do_trace_complex_functions = 0;
+				break;
+			}
+		}
 		else
 		{
 			fvwm_msg(ERR, "SetBugOptions",
Index: fvwm/functions.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/functions.c,v
retrieving revision 1.282
diff -u -r1.282 functions.c
--- fvwm/functions.c	5 Aug 2007 21:34:26 -0000	1.282
+++ fvwm/functions.c	26 Nov 2008 17:59:32 -0000
@@ -677,6 +677,17 @@
 						function);
 				}
 			}
+			if (
+				Scr.bo.do_trace_complex_functions &&
+				ecc.w.wcontext != C_ROOT )
+			{
+				fvwm_msg(
+					INFO, "TraceComplexFunction",
+					"function ('%s') called on window "
+					"('%s' : 0x%x )", function,
+					ecc.w.fw->name.name,
+					(int)FW_W(ecc.w.fw));
+			}
 			exc_destroy_context(exc2);
 		}
 	}
Index: fvwm/screen.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/screen.h,v
retrieving revision 1.158
diff -u -r1.158 screen.h
--- fvwm/screen.h	17 Nov 2007 11:47:56 -0000	1.158
+++ fvwm/screen.h	26 Nov 2008 17:59:32 -0000
@@ -480,6 +480,7 @@
 		unsigned do_explain_window_placement : 1;
 		unsigned do_install_root_cmap : 1;
 		unsigned do_raise_over_unmanaged : 1;
+		unsigned do_trace_complex_functions : 1;
 		unsigned is_modality_evil : 1;
 		unsigned is_raise_hack_needed : 1;
 	} bo; /* bug workaround control options */
Index: modules/ChangeLog
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/ChangeLog,v
retrieving revision 1.1276
diff -u -r1.1276 ChangeLog
--- modules/ChangeLog	22 Jun 2008 12:04:30 -0000	1.1276
+++ modules/ChangeLog	26 Nov 2008 17:59:45 -0000
@@ -1,3 +1,8 @@
+2008-10-21  Thomas Adam <[EMAIL PROTECTED]>
+	
+	* FvwmButtons/parse.c (ParseButton):
+	Allow for the Id of an individual button to be numeric.
+
 2008-05-22  Adam Goode  <adam(at)spicenitz(dot)org>
 
 	* FvwmScript/FvwmScript.c

Reply via email to