comparison src/stable-octave-2-xerror.patch @ 3576:f46a7bbfc491

fix stable-octave-2-xerror.patch file
author John W. Eaton <jwe@octave.org>
date Thu, 10 Apr 2014 10:35:26 -0400
parents 1f59ee0070ef
children
comparison
equal deleted inserted replaced
3575:a247dc2d32c0 3576:f46a7bbfc491
1 diff --git a/libgui/src/octave-gui.cc b/libgui/src/octave-gui.cc
2 --- a/libgui/src/octave-gui.cc
3 +++ b/libgui/src/octave-gui.cc
4 @@ -85,42 +85,11 @@
5 int m_result;
6 };
7
8 -#if ! defined (__WIN32__) || defined (__CYGWIN__)
9 -static int fdstderr = -1;
10 -#endif
11 +// Disable all Qt messages by default.
12
13 -// Custom message handler for filtering some messages from Qt.
14 -
15 -void
16 +static void
17 message_handler (QtMsgType type, const char *msg)
18 {
19 -#if ! defined (__WIN32__) || defined (__CYGWIN__)
20 - static FILE *errstream = fdopen (fdstderr, "a+");
21 -#else
22 - static FILE *errstream = stderr;
23 -#endif
24 -
25 - switch (type)
26 - {
27 - case QtDebugMsg:
28 - gnulib::fprintf (errstream, "Debug: %s\n", msg);
29 - break;
30 -
31 - case QtWarningMsg:
32 - gnulib::fprintf (errstream, "Warning: %s\n", msg);
33 - break;
34 -
35 - case QtCriticalMsg:
36 - gnulib::fprintf (errstream, "Critical: %s\n", msg);
37 - break;
38 -
39 - case QtFatalMsg:
40 - gnulib::fprintf (errstream, "Fatal: %s\n", msg);
41 - abort ();
42 -
43 - default:
44 - break;
45 - }
46 }
47
48 // If START_GUI is false, we still set up the QApplication so that we
49 @@ -131,14 +100,11 @@
50 {
51 octave_thread_manager::block_interrupt_signal ();
52
53 -#if ! defined (__WIN32__) || defined (__CYGWIN__)
54 - // Store the file descriptor associated with the STDERR stream. Send
55 - // Qt messages there instead of to the STDERR stream that will be
56 - // associated with the GUI command window.
57 - fdstderr = gnulib::dup (STDERR_FILENO);
58 -#endif
59 + std::string show_gui_msgs = octave_env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
60
61 - qInstallMsgHandler (message_handler);
62 + // Installing our handler suppresses the messages.
63 + if (show_gui_msgs.empty ())
64 + qInstallMsgHandler (message_handler);
65
66 if (start_gui)
67 {
68 diff --git a/libinterp/dldfcn/__init_fltk__.cc b/libinterp/dldfcn/__init_fltk__.cc
69 --- a/libinterp/dldfcn/__init_fltk__.cc
70 +++ b/libinterp/dldfcn/__init_fltk__.cc
71 @@ -42,6 +42,10 @@
72
73 #ifdef HAVE_FLTK
74
75 +#if defined (HAVE_X_WINDOWS)
76 +#include <X11/Xlib.h>
77 +#endif
78 +
79 #include <map>
80 #include <set>
81 #include <sstream>
82 @@ -73,6 +77,7 @@
83
84 #include "cmd-edit.h"
85 #include "lo-ieee.h"
86 +#include "oct-env.h"
87
88 #include "display.h"
89 #include "file-ops.h"
90 @@ -674,6 +679,14 @@
91 Fl_Menu_Bar* menubar;
92 };
93
94 +#if defined (HAVE_X_WINDOWS)
95 +static int
96 +xerror_handler (Display *, XErrorEvent *)
97 +{
98 + return 0;
99 +}
100 +#endif
101 +
102 class plot_window : public Fl_Window
103 {
104 friend class fltk_uimenu;
105 @@ -762,7 +775,18 @@
106 // Set WM_CLASS which allows window managers to properly group
107 // related windows. Otherwise, the class is just "FLTK"
108 xclass ("Octave");
109 +
110 + std::string show_gui_msgs
111 + = octave_env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
112 +
113 +#if defined (HAVE_X_WINDOWS)
114 + // Installing our handler suppresses the messages.
115 + if (show_gui_msgs.empty ())
116 + XSetErrorHandler (xerror_handler);
117 +#endif
118 +
119 show ();
120 +
121 if (fp.get_currentaxes ().ok ())
122 show_canvas ();
123 else