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