summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/Makefile.am20
-rw-r--r--gtk/gtkcssprovider.c2
-rw-r--r--gtk/gtkimcontext.c2
-rw-r--r--gtk/gtkimmodule.c21
-rw-r--r--gtk/gtkimmulticontext.c4
-rw-r--r--gtk/gtkmain.c262
-rw-r--r--gtk/gtkmainprivate.h12
-rw-r--r--gtk/gtkmodules.c5
-rw-r--r--gtk/gtkmodulesprivate.h44
-rw-r--r--gtk/gtkprintbackend.c1
-rw-r--r--gtk/gtkprivate.c206
-rw-r--r--gtk/gtkprivate.h52
-rw-r--r--gtk/gtkquartz.c7
-rw-r--r--gtk/gtkquartz.h4
-rw-r--r--gtk/gtkrc.c5
-rw-r--r--gtk/gtksettings.c3
-rw-r--r--gtk/gtkthemingengine.c1
-rw-r--r--gtk/gtkwin32.c143
18 files changed, 450 insertions, 344 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index e197c73ebc..68df3c9633 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -422,6 +422,7 @@ gtk_private_h_sources = \
gtkmenushellprivate.h \
gtkmnemonichash.h \
gtkmodifierstyle.h \
+ gtkmodulesprivate.h \
gtkmountoperationprivate.h \
gtknumerableiconprivate.h \
gtkorientableprivate.h \
@@ -618,6 +619,7 @@ gtk_base_c_sources = \
gtkprintoperationpreview.c \
gtkprintsettings.c \
gtkprintutils.c \
+ gtkprivate.c \
gtkprogressbar.c \
gtkradioaction.c \
gtkradiobutton.c \
@@ -752,7 +754,8 @@ endif
gtk_os_win32_c_sources = \
gtkprint-win32.c \
- gtkprintoperation-win32.c
+ gtkprintoperation-win32.c \
+ gtkwin32.c
gtk_all_c_sources += $(gtk_os_win32_c_sources)
if OS_WIN32
gtk_private_h_sources += gtkprint-win32.h
@@ -771,7 +774,8 @@ gtk_use_win32_c_sources = \
gtkmountoperation-stub.c
gtk_use_quartz_c_sources = \
gtksearchenginequartz.c \
- gtkmountoperation-stub.c
+ gtkmountoperation-stub.c \
+ gtkquartz.c
gtk_use_stub_c_sources = \
gtkmountoperation-stub.c
gtk_all_c_sources += $(gtk_use_x11_c_sources) $(gtk_use_win32_c_sources) $(gtk_use_quartz_c_sources) $(gtk_use_stub_c_sources)
@@ -790,7 +794,8 @@ gtk_c_sources += $(gtk_use_win32_c_sources)
else
if USE_QUARTZ
gtk_private_h_sources += \
- gtksearchenginequartz.h
+ gtksearchenginequartz.h \
+ gtkquartz.h
gtk_c_sources += $(gtk_use_quartz_c_sources)
libgtk_3_la_CFLAGS = "-xobjective-c"
@@ -803,13 +808,10 @@ endif
if USE_QUARTZ
gtk_clipboard_dnd_c_sources = \
gtkclipboard-quartz.c \
- gtkdnd-quartz.c \
- gtkquartz.c
-gtk_clipboard_dnd_h_sources = gtkquartz.h
+ gtkdnd-quartz.c
else
gtk_clipboard_dnd_c_sources = gtkclipboard.c gtkdnd.c
endif
-EXTRA_DIST += gtkquartz.h
# we use our own built_sources variable rules to avoid automake's
# BUILT_SOURCES oddities
@@ -963,7 +965,7 @@ dist-hook: ../build/win32/vs9/gtk.vcproj ../build/win32/vs10/gtk.vcxproj ../buil
done >libgtk.sourcefiles
$(CPP) -P - <$(top_srcdir)/build/win32/vs9/gtk.vcprojin >$@
rm libgtk.sourcefiles
-
+
../build/win32/vs10/gtk.vcxproj: ../build/win32/vs10/gtk.vcxprojin
for F in $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources); do \
case $$F in \
@@ -973,7 +975,7 @@ dist-hook: ../build/win32/vs9/gtk.vcproj ../build/win32/vs10/gtk.vcxproj ../buil
done >libgtk.vs10.sourcefiles
$(CPP) -P - <$(top_srcdir)/build/win32/vs10/gtk.vcxprojin >$@
rm libgtk.vs10.sourcefiles
-
+
../build/win32/vs10/gtk.vcxproj.filters: ../build/win32/vs10/gtk.vcxproj.filtersin
for F in $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources); do \
case $$F in \
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index bd019157ab..12457668e3 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -3067,7 +3067,7 @@ _gtk_css_provider_get_theme_dir (void)
if (var)
path = g_build_filename (var, "share", "themes", NULL);
else
- path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
+ path = g_build_filename (_gtk_get_data_prefix (), "share", "themes", NULL);
return path;
}
diff --git a/gtk/gtkimcontext.c b/gtk/gtkimcontext.c
index 3569ba735d..ec238fc2c9 100644
--- a/gtk/gtkimcontext.c
+++ b/gtk/gtkimcontext.c
@@ -20,7 +20,7 @@
#include "config.h"
#include <string.h>
#include "gtkimcontext.h"
-#include "gtkmainprivate.h"
+#include "gtkprivate.h"
#include "gtkmarshalers.h"
#include "gtkintl.h"
diff --git a/gtk/gtkimmodule.c b/gtk/gtkimmodule.c
index 593a868504..93ac7b9077 100644
--- a/gtk/gtkimmodule.c
+++ b/gtk/gtkimmodule.c
@@ -36,17 +36,9 @@
#include "gtkimcontextsimple.h"
#include "gtksettings.h"
#include "gtkmainprivate.h"
+#include "gtkprivate.h"
#include "gtkintl.h"
-/* Do *not* include "gtkprivate.h" in this file. If you do, the
- * correct_libdir_prefix() and correct_localedir_prefix() functions
- * below will have to move somewhere else.
- */
-
-#ifdef __GTK_PRIVATE_H__
-#error gtkprivate.h should not be included in this file
-#endif
-
#define SIMPLE_ID "gtk-im-context-simple"
/**
@@ -239,10 +231,7 @@ add_module (GtkIMModule *module, GSList *infos)
static void
correct_libdir_prefix (gchar **path)
{
- /* GTK_LIBDIR here is supposed to still have the definition from
- * Makefile.am, i.e. the build-time value. Do *not* include gtkprivate.h
- * in this file.
- */
+ /* GTK_LIBDIR is the build-time libdir */
if (strncmp (*path, GTK_LIBDIR, strlen (GTK_LIBDIR)) == 0)
{
/* This is an entry put there by make install on the
@@ -253,7 +242,6 @@ correct_libdir_prefix (gchar **path)
* builder's machine. Replace the path with the real
* one on this machine.
*/
- extern const gchar *_gtk_get_libdir ();
gchar *tem = *path;
*path = g_strconcat (_gtk_get_libdir (), tem + strlen (GTK_LIBDIR), NULL);
g_free (tem);
@@ -263,12 +251,9 @@ correct_libdir_prefix (gchar **path)
static void
correct_localedir_prefix (gchar **path)
{
- /* As above, but for GTK_LOCALEDIR. Use separate function in case
- * GTK_LOCALEDIR isn't a subfolder of GTK_LIBDIR.
- */
+ /* See above */
if (strncmp (*path, GTK_LOCALEDIR, strlen (GTK_LOCALEDIR)) == 0)
{
- extern const gchar *_gtk_get_localedir ();
gchar *tem = *path;
*path = g_strconcat (_gtk_get_localedir (), tem + strlen (GTK_LOCALEDIR), NULL);
g_free (tem);
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index 5ad4ec670f..5d21643245 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -27,7 +27,7 @@
#include "gtkmain.h"
#include "gtkradiomenuitem.h"
#include "gtkintl.h"
-#include "gtkprivate.h" /* To get redefinition of GTK_LOCALE_DIR on Win32 */
+#include "gtkprivate.h"
/**
@@ -634,7 +634,7 @@ gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
{
/* Same translation domain as GTK+ */
if (!(contexts[i]->domain_dirname && contexts[i]->domain_dirname[0]) ||
- pathnamecmp (contexts[i]->domain_dirname, GTK_LOCALEDIR) == 0)
+ pathnamecmp (contexts[i]->domain_dirname, _gtk_get_localedir ()) == 0)
{
/* Empty or NULL, domain directory, or same as
* GTK+. Input method may have a name in the GTK+
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 76645b963f..a4c38f62a4 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -120,6 +120,7 @@
#include "gtkdnd.h"
#include "gtkversion.h"
#include "gtkmodules.h"
+#include "gtkmodulesprivate.h"
#include "gtkrecentmanager.h"
#include "gtkselectionprivate.h"
#include "gtksettingsprivate.h"
@@ -128,83 +129,9 @@
#include "gtktooltip.h"
#include "gtkdebug.h"
#include "gtkmenu.h"
-
-#ifdef G_OS_WIN32
-
-static HMODULE gtk_dll;
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
- DWORD fdwReason,
- LPVOID lpvReserved)
-{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- gtk_dll = (HMODULE) hinstDLL;
- break;
- }
-
- return TRUE;
-}
-
-/* These here before inclusion of gtkprivate.h so that the original
- * GTK_LIBDIR and GTK_LOCALEDIR definitions are seen. Yeah, this is a
- * bit sucky.
- */
-const gchar *
-_gtk_get_libdir (void)
-{
- static char *gtk_libdir = NULL;
- if (gtk_libdir == NULL)
- {
- gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
- gchar *slash = strrchr (root, '\\');
- if (g_ascii_strcasecmp (slash + 1, ".libs") == 0)
- gtk_libdir = GTK_LIBDIR;
- else
- gtk_libdir = g_build_filename (root, "lib", NULL);
- g_free (root);
- }
-
- return gtk_libdir;
-}
-
-const gchar *
-_gtk_get_localedir (void)
-{
- static char *gtk_localedir = NULL;
- if (gtk_localedir == NULL)
- {
- const gchar *p;
- gchar *root, *temp;
-
- /* GTK_LOCALEDIR ends in either /lib/locale or
- * /share/locale. Scan for that slash.
- */
- p = GTK_LOCALEDIR + strlen (GTK_LOCALEDIR);
- while (*--p != '/')
- ;
- while (*--p != '/')
- ;
-
- root = g_win32_get_package_installation_directory_of_module (gtk_dll);
- temp = g_build_filename (root, p, NULL);
- g_free (root);
-
- /* gtk_localedir is passed to bindtextdomain() which isn't
- * UTF-8-aware.
- */
- gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
- g_free (temp);
- }
- return gtk_localedir;
-}
-
-#endif
-
#include "gtkprivate.h"
+
/* Private type definitions
*/
typedef struct _GtkKeySnooperData GtkKeySnooperData;
@@ -447,48 +374,6 @@ check_setugid (void)
return TRUE;
}
-#ifdef G_OS_WIN32
-
-const gchar *
-_gtk_get_datadir (void)
-{
- static char *gtk_datadir = NULL;
- if (gtk_datadir == NULL)
- {
- gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
- gtk_datadir = g_build_filename (root, "share", NULL);
- g_free (root);
- }
-
- return gtk_datadir;
-}
-
-const gchar *
-_gtk_get_sysconfdir (void)
-{
- static char *gtk_sysconfdir = NULL;
- if (gtk_sysconfdir == NULL)
- {
- gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
- gtk_sysconfdir = g_build_filename (root, "etc", NULL);
- g_free (root);
- }
-
- return gtk_sysconfdir;
-}
-
-const gchar *
-_gtk_get_data_prefix (void)
-{
- static char *gtk_data_prefix = NULL;
- if (gtk_data_prefix == NULL)
- gtk_data_prefix = g_win32_get_package_installation_directory_of_module (gtk_dll);
-
- return gtk_data_prefix;
-}
-
-#endif /* G_OS_WIN32 */
-
static gboolean do_setlocale = TRUE;
/**
@@ -802,8 +687,8 @@ gettext_initialization (void)
setlocale_initialization ();
#ifdef ENABLE_NLS
- bindtextdomain (GETTEXT_PACKAGE, GTK_LOCALEDIR);
- bindtextdomain (GETTEXT_PACKAGE "-properties", GTK_LOCALEDIR);
+ bindtextdomain (GETTEXT_PACKAGE, _gtk_get_localedir ());
+ bindtextdomain (GETTEXT_PACKAGE "-properties", _gtk_get_localedir ());
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
bind_textdomain_codeset (GETTEXT_PACKAGE "-properties", "UTF-8");
@@ -1257,66 +1142,6 @@ gtk_init_check_abi_check (int *argc, char ***argv, int num_checks, size_t sizeof
#endif
-/*
- * _gtk_get_lc_ctype:
- *
- * Return the Unix-style locale string for the language currently in
- * effect. On Unix systems, this is the return value from
- * <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
- * affect this through the environment variables LC_ALL, LC_CTYPE or
- * LANG (checked in that order). The locale strings typically is in
- * the form lang_COUNTRY, where lang is an ISO-639 language code, and
- * COUNTRY is an ISO-3166 country code. For instance, sv_FI for
- * Swedish as written in Finland or pt_BR for Portuguese as written in
- * Brazil.
- *
- * On Windows, the C library doesn't use any such environment
- * variables, and setting them won't affect the behaviour of functions
- * like ctime(). The user sets the locale through the Regional Options
- * in the Control Panel. The C library (in the setlocale() function)
- * does not use country and language codes, but country and language
- * names spelled out in English.
- * However, this function does check the above environment
- * variables, and does return a Unix-style locale string based on
- * either said environment variables or the thread's current locale.
- *
- * Return value: a dynamically allocated string, free with g_free().
- */
-
-gchar *
-_gtk_get_lc_ctype (void)
-{
-#ifdef G_OS_WIN32
- /* Somebody might try to set the locale for this process using the
- * LANG or LC_ environment variables. The Microsoft C library
- * doesn't know anything about them. You set the locale in the
- * Control Panel. Setting these env vars won't have any affect on
- * locale-dependent C library functions like ctime(). But just for
- * kicks, do obey LC_ALL, LC_CTYPE and LANG in GTK. (This also makes
- * it easier to test GTK and Pango in various default languages, you
- * don't have to clickety-click in the Control Panel, you can simply
- * start the program with LC_ALL=something on the command line.)
- */
- gchar *p;
-
- p = getenv ("LC_ALL");
- if (p != NULL)
- return g_strdup (p);
-
- p = getenv ("LC_CTYPE");
- if (p != NULL)
- return g_strdup (p);
-
- p = getenv ("LANG");
- if (p != NULL)
- return g_strdup (p);
-
- return g_win32_getlocale ();
-#else
- return g_strdup (setlocale (LC_CTYPE, NULL));
-#endif
-}
-
/**
* gtk_get_default_language:
*
@@ -2627,82 +2452,3 @@ gtk_propagate_event (GtkWidget *widget,
else
g_object_unref (widget);
}
-
-gboolean
-_gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
- gboolean signal_handled;
-
- signal_handled = g_value_get_boolean (handler_return);
- g_value_set_boolean (return_accu, signal_handled);
- continue_emission = !signal_handled;
-
- return continue_emission;
-}
-
-gboolean
-_gtk_single_string_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
- const gchar *str;
-
- str = g_value_get_string (handler_return);
- g_value_set_string (return_accu, str);
- continue_emission = str == NULL;
-
- return continue_emission;
-}
-
-GdkModifierType
-_gtk_replace_virtual_modifiers (GdkKeymap *keymap,
- GdkModifierType modifiers)
-{
- GdkModifierType result = 0;
- gint i;
-
- g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
-
- for (i = 0; i < 8; i++) /* SHIFT...MOD5 */
- {
- GdkModifierType real = 1 << i;
-
- if (modifiers & real)
- {
- GdkModifierType virtual = real;
-
- gdk_keymap_add_virtual_modifiers (keymap, &virtual);
-
- if (virtual == real)
- result |= virtual;
- else
- result |= virtual & ~real;
- }
- }
-
- return result;
-}
-
-GdkModifierType
-_gtk_get_primary_accel_mod (void)
-{
- static GdkModifierType primary = 0;
-
- if (! primary)
- {
- GdkDisplay *display = gdk_display_get_default ();
-
- primary = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
- GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
- primary = _gtk_replace_virtual_modifiers (gdk_keymap_get_for_display (display),
- primary);
- }
-
- return primary;
-}
diff --git a/gtk/gtkmainprivate.h b/gtk/gtkmainprivate.h
index 32530126d9..2932ed2c0a 100644
--- a/gtk/gtkmainprivate.h
+++ b/gtk/gtkmainprivate.h
@@ -23,18 +23,6 @@
G_BEGIN_DECLS
-gboolean _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy);
-
-gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy);
-
-gchar *_gtk_get_lc_ctype (void);
-
gboolean _gtk_module_has_mixed_deps (GModule *module);
G_END_DECLS
diff --git a/gtk/gtkmodules.c b/gtk/gtkmodules.c
index 451b3fbf5f..cdd85db5e1 100644
--- a/gtk/gtkmodules.c
+++ b/gtk/gtkmodules.c
@@ -23,9 +23,10 @@
#include <string.h>
#include "gtkmodules.h"
+#include "gtkmodulesprivate.h"
#include "gtksettings.h"
#include "gtkdebug.h"
-#include "gtkprivate.h" /* GTK_LIBDIR */
+#include "gtkprivate.h"
#include "gtkmainprivate.h"
#include "gtkintl.h"
@@ -74,7 +75,7 @@ get_module_path (void)
if (exe_prefix)
default_dir = g_build_filename (exe_prefix, "lib", "gtk-3.0", NULL);
else
- default_dir = g_build_filename (GTK_LIBDIR, "gtk-3.0", NULL);
+ default_dir = g_build_filename (_gtk_get_libdir (), "gtk-3.0", NULL);
if (module_path_env && home_gtk_dir)
module_path = g_build_path (G_SEARCHPATH_SEPARATOR_S,
diff --git a/gtk/gtkmodulesprivate.h b/gtk/gtkmodulesprivate.h
new file mode 100644
index 0000000000..88f1c5e7cf
--- /dev/null
+++ b/gtk/gtkmodulesprivate.h
@@ -0,0 +1,44 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_MODULES_PRIVATE_H__
+#define __GTK_MODULES_PRIVATE_H__
+
+G_BEGIN_DECLS
+
+gchar * _gtk_find_module (const gchar *name,
+ const gchar *type);
+gchar ** _gtk_get_module_path (const gchar *type);
+
+void _gtk_modules_init (gint *argc,
+ gchar ***argv,
+ const gchar *gtk_modules_args);
+void _gtk_modules_settings_changed (GtkSettings *settings,
+ const gchar *modules);
+
+G_END_DECLS
+
+#endif /* __GTK_MODULES_PRIVATE_H__ */
diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c
index 94ee9b9af7..b6bf547022 100644
--- a/gtk/gtkprintbackend.c
+++ b/gtk/gtkprintbackend.c
@@ -25,6 +25,7 @@
#include "gtkintl.h"
#include "gtkmodules.h"
+#include "gtkmodulesprivate.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
#include "gtkprintbackend.h"
diff --git a/gtk/gtkprivate.c b/gtk/gtkprivate.c
new file mode 100644
index 0000000000..73275fc13b
--- /dev/null
+++ b/gtk/gtkprivate.c
@@ -0,0 +1,206 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include <locale.h>
+
+#include "gdk/gdk.h"
+
+#include "gtkprivate.h"
+
+
+#if !defined G_OS_WIN32 && !(defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
+
+const gchar *
+_gtk_get_datadir (void)
+{
+ return GTK_DATADIR;
+}
+
+const gchar *
+_gtk_get_libdir (void)
+{
+ return GTK_LIBDIR;
+}
+
+const gchar *
+_gtk_get_sysconfdir (void)
+{
+ return GTK_SYSCONFDIR;
+}
+
+const gchar *
+_gtk_get_localedir (void)
+{
+ return GTK_LOCALEDIR;
+}
+
+const gchar *
+_gtk_get_data_prefix (void)
+{
+ return GTK_DATA_PREFIX;
+}
+
+#endif
+
+/* _gtk_get_lc_ctype:
+ *
+ * Return the Unix-style locale string for the language currently in
+ * effect. On Unix systems, this is the return value from
+ * <literal>setlocale(LC_CTYPE, NULL)</literal>, and the user can
+ * affect this through the environment variables LC_ALL, LC_CTYPE or
+ * LANG (checked in that order). The locale strings typically is in
+ * the form lang_COUNTRY, where lang is an ISO-639 language code, and
+ * COUNTRY is an ISO-3166 country code. For instance, sv_FI for
+ * Swedish as written in Finland or pt_BR for Portuguese as written in
+ * Brazil.
+ *
+ * On Windows, the C library doesn't use any such environment
+ * variables, and setting them won't affect the behaviour of functions
+ * like ctime(). The user sets the locale through the Regional Options
+ * in the Control Panel. The C library (in the setlocale() function)
+ * does not use country and language codes, but country and language
+ * names spelled out in English.
+ * However, this function does check the above environment
+ * variables, and does return a Unix-style locale string based on
+ * either said environment variables or the thread's current locale.
+ *
+ * Return value: a dynamically allocated string, free with g_free().
+ */
+
+gchar *
+_gtk_get_lc_ctype (void)
+{
+#ifdef G_OS_WIN32
+ /* Somebody might try to set the locale for this process using the
+ * LANG or LC_ environment variables. The Microsoft C library
+ * doesn't know anything about them. You set the locale in the
+ * Control Panel. Setting these env vars won't have any affect on
+ * locale-dependent C library functions like ctime(). But just for
+ * kicks, do obey LC_ALL, LC_CTYPE and LANG in GTK. (This also makes
+ * it easier to test GTK and Pango in various default languages, you
+ * don't have to clickety-click in the Control Panel, you can simply
+ * start the program with LC_ALL=something on the command line.)
+ */
+ gchar *p;
+
+ p = getenv ("LC_ALL");
+ if (p != NULL)
+ return g_strdup (p);
+
+ p = getenv ("LC_CTYPE");
+ if (p != NULL)
+ return g_strdup (p);
+
+ p = getenv ("LANG");
+ if (p != NULL)
+ return g_strdup (p);
+
+ return g_win32_getlocale ();
+#else
+ return g_strdup (setlocale (LC_CTYPE, NULL));
+#endif
+}
+
+gboolean
+_gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy)
+{
+ gboolean continue_emission;
+ gboolean signal_handled;
+
+ signal_handled = g_value_get_boolean (handler_return);
+ g_value_set_boolean (return_accu, signal_handled);
+ continue_emission = !signal_handled;
+
+ return continue_emission;
+}
+
+gboolean
+_gtk_single_string_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy)
+{
+ gboolean continue_emission;
+ const gchar *str;
+
+ str = g_value_get_string (handler_return);
+ g_value_set_string (return_accu, str);
+ continue_emission = str == NULL;
+
+ return continue_emission;
+}
+
+GdkModifierType
+_gtk_replace_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType modifiers)
+{
+ GdkModifierType result = 0;
+ gint i;
+
+ g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
+
+ for (i = 0; i < 8; i++) /* SHIFT...MOD5 */
+ {
+ GdkModifierType real = 1 << i;
+
+ if (modifiers & real)
+ {
+ GdkModifierType virtual = real;
+
+ gdk_keymap_add_virtual_modifiers (keymap, &virtual);
+
+ if (virtual == real)
+ result |= virtual;
+ else
+ result |= virtual & ~real;
+ }
+ }
+
+ return result;
+}
+
+GdkModifierType
+_gtk_get_primary_accel_mod (void)
+{
+ static GdkModifierType primary = 0;
+
+ if (! primary)
+ {
+ GdkDisplay *display = gdk_display_get_default ();
+
+ primary = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
+ primary = _gtk_replace_virtual_modifiers (gdk_keymap_get_for_display (display),
+ primary);
+ }
+
+ return primary;
+}
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index e9cfbc5c49..c87ff21d9a 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -33,47 +33,31 @@
G_BEGIN_DECLS
-#if defined G_OS_WIN32 \
- || (defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
-
-const gchar *_gtk_get_datadir ();
-const gchar *_gtk_get_libdir ();
-const gchar *_gtk_get_sysconfdir ();
-const gchar *_gtk_get_localedir ();
-const gchar *_gtk_get_data_prefix ();
-
-#undef GTK_DATADIR
-#define GTK_DATADIR _gtk_get_datadir ()
-#undef GTK_LIBDIR
-#define GTK_LIBDIR _gtk_get_libdir ()
-#undef GTK_LOCALEDIR
-#define GTK_LOCALEDIR _gtk_get_localedir ()
-#undef GTK_SYSCONFDIR
-#define GTK_SYSCONFDIR _gtk_get_sysconfdir ()
-#undef GTK_DATA_PREFIX
-#define GTK_DATA_PREFIX _gtk_get_data_prefix ()
-
-#endif /* G_OS_WIN32 */
-
#define GTK_PARAM_READABLE G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
#define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
-gboolean _gtk_fnmatch (const char *pattern,
- const char *string,
- gboolean no_leading_period);
+const gchar * _gtk_get_datadir (void);
+const gchar * _gtk_get_libdir (void);
+const gchar * _gtk_get_sysconfdir (void);
+const gchar * _gtk_get_localedir (void);
+const gchar * _gtk_get_data_prefix (void);
+
+gboolean _gtk_fnmatch (const char *pattern,
+ const char *string,
+ gboolean no_leading_period);
-gchar *_gtk_get_lc_ctype (void);
+gchar * _gtk_get_lc_ctype (void);
-gchar * _gtk_find_module (const gchar *name,
- const gchar *type);
-gchar **_gtk_get_module_path (const gchar *type);
+gboolean _gtk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy);
-void _gtk_modules_init (gint *argc,
- gchar ***argv,
- const gchar *gtk_modules_args);
-void _gtk_modules_settings_changed (GtkSettings *settings,
- const gchar *modules);
+gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
+ GValue *return_accu,
+ const GValue *handler_return,
+ gpointer dummy);
GdkModifierType _gtk_replace_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType modifiers);
diff --git a/gtk/gtkquartz.c b/gtk/gtkquartz.c
index 7f36e9e6a5..74570005cd 100644
--- a/gtk/gtkquartz.c
+++ b/gtk/gtkquartz.c
@@ -311,8 +311,9 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
forType:type];
}
-/*
- * Bundle-based functions for various directories. These almost work
+#ifdef QUARTZ_RELOCATION
+
+/* Bundle-based functions for various directories. These almost work
* even when the application isn't in a bundle, becuase mainBundle
* paths point to the bin directory in that case. It's a simple matter
* to test for that and remove the last element.
@@ -392,3 +393,5 @@ _gtk_get_data_prefix (void)
{
return get_bundle_path ();
}
+
+#endif /* QUARTZ_RELOCATION */
diff --git a/gtk/gtkquartz.h b/gtk/gtkquartz.h
index 54f4126e1d..ba56e1136e 100644
--- a/gtk/gtkquartz.h
+++ b/gtk/gtkquartz.h
@@ -39,9 +39,9 @@ GtkSelectionData *_gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *
void _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
GtkSelectionData *selection_data);
-
+
NSImage *_gtk_quartz_create_image_from_pixbuf (GdkPixbuf *pixbuf);
-
+
G_END_DECLS
#endif /* __GTK_QUARTZ_H__ */
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 6ce4822f4d..08e1583438 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -51,6 +51,7 @@
#include "gtkiconfactory.h"
#include "gtkmain.h"
#include "gtkmodules.h"
+#include "gtkmodulesprivate.h"
#include "gtkprivate.h"
#include "gtksettingsprivate.h"
#include "gtkwindow.h"
@@ -905,7 +906,7 @@ gtk_rc_make_default_dir (const gchar *type)
if (var)
path = g_build_filename (var, "lib", "gtk-3.0", GTK_BINARY_VERSION, type, NULL);
else
- path = g_build_filename (GTK_LIBDIR, "gtk-3.0", GTK_BINARY_VERSION, type, NULL);
+ path = g_build_filename (_gtk_get_libdir (), "gtk-3.0", GTK_BINARY_VERSION, type, NULL);
return path;
}
@@ -988,7 +989,7 @@ gtk_rc_get_theme_dir (void)
if (var)
path = g_build_filename (var, "share", "themes", NULL);
else
- path = g_build_filename (GTK_DATA_PREFIX, "share", "themes", NULL);
+ path = g_build_filename (_gtk_get_data_prefix (), "share", "themes", NULL);
return path;
}
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index a312d2219a..798cf88d19 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -24,6 +24,7 @@
#include <string.h>
#include "gtkmodules.h"
+#include "gtkmodulesprivate.h"
#include "gtksettingsprivate.h"
#include "gtkintl.h"
#include "gtkwidget.h"
@@ -292,7 +293,7 @@ gtk_settings_init (GtkSettings *settings)
}
g_free (pspecs);
- path = g_build_filename (GTK_SYSCONFDIR, "gtk-3.0", "settings.ini", NULL);
+ path = g_build_filename (_gtk_get_sysconfdir (), "gtk-3.0", "settings.ini", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
g_free (path);
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index e5e314f20e..d917a0c65c 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -27,6 +27,7 @@
#include <gtk/gtkintl.h>
#include "gtkprivate.h"
+#include "gtkmodulesprivate.h"
#include "gtkborderimageprivate.h"
#include "gtkpango.h"
#include "gtkshadowprivate.h"
diff --git a/gtk/gtkwin32.c b/gtk/gtkwin32.c
new file mode 100644
index 0000000000..858216657a
--- /dev/null
+++ b/gtk/gtkwin32.c
@@ -0,0 +1,143 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "config.h"
+
+#include "gdk/gdk.h"
+
+#include "gtkprivate.h"
+
+#ifdef G_OS_WIN32
+#define STRICT
+#include <windows.h>
+#undef STRICT
+#endif
+
+#ifdef G_OS_WIN32
+
+static HMODULE gtk_dll;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ gtk_dll = (HMODULE) hinstDLL;
+ break;
+ }
+
+ return TRUE;
+}
+
+const gchar *
+_gtk_get_libdir (void)
+{
+ static char *gtk_libdir = NULL;
+ if (gtk_libdir == NULL)
+ {
+ gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+ gchar *slash = strrchr (root, '\\');
+ if (g_ascii_strcasecmp (slash + 1, ".libs") == 0)
+ gtk_libdir = GTK_LIBDIR;
+ else
+ gtk_libdir = g_build_filename (root, "lib", NULL);
+ g_free (root);
+ }
+
+ return gtk_libdir;
+}
+
+const gchar *
+_gtk_get_localedir (void)
+{
+ static char *gtk_localedir = NULL;
+ if (gtk_localedir == NULL)
+ {
+ const gchar *p;
+ gchar *root, *temp;
+
+ /* GTK_LOCALEDIR ends in either /lib/locale or
+ * /share/locale. Scan for that slash.
+ */
+ p = GTK_LOCALEDIR + strlen (GTK_LOCALEDIR);
+ while (*--p != '/')
+ ;
+ while (*--p != '/')
+ ;
+
+ root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+ temp = g_build_filename (root, p, NULL);
+ g_free (root);
+
+ /* gtk_localedir is passed to bindtextdomain() which isn't
+ * UTF-8-aware.
+ */
+ gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
+ g_free (temp);
+ }
+ return gtk_localedir;
+}
+
+const gchar *
+_gtk_get_datadir (void)
+{
+ static char *gtk_datadir = NULL;
+ if (gtk_datadir == NULL)
+ {
+ gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+ gtk_datadir = g_build_filename (root, "share", NULL);
+ g_free (root);
+ }
+
+ return gtk_datadir;
+}
+
+const gchar *
+_gtk_get_sysconfdir (void)
+{
+ static char *gtk_sysconfdir = NULL;
+ if (gtk_sysconfdir == NULL)
+ {
+ gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
+ gtk_sysconfdir = g_build_filename (root, "etc", NULL);
+ g_free (root);
+ }
+
+ return gtk_sysconfdir;
+}
+
+const gchar *
+_gtk_get_data_prefix (void)
+{
+ static char *gtk_data_prefix = NULL;
+ if (gtk_data_prefix == NULL)
+ gtk_data_prefix = g_win32_get_package_installation_directory_of_module (gtk_dll);
+
+ return gtk_data_prefix;
+}