From d6f9b720674c1eef1f1975d567a8fdf197bc9fc7 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 10 Feb 2001 00:24:58 +0000 Subject: Use g_win32_get_package_installation_subdirectory(). Use the same 2001-02-10 Tor Lillqvist * pango/pango-utils.c (pango_get_sysconf_subdirectory, pango_get_lib_subdirectory): (Win32): Use g_win32_get_package_installation_subdirectory(). Use the same directory structure as on Unix, etc\pango and lib\pango under the installation "prefix". * config.h.win32 * pango/makefile.mingw.in: Use mini-fribidi instead of full FriBiDi. * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to changed PangoAttrColor. * pango/querymodules.c: Include for getcwd() prototype. (query_module): Handle modules with spaces in the path, and backslashes, use g_strescape() (for Windows). * pango/mini-fribidi/makefile.mingw: New file --- ChangeLog | 21 +++++++++++++++ ChangeLog.pre-1-0 | 21 +++++++++++++++ ChangeLog.pre-1-10 | 21 +++++++++++++++ ChangeLog.pre-1-2 | 21 +++++++++++++++ ChangeLog.pre-1-4 | 21 +++++++++++++++ ChangeLog.pre-1-6 | 21 +++++++++++++++ ChangeLog.pre-1-8 | 21 +++++++++++++++ config.h.win32 | 2 +- pango/makefile.mingw.in | 12 +++++---- pango/pango-utils.c | 71 +++++++++---------------------------------------- pango/pangowin32.c | 14 +++++----- pango/querymodules.c | 24 ++++++++++++++--- 12 files changed, 193 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index 188ea887..b8fe1ff7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-0 +++ b/ChangeLog.pre-1-0 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-2 +++ b/ChangeLog.pre-1-2 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 188ea887..b8fe1ff7 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,24 @@ +2001-02-10 Tor Lillqvist + + * pango/pango-utils.c (pango_get_sysconf_subdirectory, + pango_get_lib_subdirectory): (Win32): Use + g_win32_get_package_installation_subdirectory(). Use the same + directory structure as on Unix, etc\pango and lib\pango under the + installation "prefix". + + * config.h.win32 + * pango/makefile.mingw.in: Use mini-fribidi instead of full + FriBiDi. + + * pango/pangowin32.c (pango_win32_render_layout_line): Adapt to + changed PangoAttrColor. + + * pango/querymodules.c: Include for getcwd() prototype. + (query_module): Handle modules with spaces in the path, and + backslashes, use g_strescape() (for Windows). + + * pango/mini-fribidi/makefile.mingw: New file + 2001-02-05 Alexander Larsson * pango/pangoft2.c (pango_ft2_render, diff --git a/config.h.win32 b/config.h.win32 index 1e04bd47..9a935764 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -5,4 +5,4 @@ /*#undef HAVE_ICONV_H */ /*#undef HAVE_UNISTD_H */ -#define HAVE_FRIBIDI 1 +/*#undef HAVE_FRIBIDI */ diff --git a/pango/makefile.mingw.in b/pango/makefile.mingw.in index eb6da574..17e9d22a 100644 --- a/pango/makefile.mingw.in +++ b/pango/makefile.mingw.in @@ -9,7 +9,7 @@ OPTIMIZE = -g -Wall INCLUDES = -I .. -I . DEFINES = -DPANGO_VERSION=\"$(PANGO_VER)\" -DEPCFLAGS = $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) $(FRIBIDI_CFLAGS) $(FREETYPE2_CFLAGS) +DEPCFLAGS = $(GLIB_CFLAGS) $(LIBICONV_CFLAGS) $(FREETYPE2_CFLAGS) pango_built_headers= pango-enum-types.h pango_built_cfiles= pango-enum-types.c @@ -83,13 +83,13 @@ module-defs-ft2.c : module-defs-ft2.c.win32 cp $< $@ pango-$(PANGO_VER).dll : $(PANGO_OBJS) pango.def - $(GLIB)/build-dll pango $(PANGO_VER) pango.def $(OPTIMIZE) $(PANGO_OBJS) $(GLIB_LIBS) $(LIBICONV_LIBS) $(FRIBIDI_LIBS) + $(GLIB)/build-dll pango $(PANGO_VER) pango.def $(OPTIMIZE) $(PANGO_OBJS) -L mini-fribidi -lmini-fribidi $(GLIB_LIBS) $(LIBICONV_LIBS) pangowin32-$(PANGO_VER).dll : $(PANGOWIN32_OBJS) pangowin32.def - $(GLIB)/build-dll pangowin32 $(PANGO_VER) pangowin32.def $(OPTIMIZE) $(PANGOWIN32_OBJS) -L . -lpango-$(PANGO_VER) $(GLIB_LIBS) $(FRIBIDI_LIBS) -lgdi32 + $(GLIB)/build-dll pangowin32 $(PANGO_VER) pangowin32.def $(OPTIMIZE) $(PANGOWIN32_OBJS) -L . -lpango-$(PANGO_VER) $(GLIB_LIBS) -lgdi32 pangoft2-$(PANGO_VER).dll : $(PANGOFT2_OBJS) pangoft2.def - $(GLIB)/build-dll pangoft2 $(PANGO_VER) pangoft2.def $(OPTIMIZE) $(PANGOFT2_OBJS) -L . -lpango-$(PANGO_VER) $(GLIB_LIBS) $(FRIBIDI_LIBS) $(FREETYPE2_LIBS) -lgdi32 + $(GLIB)/build-dll pangoft2 $(PANGO_VER) pangoft2.def $(OPTIMIZE) $(PANGOFT2_OBJS) -L . -lpango-$(PANGO_VER) $(GLIB_LIBS) $(FREETYPE2_LIBS) -lgdi32 pango-querymodules.exe : $(PANGO_QUERYMODULES_OBJS) pango-$(PANGO_VER).dll $(CC) -o $@ $(PANGO_QUERYMODULES_OBJS) -L . -lpango-$(PANGO_VER) $(GLIB_LIBS) @@ -101,7 +101,7 @@ pango-enum-types.c: $(pango_headers) makeenums.pl perl makeenums.pl cfile $(pango_headers) > pango-enum-types.c test1.exe : test1.o pango-$(PANGO_VER).dll pangowin32-$(PANGO_VER).dll - $(CC) -o $@ $(CFLAGS) test1.o -L . -lpango-$(PANGO_VER) -lpangowin32-$(PANGO_VER) $(GLIB_LIBS) $(FRIBIDI_LIBS) -lgdi32 + $(CC) -o $@ $(CFLAGS) test1.o -L . -lpango-$(PANGO_VER) -lpangowin32-$(PANGO_VER) $(GLIB_LIBS) -lgdi32 test2.exe : test2.o $(CC) -o $@ $(CFLAGS) test2.o -lgdi32 @@ -115,7 +115,9 @@ test4.exe : test4.o pango-$(PANGO_VER).dll pangowin32-$(PANGO_VER).dll test5.exe : test5.o $(CC) -o $@ $(CFLAGS) test5.o -lgdi32 +ifeq ($(wildcard makefile.mingw.in),makefile.mingw.in) # Hack to get an updated makefile.mingw automatically after updating # makefile.mingw.in. Only for developer use. makefile.mingw: makefile.mingw.in sed -e 's,@VER[S]ION@,@VERSION@,' <$< >$@ +endif diff --git a/pango/pango-utils.c b/pango/pango-utils.c index 504986b6..eb8e2c31 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -620,66 +620,13 @@ char * pango_get_sysconf_subdirectory (void) { #ifdef G_OS_WIN32 + static gchar *result = NULL; - /* On Windows we don't hardcode any paths (SYSCONFDIR) in the DLL, - * but rely on an installation program to store the installation - * directory in the registry. If no installation program has been - * used, assume the Pango directory is %WINDIR%\Pango. - * - * If the latter doesn't exist either, fall back to the directory - * the pango-$PANGO_VERSION.dll comes from, to stop polluting - * neither the Registry nor the windows directory (which may be - * write protected with Win2K anyway). - */ - - static gboolean been_here = FALSE; - static gchar pango_sysconf_dir[200]; - gchar win_dir[100]; - HKEY reg_key = NULL; - DWORD type; - DWORD nbytes = sizeof (pango_sysconf_dir); - - if (been_here) - return pango_sysconf_dir; - - been_here = TRUE; - - if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "Software\\GNU\\Pango", 0, - KEY_QUERY_VALUE, ®_key) != ERROR_SUCCESS - || RegQueryValueEx (reg_key, "InstallationDirectory", 0, - &type, pango_sysconf_dir, &nbytes) != ERROR_SUCCESS - || type != REG_SZ) - { - /* Uh oh. Use %WinDir%\Pango */ - GetWindowsDirectory (win_dir, sizeof (win_dir)); - sprintf (pango_sysconf_dir, "%s\\pango", win_dir); - - if (!g_file_test (pango_sysconf_dir, G_FILE_TEST_IS_DIR)) - { - /* Oops. %WinDir%\pango does not exist */ - HMODULE hm = NULL; - gchar* libname = g_strdup_printf ("pango-%s.dll", PANGO_VERSION); - hm = GetModuleHandle (libname); - if (!hm) - g_warning ("Can't find myself (%s)", libname); - else - { - GetModuleFileName (hm, - pango_sysconf_dir, - sizeof(pango_sysconf_dir)); - /* strip dll name */ - if (strrchr (pango_sysconf_dir, '\\')) - *strrchr (pango_sysconf_dir, '\\') = 0; - } - g_free (libname); - } - } - - if (reg_key != NULL) - RegCloseKey (reg_key); - - return pango_sysconf_dir; + if (result == NULL) + result = g_win32_get_package_installation_subdirectory + ("pango", g_strdup_printf ("pango-%s.dll", PANGO_VERSION), "etc\\pango"); + return result; #else return SYSCONFDIR "/pango"; #endif @@ -689,7 +636,13 @@ char * pango_get_lib_subdirectory (void) { #ifdef G_OS_WIN32 - return pango_get_sysconf_subdirectory (); + static gchar *result = NULL; + + if (result == NULL) + result = g_win32_get_package_installation_subdirectory + ("pango", g_strdup_printf ("pango-%s.dll", PANGO_VERSION), "lib\\pango"); + + return result; #else return LIBDIR "/pango"; #endif diff --git a/pango/pangowin32.c b/pango/pangowin32.c index 464fb81a..e6320f03 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -26,8 +26,6 @@ #include #include -#include - #include "pango-utils.h" #include "pangowin32.h" #include "pangowin32-private.h" @@ -1347,9 +1345,9 @@ pango_win32_render_layout_line (HDC hdc, { HBRUSH oldbrush; - brush = CreateSolidBrush (RGB ((bg_color.red + 128) >> 8, - (bg_color.green + 128) >> 8, - (bg_color.blue + 128) >> 8)); + brush = CreateSolidBrush (RGB ((bg_color.color.red + 128) >> 8, + (bg_color.color.green + 128) >> 8, + (bg_color.color.blue + 128) >> 8)); oldbrush = SelectObject (hdc, brush); Rectangle (hdc, x + (x_off + logical_rect.x) / PANGO_SCALE, y + overall_rect.y / PANGO_SCALE, @@ -1361,9 +1359,9 @@ pango_win32_render_layout_line (HDC hdc, if (fg_set) { - brush = CreateSolidBrush (RGB ((fg_color.red + 128) >> 8, - (fg_color.green + 128) >> 8, - (fg_color.blue + 128) >> 8)); + brush = CreateSolidBrush (RGB ((fg_color.color.red + 128) >> 8, + (fg_color.color.green + 128) >> 8, + (fg_color.color.blue + 128) >> 8)); oldfg = SelectObject (hdc, brush); } diff --git a/pango/querymodules.c b/pango/querymodules.c index 165dde70..ff9263f9 100644 --- a/pango/querymodules.c +++ b/pango/querymodules.c @@ -44,10 +44,9 @@ #include #define PATH_MAX _MAX_PATH #endif /* PATH_MAX */ -#ifdef _MSC_VER -#include +#include /* for getcwd() with MSVC */ +#include /* for getcwd() with mingw */ #define getcwd _getcwd -#endif #else #define SOEXT ".so" #endif @@ -85,7 +84,24 @@ query_module (const char *dir, const char *name) for (i=0; i