]> Pileus Git - ~andy/gtk/blob - gtk/gtkwin32.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkwin32.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #include "config.h"
26
27 #include "gdk/gdk.h"
28
29 #include "gtkprivate.h"
30
31 #define STRICT
32 #include <windows.h>
33 #undef STRICT
34
35 static HMODULE gtk_dll;
36
37 BOOL WINAPI
38 DllMain (HINSTANCE hinstDLL,
39          DWORD     fdwReason,
40          LPVOID    lpvReserved)
41 {
42   switch (fdwReason)
43     {
44     case DLL_PROCESS_ATTACH:
45       gtk_dll = (HMODULE) hinstDLL;
46       break;
47     }
48
49   return TRUE;
50 }
51
52 const gchar *
53 _gtk_get_libdir (void)
54 {
55   static char *gtk_libdir = NULL;
56   if (gtk_libdir == NULL)
57     {
58       gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
59       gchar *slash = strrchr (root, '\\');
60       if (slash != NULL &&
61           g_ascii_strcasecmp (slash + 1, ".libs") == 0)
62         gtk_libdir = GTK_LIBDIR;
63       else
64         gtk_libdir = g_build_filename (root, "lib", NULL);
65       g_free (root);
66     }
67
68   return gtk_libdir;
69 }
70
71 const gchar *
72 _gtk_get_localedir (void)
73 {
74   static char *gtk_localedir = NULL;
75   if (gtk_localedir == NULL)
76     {
77       const gchar *p;
78       gchar *root, *temp;
79
80       /* GTK_LOCALEDIR ends in either /lib/locale or
81        * /share/locale. Scan for that slash.
82        */
83       p = GTK_LOCALEDIR + strlen (GTK_LOCALEDIR);
84       while (*--p != '/')
85         ;
86       while (*--p != '/')
87         ;
88
89       root = g_win32_get_package_installation_directory_of_module (gtk_dll);
90       temp = g_build_filename (root, p, NULL);
91       g_free (root);
92
93       /* gtk_localedir is passed to bindtextdomain() which isn't
94        * UTF-8-aware.
95        */
96       gtk_localedir = g_win32_locale_filename_from_utf8 (temp);
97       g_free (temp);
98     }
99   return gtk_localedir;
100 }
101
102 const gchar *
103 _gtk_get_datadir (void)
104 {
105   static char *gtk_datadir = NULL;
106   if (gtk_datadir == NULL)
107     {
108       gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
109       gtk_datadir = g_build_filename (root, "share", NULL);
110       g_free (root);
111     }
112
113   return gtk_datadir;
114 }
115
116 const gchar *
117 _gtk_get_sysconfdir (void)
118 {
119   static char *gtk_sysconfdir = NULL;
120   if (gtk_sysconfdir == NULL)
121     {
122       gchar *root = g_win32_get_package_installation_directory_of_module (gtk_dll);
123       gtk_sysconfdir = g_build_filename (root, "etc", NULL);
124       g_free (root);
125     }
126
127   return gtk_sysconfdir;
128 }
129
130 const gchar *
131 _gtk_get_data_prefix (void)
132 {
133   static char *gtk_data_prefix = NULL;
134   if (gtk_data_prefix == NULL)
135     gtk_data_prefix = g_win32_get_package_installation_directory_of_module (gtk_dll);
136
137   return gtk_data_prefix;
138 }