summaryrefslogtreecommitdiff
path: root/pango/mini-xft
diff options
context:
space:
mode:
Diffstat (limited to 'pango/mini-xft')
-rw-r--r--pango/mini-xft/minixftcache.c18
-rw-r--r--pango/mini-xft/minixftinit.c25
-rw-r--r--pango/mini-xft/minixftint.h5
3 files changed, 48 insertions, 0 deletions
diff --git a/pango/mini-xft/minixftcache.c b/pango/mini-xft/minixftcache.c
index 54ec1fd5..831446cb 100644
--- a/pango/mini-xft/minixftcache.c
+++ b/pango/mini-xft/minixftcache.c
@@ -30,6 +30,11 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+
+#ifdef _WIN32
+#define mkdir(path, mode) _mkdir(path)
+#endif
+
#include "minixftint.h"
typedef struct _MiniXftFileCacheEnt {
@@ -421,8 +426,13 @@ MiniXftFileCacheSave (char *cache_file)
strcat (lck, "L");
strcpy (tmp, cache_file);
strcat (tmp, "T");
+#ifndef _WIN32
if (link (lck, cache_file) < 0 && errno != ENOENT)
goto bail1;
+#else
+ if (mkdir (lck, 0666) < 0)
+ goto bail1;
+#endif
if (access (tmp, F_OK) == 0)
goto bail2;
f = fopen (tmp, "w");
@@ -460,7 +470,11 @@ MiniXftFileCacheSave (char *cache_file)
if (rename (tmp, cache_file) < 0)
goto bail3;
+#ifndef _WIN32
unlink (lck);
+#else
+ rmdir (lck);
+#endif
cache->updated = False;
return True;
@@ -469,7 +483,11 @@ bail4:
bail3:
unlink (tmp);
bail2:
+#ifndef _WIN32
unlink (lck);
+#else
+ rmdir (lck);
+#endif
bail1:
free (lck);
bail0:
diff --git a/pango/mini-xft/minixftinit.c b/pango/mini-xft/minixftinit.c
index 9a995044..627e9ad1 100644
--- a/pango/mini-xft/minixftinit.c
+++ b/pango/mini-xft/minixftinit.c
@@ -23,6 +23,11 @@
*/
#include <stdlib.h>
+
+#ifdef _WIN32
+#include <stdio.h>
+#endif
+
#include "minixftint.h"
MiniXftFontSet *_MiniXftFontSet;
@@ -46,3 +51,23 @@ MiniXftInit (char *config)
}
return True;
}
+
+#ifdef _WIN32
+char *
+get_xft_default_path (void)
+{
+ static char *result = NULL;
+ extern char *pango_get_sysconf_subdirectory (void);
+ char *p;
+
+ if (result)
+ return result;
+
+ p = pango_get_sysconf_subdirectory ();
+ result = malloc (strlen (p) + 20);
+
+ sprintf (result, "%s\\..\\XftConfig", p);
+
+ return result;
+}
+#endif
diff --git a/pango/mini-xft/minixftint.h b/pango/mini-xft/minixftint.h
index 22f937a9..f6e75768 100644
--- a/pango/mini-xft/minixftint.h
+++ b/pango/mini-xft/minixftint.h
@@ -59,7 +59,12 @@ extern MiniXftFontSet *_MiniXftFontSet;
#define XFT_NMISSING 256
#ifndef XFT_DEFAULT_PATH
+#ifndef _WIN32
#define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
+#else
+extern char *get_xft_default_path (void);
+#define XFT_DEFAULT_PATH get_xft_default_path ()
+#endif
#endif
#define XFT_DBG_OPEN 1