Hello all,
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.
What this user really wanted to do was nothing more than:
DestroyFunc EWMHActiveWindowFunc
After I found out it was Firefox doing (in this user's eyes) "odd
things". But of course, the user has no way of knowing at any given
time if a function is responsible for causing the problem -- more to
the point, if it's an inbuilt function as in the case of
EWMHActiveWindowFunc, that can be ever more annoying.
So I've written something simple that will spit out the following to
the console (or ~/.xsession-errors, etc., depending):
[fvwm][TraceComplexFunction]: function ('Deconstruct') called on
window ('Google Mail - Compose Mail - [EMAIL PROTECTED] -
Vimperator' : 0x20000bc )
[fvwm][TraceComplexFunction]: function ('Deconstruct') called on
window ('urxvt' : 0x2200008 )
[fvwm][TraceComplexFunction]: function ('Deconstruct') called on
window ('Google Mail - Compose Mail - [EMAIL PROTECTED] -
Vimperator' : 0x20000bc )
[fvwm][TraceComplexFunction]: function ('Deconstruct') called on
window ('urxvt' : 0x2200008 )
Who knows -- someone might find it useful. See patch attached.
-- Thomas Adam
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 25 Nov 2008 23:33:54 -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 25 Nov 2008 23:34: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 25 Nov 2008 23:34:24 -0000
@@ -17,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.
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 25 Nov 2008 23:34:25 -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 25 Nov 2008 23:34:31 -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 25 Nov 2008 23:34:33 -0000
static Bool DeferExecution(
exec_context_changes_t *ret_ecc, exec_context_change_mask_t *ret_mask,
@@ -677,6 +679,13 @@
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 25 Nov 2008 23:34:34 -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 25 Nov 2008 23:34:54 -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