These patches implement asynchronous loading of graphics in Windows.

The code on *nix is unchanged in the 1.3.x tree, apart from the removal of
some functions that are no longer called. (They were used by the dialog to
kill child processes but that went some time ago.)

The 1.4.x code on *nix *is* changed. Basically, I've reverted to the code
in LyX 1.3.x, for two reasons:
1. 'Issues' remain with the SIGCHLD handling code. (Read it's not robust).
2. Such a solution cannot be implemented on Windows and I want to minimize
the changes to get this Windows port working.

Going the 1.3.x way, explicitly polling for any completed child processes
is safe and robust and can be implemented with relatively little change on
Windows.

I won't commit these just yet, but will do so tomorrow unless there are any
strong objections.

Jean-Marc, that's basically it for the port of LyX 1.3.x to Windows.
There's another small patch to disable ispell support and the lyxserver
and to enable the autosave code to work (blocking). I attach this patch
also (win32_kludge_13x.diff)

We should also address the issue of accepting 'files with spaces' in the
dialogs, but that's not Windows-specific.

-- 
Angus

Attachment: child_13x.diff.gz
Description: GNU Zip compressed data

Attachment: child_14x.diff.gz
Description: GNU Zip compressed data

Index: src/ispell.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ispell.C,v
retrieving revision 1.5.2.5
diff -u -a -u -r1.5.2.5 ispell.C
--- src/ispell.C	7 Dec 2004 10:48:23 -0000	1.5.2.5
+++ src/ispell.C	15 Apr 2005 22:28:12 -0000
@@ -21,12 +21,28 @@
 #include "support/forkedcall.h"
 #include "support/lstrings.h"
 
+#ifdef _WIN32
+// sys/select.h
+# define FD_ZERO(a)
+# define FD_SET(a,b)
+# define FD_ISSET(fd, set) 0
+//sys/types.h
+# define fd_set int
+// unistd.h
+# define fork() -1
+# define pipe(a) _pipe(a,0,0)
+#endif
+
 // HP-UX 11.x doesn't have this header
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif
 #include <sys/time.h>
 
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
 #ifndef CXX_GLOBAL_CSTD
 using std::strcpy;
 using std::strlen;
@@ -309,11 +325,15 @@
 	tv.tv_sec = 2;
 	tv.tv_usec = 0;
 
+#ifdef _WIN32
+	retval = -1;
+#else
 	retval = ::select(SELECT_TYPE_ARG1 (max(pipeout[0], pipeerr[0]) + 1),
 			SELECT_TYPE_ARG234 (&infds),
 			0,
 			0,
 			SELECT_TYPE_ARG5 (&tv));
+#endif
 
 	// error
 	if (retval <= 0)
Index: src/lyx_cb.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyx_cb.C,v
retrieving revision 1.190.2.3
diff -u -a -u -r1.190.2.3 lyx_cb.C
--- src/lyx_cb.C	10 Jan 2005 19:17:24 -0000	1.190.2.3
+++ src/lyx_cb.C	15 Apr 2005 20:29:06 -0000
@@ -37,6 +37,11 @@
 #include "support/systemcall.h"
 #include "support/lstrings.h"
 
+#ifdef _WIN32
+// unistd.h
+# define fork() -1
+#endif
+
 #include "BoostFormat.h"
 
 #include <fstream>
Index: src/lyxserver.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxserver.C,v
retrieving revision 1.48.2.3
diff -u -a -u -r1.48.2.3 lyxserver.C
--- src/lyxserver.C	20 Jan 2005 10:47:28 -0000	1.48.2.3
+++ src/lyxserver.C	15 Apr 2005 22:22:20 -0000
@@ -36,14 +36,6 @@
 
 #include <config.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <fcntl.h>
-#include <cerrno>
-
 #include "lyxserver.h"
 #include "debug.h"
 #include "lyxfunc.h"
@@ -51,14 +43,28 @@
 #include "support/lyxlib.h"
 #include "frontends/lyx_gui.h"
 
-#ifdef __EMX__
-#include <cstdlib>
-#include <io.h>
-#define OS2EMX_PLAIN_CHAR
-#define INCL_DOSNMPIPES
-#define INCL_DOSERRORS
-#include <os2.h>
-#include "support/os2_errortable.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <cerrno>
+#include <fcntl.h>
+
+#if defined (_WIN32)
+# define F_SETFD    2
+# define F_SETFL    4
+# define O_NONBLOCK 0x4000
+  inline int fcntl (int, int, ...) {return -1;}
+
+#elif defined (__EMX__)
+# include <cstdlib>
+# include <io.h>
+# define OS2EMX_PLAIN_CHAR
+# define INCL_DOSNMPIPES
+# define INCL_DOSERRORS
+# include <os2.h>
+# include "support/os2_errortable.h"
+
+#else // POSIX
+# include <unistd.h>
 #endif
 
 using std::endl;

Reply via email to