summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-03-05 22:44:33 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-03-05 22:44:33 +0000
commit378a6384e55bdb8c5750c051fd91302f64d2b69a (patch)
treed78d65188aeda19ebf39240d7272f1c6ec64ce6c /src
parentUnordered containers build fix for Windows (diff)
downloadinkscape-378a6384e55bdb8c5750c051fd91302f64d2b69a.tar.gz
inkscape-378a6384e55bdb8c5750c051fd91302f64d2b69a.zip
Patch from Fridrich - LP #520532
Fixed bugs: - https://launchpad.net/bugs/520532 (bzr r9149)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am6
-rw-r--r--src/color-profile.cpp2
-rw-r--r--src/dialogs/export.cpp2
-rw-r--r--src/main.cpp9
-rw-r--r--src/winmain.cpp27
5 files changed, 36 insertions, 10 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 92e520e5b..ff5d20f49 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,7 +88,8 @@ CXXTEST_TESTSUITES =
if PLATFORM_WIN32
win32_sources = winmain.cpp registrytool.cpp registrytool.h
-win32ldflags = -lcomdlg32
+win32ldflags = -lcomdlg32 -lmscms
+mwindows = -mwindows
endif
if INKJAR
@@ -215,10 +216,11 @@ libinkscape_a_SOURCES = $(ink_common_sources)
inkscape_SOURCES += main.cpp $(win32_sources)
inkscape_LDADD = $(all_libs)
-inkscape_LDFLAGS = --export-dynamic $(kdeldflags)
+inkscape_LDFLAGS = --export-dynamic $(kdeldflags) $(mwindows)
inkview_SOURCES += inkview.cpp $(win32_sources)
inkview_LDADD = $(all_libs)
+inkview_LDFLAGS = $(mwindows)
# ################################################
# VERSION REPORTING
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 310a37356..43709793c 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -35,7 +35,7 @@
#include "dom/util/digest.h"
#ifdef WIN32
-#include <Icm.h>
+#include <icm.h>
#endif // WIN32
using Inkscape::ColorProfile;
diff --git a/src/dialogs/export.cpp b/src/dialogs/export.cpp
index fa0fa5b6f..9e8a71c35 100644
--- a/src/dialogs/export.cpp
+++ b/src/dialogs/export.cpp
@@ -62,7 +62,7 @@
#ifdef WIN32
#include <windows.h>
-#include <COMMDLG.h>
+#include <commdlg.h>
#include <gdk/gdkwin32.h>
#endif
diff --git a/src/main.cpp b/src/main.cpp
index f55731be8..d11222203 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,6 +56,10 @@
#include "gc-core.h"
+#ifdef AND
+#undef AND
+#endif
+
#include "macros.h"
#include "file.h"
#include "document.h"
@@ -94,14 +98,9 @@
#include <extension/input.h>
#ifdef WIN32
-//#define REPLACEARGS_ANSI
-//#define REPLACEARGS_DEBUG
-
#include "registrytool.h"
-
#include "extension/internal/win32.h"
using Inkscape::Extension::Internal::PrintWin32;
-
#endif // WIN32
#include "extension/init.h"
diff --git a/src/winmain.cpp b/src/winmain.cpp
index dc6b7e008..4fde2c574 100644
--- a/src/winmain.cpp
+++ b/src/winmain.cpp
@@ -6,8 +6,11 @@
#include <glib.h>
#ifdef G_OS_WIN32
-
#undef DATADIR
+
+#include <io.h>
+#include <conio.h>
+#define _WIN32_WINNT 0x0501
#include <windows.h>
extern int main (int argc, char **argv);
@@ -26,6 +29,28 @@ WinMain (struct HINSTANCE__ *hInstance,
char *lpszCmdLine,
int nCmdShow)
{
+ if (fileno (stdout) != -1 &&
+ _get_osfhandle (fileno (stdout)) != -1)
+ {
+ /* stdout is fine, presumably redirected to a file or pipe */
+ }
+ else
+ {
+ typedef BOOL (* WINAPI AttachConsole_t) (DWORD);
+
+ AttachConsole_t p_AttachConsole =
+ (AttachConsole_t) GetProcAddress (GetModuleHandle ("kernel32.dll"), "AttachConsole");
+
+ if (p_AttachConsole != NULL && p_AttachConsole (ATTACH_PARENT_PROCESS))
+ {
+ freopen ("CONOUT$", "w", stdout);
+ dup2 (fileno (stdout), 1);
+ freopen ("CONOUT$", "w", stderr);
+ dup2 (fileno (stderr), 2);
+
+ }
+ }
+
int ret;
ret = main (__argc, __argv);
return ret;