Mercurial > mxe-octave
view src/stable-octave-2-xerror.patch @ 3601:2d148d18a8b6
of-optim: update to 1.3.1
* src/of-optim.mk: update to 1.3.1
* dist-files.mk: removed of-optim-1-fixes.patch.
* src/of-optim-1-fixes.patch: removed.
* build_packages.m: update optim to 1.3.1.
author | John Donoghue |
---|---|
date | Tue, 03 Jun 2014 09:07:05 -0400 |
parents | f46a7bbfc491 |
children |
line wrap: on
line source
diff --git a/libgui/src/octave-gui.cc b/libgui/src/octave-gui.cc --- a/libgui/src/octave-gui.cc +++ b/libgui/src/octave-gui.cc @@ -85,42 +85,11 @@ int m_result; }; -#if ! defined (__WIN32__) || defined (__CYGWIN__) -static int fdstderr = -1; -#endif +// Disable all Qt messages by default. -// Custom message handler for filtering some messages from Qt. - -void +static void message_handler (QtMsgType type, const char *msg) { -#if ! defined (__WIN32__) || defined (__CYGWIN__) - static FILE *errstream = fdopen (fdstderr, "a+"); -#else - static FILE *errstream = stderr; -#endif - - switch (type) - { - case QtDebugMsg: - gnulib::fprintf (errstream, "Debug: %s\n", msg); - break; - - case QtWarningMsg: - gnulib::fprintf (errstream, "Warning: %s\n", msg); - break; - - case QtCriticalMsg: - gnulib::fprintf (errstream, "Critical: %s\n", msg); - break; - - case QtFatalMsg: - gnulib::fprintf (errstream, "Fatal: %s\n", msg); - abort (); - - default: - break; - } } // If START_GUI is false, we still set up the QApplication so that we @@ -131,14 +100,11 @@ { octave_thread_manager::block_interrupt_signal (); -#if ! defined (__WIN32__) || defined (__CYGWIN__) - // Store the file descriptor associated with the STDERR stream. Send - // Qt messages there instead of to the STDERR stream that will be - // associated with the GUI command window. - fdstderr = gnulib::dup (STDERR_FILENO); -#endif + std::string show_gui_msgs = octave_env::getenv ("OCTAVE_SHOW_GUI_MESSAGES"); - qInstallMsgHandler (message_handler); + // Installing our handler suppresses the messages. + if (show_gui_msgs.empty ()) + qInstallMsgHandler (message_handler); if (start_gui) { diff --git a/libinterp/dldfcn/__init_fltk__.cc b/libinterp/dldfcn/__init_fltk__.cc --- a/libinterp/dldfcn/__init_fltk__.cc +++ b/libinterp/dldfcn/__init_fltk__.cc @@ -42,6 +42,10 @@ #ifdef HAVE_FLTK +#if defined (HAVE_X_WINDOWS) +#include <X11/Xlib.h> +#endif + #include <map> #include <set> #include <sstream> @@ -73,6 +77,7 @@ #include "cmd-edit.h" #include "lo-ieee.h" +#include "oct-env.h" #include "display.h" #include "file-ops.h" @@ -674,6 +679,14 @@ Fl_Menu_Bar* menubar; }; +#if defined (HAVE_X_WINDOWS) +static int +xerror_handler (Display *, XErrorEvent *) +{ + return 0; +} +#endif + class plot_window : public Fl_Window { friend class fltk_uimenu; @@ -762,7 +775,18 @@ // Set WM_CLASS which allows window managers to properly group // related windows. Otherwise, the class is just "FLTK" xclass ("Octave"); + + std::string show_gui_msgs + = octave_env::getenv ("OCTAVE_SHOW_GUI_MESSAGES"); + +#if defined (HAVE_X_WINDOWS) + // Installing our handler suppresses the messages. + if (show_gui_msgs.empty ()) + XSetErrorHandler (xerror_handler); +#endif + show (); + if (fp.get_currentaxes ().ok ()) show_canvas (); else