]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/lyx_gui.C
Compilation fix: give C_read_callback extern "C" linkage.
[lyx.git] / src / frontends / xforms / lyx_gui.C
index 7eaaf8f3b108cdcc7b3b7224a759140f194b24de..3c7daf746b105ceba1b1cf5a18c99a0878269546 100644 (file)
@@ -152,6 +152,18 @@ void lyx_gui::parse_init(int & argc, char * argv[])
        XSetErrorHandler(LyX_XErrHandler);
 
        lyxColorHandler.reset(new LyXColorHandler());
+       using namespace grfx;
+
+#ifdef USE_XFORMS_IMAGE_LOADER
+       // connect the image loader based on the xforms library
+       Image::newImage = boost::bind(&xformsImage::newImage);
+       Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
+#else
+       // connect the image loader based on the XPM library
+       Image::newImage = boost::bind(&ImageXPM::newImage);
+       Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
+#endif
 }
 
 
@@ -297,24 +309,6 @@ void lyx_gui::start(string const & batch, vector<string> files)
 }
 
 
-// Called by the graphics cache to connect the appropriate frontend
-// image loading routines to the LyX kernel.
-void lyx_gui::init_graphics()
-{
-       using namespace grfx;
-
-#ifdef USE_XFORMS_IMAGE_LOADER
-       // connect the image loader based on the xforms library
-       Image::newImage = boost::bind(&xformsImage::newImage);
-       Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
-#else
-       // connect the image loader based on the XPM library
-       Image::newImage = boost::bind(&ImageXPM::newImage);
-       Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
-#endif
-}
-
-
 string const lyx_gui::hexname(LColor::color col)
 {
        string const name = lcolor.getX11Name(col);
@@ -358,3 +352,19 @@ bool lyx_gui::font_available(LyXFont const & font)
 {
        return fontloader.available(font);
 }
+
+namespace {
+
+extern "C"
+void C_read_callback(int, void * data)
+{
+       LyXComm * comm = static_cast<LyXComm *>(data); 
+       comm->read_ready();
+}
+
+}
+
+void lyx_gui::set_read_callback(int fd, LyXComm * comm)
+{
+       fl_add_io_callback(fd, FL_READ, C_read_callback, comm);
+}