After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 158972 - Gnome-print running on win32
Gnome-print running on win32
Status: RESOLVED FIXED
Product: gnome-print
Classification: Deprecated
Component: general
CVS
Other Windows
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2004-11-21 19:54 UTC by Hans Breuer
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch mentioned above (71.53 KB, patch)
2004-11-21 19:56 UTC, Hans Breuer
none Details | Review
just an update (as described above) (20.14 KB, patch)
2004-11-22 22:48 UTC, Hans Breuer
none Details | Review
updated patch (18.36 KB, patch)
2004-12-03 04:20 UTC, Dominic Lachowicz
none Details | Review
remove duplicate HAVE_POPEN in previous patch (18.36 KB, patch)
2004-12-03 04:21 UTC, Dominic Lachowicz
none Details | Review
updated patch. should work equally well on mingw and msvc (21.19 KB, patch)
2004-12-03 16:36 UTC, Dominic Lachowicz
accepted-commit_now Details | Review
missing files but *not* patching ChangeLog (27.88 KB, patch)
2004-12-03 21:21 UTC, Hans Breuer
none Details | Review

Description Hans Breuer 2004-11-21 19:54:44 UTC
It would be nice if these small changes could be considered
for inclusion. As a result e.g. Dia on win32 will be able
to output PDF, etc. [If the following patch is acceptable 
I can commit myself and provide similar patches for 
gnome-canvas and gnome-print-ui as well]

Thanks,
    Hans

2004-11-19  Hans Breuer  <hans@breuer.org>

	* config.h.win32 : [new file] support building on win32 without autoconf
	  libgnomeprint/libgnomeprint/gpa/gpa-printer.c : use g_buildfile_name
	and g_win32_get_package_installation_subdirectory() to determine additional
	module dirs at runtime

	* libgnomeprint/gnome-font-face.c
	  libgnomeprint/gnome-print-pdf-tt.c : added HAVE_UNISTD_H

	* libgnomeprint/gnome-fontmap.c : use g_strcasecmp()

	* libgnomeprint/gnome-print-transport.c
	  libgnomeprint/gpa/gpa-printer.c : use GLib provided <gdir.h> instead 
	of <dirent.h>

	* libgnomeprint/gnome-print-transport.c : don't hardcode so names, instead 
	use the least common denominator GModule is capable to handle

	* libgnomeprint/ttsubset/ttcr.c
	  libgnomeprint/ttsubset/gnome-print-tt-subset.c
	  libgnomeprint/gnome-print-ps2.c : open files in binary mode
	  libgnomeprint/gnome-print.c : ... abd also include <io.h> on
	win32 to get prototypes for unix like open(), close()

	* libgnomeprint/transports/gp-transport-lpr.c : define popen(),
	pclose() to their msvcrt name.

	* libgnomeprint/transports/gp-transport-lpr.c : make the prototype of 
	G_MOUDULE_EXPORT(ed) functions match the implementation

	* libgnomeprint/ttsubset/sft.h : if building with msvc use typedefs
	from GLib instead of the native GNUC types

	* libgnomeprint/transports/gp-transport-win32.[hc]
	  libgnomeprint/modules/win32/gnome-print-win32.c : start of win32
	native printer access

	* libgnomeprint/gnome-print.c : use native memory mapping when on G_OS_WIN32

	* libgnomeprint/gnome-print.def : exported symbols
	  **/makefile.msc : makefile for ms visualc nmake/command line compiler
Comment 1 Hans Breuer 2004-11-21 19:56:23 UTC
Created attachment 33997 [details] [review]
the patch mentioned above
Comment 2 Morten Welinder 2004-11-22 15:14:13 UTC
Visually, most of this looks fine.

I don't like the conditionals on _MSC_VER in libgnomeprint/ttsubset/sft.h

We need to #define O_BINARY to 0 if it isn't already defined.

win32_model_unknown_xml_template should probably be "const".

