Add WXSUPPRESS_GTK_DIAGNOSTICS environment variable
This allows to suppress some or all GTK diagnostics even for the programs not calling GTKSuppressDiagnostics() nor even GTKAllowDiagnosticsControl() themselves.
This commit is contained in:
parent
95bd6d4cfa
commit
4ffad5074f
3 changed files with 24 additions and 0 deletions
|
|
@ -45,6 +45,12 @@ wxWidgets programs.
|
|||
This can be helpful when running older programs recompiled with
|
||||
wxWidgets 3.1 or later, as these asserts are mostly harmless and can
|
||||
be safely ignored if the code works as expected.}
|
||||
@itemdef{WXSUPPRESS_GTK_DIAGNOSTICS,
|
||||
If set to a non-zero value, wxApp::GTKSuppressDiagnostics() is called
|
||||
on program startup using the numeric value of this variable or the
|
||||
default value if it's not a number, so that e.g. setting it to "yes"
|
||||
suppresses all GTK diagnostics while setting it to 16 only suppresses
|
||||
GTK warning messages.}
|
||||
*/
|
||||
|
||||
@see wxSystemOptions
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,11 @@ public:
|
|||
This function can be called to suppress GTK diagnostic messages that
|
||||
are output on the standard error stream by default.
|
||||
|
||||
If @c WXSUPPRESS_GTK_DIAGNOSTICS environment variable is set to a
|
||||
non-zero value, wxWidgets automatically calls this function on program
|
||||
startup with the value of this variable as @a flags if it's a number or
|
||||
with the default flags value otherwise.
|
||||
|
||||
The default value of the argument disables all messages, but you
|
||||
can pass in a mask flag to specifically disable only particular
|
||||
categories of messages.
|
||||
|
|
|
|||
|
|
@ -392,6 +392,19 @@ bool wxApp::OnInitGui()
|
|||
}
|
||||
#endif
|
||||
|
||||
// Suppress GTK diagnostics if requested: this is convenient if the program
|
||||
// doesn't use GTKAllowDiagnosticsControl() itself.
|
||||
wxString suppress;
|
||||
if ( wxGetEnv("WXSUPPRESS_GTK_DIAGNOSTICS", &suppress) )
|
||||
{
|
||||
long flags;
|
||||
if ( !suppress.ToLong(&flags) )
|
||||
flags = -1; // Suppress everything by default.
|
||||
|
||||
if ( flags != 0 )
|
||||
GTKSuppressDiagnostics(flags);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue