The attached patch fixes the two bugs :

1) figures wouldn't work if pspell was enabled. This bug is a direct
result of not having functions in their proper files ;)

2) Fix most of the cases of the gs hangs with a workaround. I have
verified this on 0.88 and 0.89. The remaining cases involve popup menus,
where it seems events are being discarded, and I think this will require
an xforms release to fix totally.

This workaround is actually not any uglier than what we had before ...

thanks
john

-- 
"An AMM performance has no beginning or ending. Sounds outside the performance
are distinguished from it only by individual sensibility."
        - Victor Schonfield
? lib/examples/14538vFW0yy
? lib/examples/145408rEbRG
? lib/examples/14610igQICW
Index: ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/ChangeLog,v
retrieving revision 1.709
diff -u -p -r1.709 ChangeLog
--- ChangeLog   2000/12/04 09:15:50     1.709
+++ ChangeLog   2000/12/04 11:44:48
@@ -1,3 +1,9 @@
+2000-12-04  John Levon  <[EMAIL PROTECTED]>
+
+       * src/spellchecker.C: fix figures with pspell enabled
+
+       * src/insets/figinset.C: workaround for gs hang xforms bug
+
 2000-11-30  Dekel Tsur  <[EMAIL PROTECTED]>
 
        * Several files: Allow compilation when the compiler doesn't
Index: src/spellchecker.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/spellchecker.C,v
retrieving revision 1.41
diff -u -p -r1.41 spellchecker.C
--- src/spellchecker.C  2000/11/28 06:46:05     1.41
+++ src/spellchecker.C  2000/12/04 11:44:48
@@ -65,12 +65,8 @@
 #include "encoding.h"
 #include "support/lstrings.h"
 
-//#define USE_PSPELL 1
-
 #ifdef USE_PSPELL
-
-#include <pspell/pspell.h>
-
+# include <pspell/pspell.h>
 #endif
 
 using std::reverse;
@@ -110,10 +106,8 @@ PspellManager * sc;
 FD_form_spell_options *fd_form_spell_options = 0;
 FD_form_spell_check *fd_form_spell_check = 0;
 
-//void sigchldhandler(int sig);
 void sigchldhandler(pid_t pid, int *status);
 
-//extern void sigchldchecker(int sig);
 extern void sigchldchecker(pid_t pid, int *status);
 
 #ifndef USE_PSPELL
@@ -628,7 +622,7 @@ void sc_clean_up_after_error() 
 
 
 
-// Send word to ispell and get reply
+// Send word to pspell and get reply
 static
 isp_result * sc_check_word(string const & word)
 {
@@ -965,10 +959,8 @@ bool RunSpellChecker(BufferView * bv)
                return true;
        }
 }
-
-
-#ifndef USE_PSPELL
 
+#warning should go somewhere more sensible
 void sigchldhandler(pid_t pid, int * status)
 { 
        if (isp_pid > 0)
@@ -980,12 +972,3 @@ void sigchldhandler(pid_t pid, int * sta
                }
        sigchldchecker(pid, status);
 }
-
-#else
-
-void sigchldhandler(pid_t, int *)
-{ 
-       // do nothing
-}
-
-#endif
Index: src/insets/figinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/figinset.C,v
retrieving revision 1.93
diff -u -p -r1.93 figinset.C
--- src/insets/figinset.C       2000/11/28 06:46:06     1.93
+++ src/insets/figinset.C       2000/12/04 11:44:52
@@ -167,10 +167,14 @@ void kill_gs(int pid, int sig)
 }
 
 
-extern "C" // static
-int GhostscriptMsg(FL_OBJECT *, Window, int, int,
-                  XEvent * ev, void *)
+extern "C" {
+static
+int GhostscriptMsg(XEvent * ev, void *)
 {
+       // bin all events not of interest
+       if (ev->type != ClientMessage)
+               return FL_PREEMPT;
+
        XClientMessageEvent * e = reinterpret_cast<XClientMessageEvent*>(ev);
 
        if (lyxerr.debugging()) {
@@ -297,7 +301,8 @@ int GhostscriptMsg(FL_OBJECT *, Window, 
                        }
                        break;
                }
-       return 0;
+       return FL_PREEMPT;
+}
 }
 
 
@@ -378,6 +383,9 @@ void AllocGrays(int num)
 }
 
 
+// xforms doesn't define this
+extern "C" FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
+
 static
 void InitFigures()
 {
@@ -389,9 +397,10 @@ void InitFigures()
        // first get visual
        gs_color = false;
        if (lyxrc.use_gui) {
-               fl_add_canvas_handler(figinset_canvas, ClientMessage,
-                                     GhostscriptMsg,
-                                     current_view->owner()->getForm());
+               /* we want to capture every event, in order to work around an
+                * xforms bug.
+                */
+               fl_set_preemptive_callback(fl_get_canvas_id(figinset_canvas), 
+GhostscriptMsg, 0);
 
                local_gc_copy = createGC();
 
@@ -430,9 +439,6 @@ void DoneFigures()
        figures.clear();
        
        lyxerr.debug() << "Unregistering figures..." << endl;
-
-       fl_remove_canvas_handler(figinset_canvas, ClientMessage,
-                                GhostscriptMsg);
 }
 
 

Reply via email to