The popen stuff doesn't look elegant.  Any way to simply test for popen and
_popen in configure.in instead of explicitly testing for G_OS_WIN32?
Comment 3 Hans Breuer 2004-11-22 22:46:40 UTC
libgnomeprint/ttsubset/sft.h : would it be more acceptable to depend on 
  GLib definitions unconditionally ?

O_BINARY: there are currently 3-4 files which would require such a 
  definition. Would it be possible to get this into config.h with
  a configure check.

win32_model_unknown_xml_template : copied straight from gnome-print-lpd.c
  so it should be adapted there as well. 
[ 
  The win32 native support files are just a start, but I didn't manage 
  to get them to work yet. The real native win32 printer support would 
  likely require a more high-level appraoch - something like I've 
  done for Dia with
  http://cvs.gnome.org/viewcvs/dia/plug-ins/wmf/wmf.cpp?rev=1.28&view=markup
]

_popen: Agreed, but I'm the not qualified to answer even the most simple
  configure.in questions (the msvc glib/gtk/gimp/dia/... build does
  not use it at all and I've never managed to get msys or cygwin to
  work for me on win32 either to compile e.g. GLib from cvs)
  But the definitions could as well be moved to config.h.win32 where
  the other messy parts are ;-)

There is something more in the updated patch (not including new files 
anymore to keep it smaller) :

	* libgnomeprint/gnome-print.c : use native memory mapping 
	when on G_OS_WIN32
Comment 4 Hans Breuer 2004-11-22 22:48:30 UTC
Created attachment 34045 [details] [review]
just an update (as described above)
Comment 5 Dominic Lachowicz 2004-12-03 04:20:08 UTC
Created attachment 34431 [details] [review]
updated patch

the final patch looks good, though i've made a few alterations as per morten's
suggestions.

i'm also interested in working on a win32 printing backend. email me sometime
if you're interested in collaborating.

nice work. thanks.
Comment 6 Dominic Lachowicz 2004-12-03 04:21:37 UTC
Created attachment 34432 [details] [review]
remove duplicate HAVE_POPEN in previous patch
Comment 7 Dominic Lachowicz 2004-12-03 16:36:45 UTC
Created attachment 34459 [details] [review]
updated patch. should work equally well on mingw and msvc
Comment 8 Jody Goldberg 2004-12-03 16:47:22 UTC
Comment on attachment 34459 [details] [review]
updated patch. should work equally well on mingw and msvc

Very nice work.  Initial review looks good.  I'll go through again just to be
sure and commit today for a 2.8.2 release.
Comment 9 Jody Goldberg 2004-12-03 18:33:21 UTC
+++ libgnomeprint/ttsubset/sft.h        3 Dec 2004 16:34:02 -0000
@@ -77,7 +77,9 @@
 #define __SUBFONT_H
 
 #include <sys/types.h>
+#ifndef _MSC_VER
 #include <unistd.h>


looks odd.  Changing to HAVE_UNISTD_H
then corrected sft.c to include config.h so that it is properly defined.

Comment 10 Hans Breuer 2004-12-03 21:18:34 UTC
Hi Jody,
thanks for applying, but there are files missing from the original patch.
Also somehow my ChangeLog entry from above got lost. And more serious
there crept in a bug in one of the patch iterations. Following the further
ChangeLog entry - and an attachment including all the missing files.

Thanks,
    Hans

2004-12-03  Hans Breuer  <hans@breuer.org>

	* libgnomeprint/transports/gp-transport-file.c : add the appropriate
	access flags to open() for win32, too.
	Also don't use gsize to keep the return value of write(). Otherwise one
	will get anendless loop if writing fails.

Comment 11 Hans Breuer 2004-12-03 21:21:05 UTC
Created attachment 34469 [details] [review]
missing files but *not* patching ChangeLog
Comment 12 Jody Goldberg 2004-12-06 21:51:27 UTC
Changelog added, along with the missing files.  I also extended the Makefile.am
to include them in the release.