call setlocale ourselves because due to a GLib bug that sticks us in ASCII

2002-04-22  Havoc Pennington  <hp@redhat.com>

	* src/main.c (main): call setlocale ourselves because due to a
	GLib bug that sticks us in ASCII if you call g_print or anything
	prior to setlocale, and print a warning if we don't set the locale
	successfully. #79280

	* src/workspace.c (meta_workspace_get_work_area): be more verbose
	about how the work area was computed, to help find bugs here.

	* src/main.c (main): put locale and codeset in the log file
This commit is contained in:
Havoc Pennington 2002-04-22 18:18:38 +00:00 committed by Havoc Pennington
parent 1d818b7b7c
commit 5fd4fb96f7
4 changed files with 43 additions and 7 deletions

View File

@ -1,3 +1,15 @@
2002-04-22 Havoc Pennington <hp@redhat.com>
* src/main.c (main): call setlocale ourselves because due to a
GLib bug that sticks us in ASCII if you call g_print or anything
prior to setlocale, and print a warning if we don't set the locale
successfully. #79280
* src/workspace.c (meta_workspace_get_work_area): be more verbose
about how the work area was computed, to help find bugs here.
* src/main.c (main): put locale and codeset in the log file
2002-04-21 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_send_icccm_message): add error trap,

View File

@ -64,6 +64,9 @@ meta_window_ensure_frame (MetaWindow *window)
XVisualIDFromVisual (window->screen->default_xvisual) ?
"is" : "is not",
window->depth, window->screen->default_depth);
meta_verbose ("Frame geometry %d,%d %dx%d\n",
frame->rect.x, frame->rect.y,
frame->rect.width, frame->rect.height);
/* Default depth/visual handles clients with weird visuals; they can
* always be children of the root depth/visual obviously, but

View File

@ -74,6 +74,11 @@ main (int argc, char **argv)
const char *prev_arg;
const char *save_file;
g_set_prgname (argv[0]);
if (setlocale (LC_ALL, "") == NULL)
meta_warning ("Locale not understood by C library, internationalization will not work\n");
sigemptyset (&empty_mask);
act.sa_handler = SIG_IGN;
act.sa_mask = empty_mask;
@ -85,18 +90,23 @@ main (int argc, char **argv)
g_printerr ("Failed to register SIGXFSZ handler: %s\n", strerror (errno));
#endif
g_set_prgname (argv[0]);
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
if (g_getenv ("METACITY_VERBOSE"))
meta_set_verbose (TRUE);
if (g_getenv ("METACITY_DEBUG"))
meta_set_debugging (TRUE);
meta_set_syncing (g_getenv ("METACITY_SYNC") != NULL);
{
const char *charset;
g_get_charset (&charset);
meta_verbose ("Running in locale \"%s\" with encoding \"%s\"\n",
setlocale (LC_ALL, NULL), charset);
}
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
/* Parse options lamely */
display_name = NULL;

View File

@ -386,6 +386,11 @@ meta_workspace_get_work_area (MetaWorkspace *workspace,
if (w->has_struts)
{
meta_topic (META_DEBUG_WORKAREA,
"Merging win %s with %d %d %d %d with %d %d %d %d\n",
w->desc,
w->left_strut, w->right_strut, w->top_strut, w->bottom_strut,
left_strut, right_strut, top_strut, bottom_strut);
left_strut = MAX (left_strut, w->left_strut);
right_strut = MAX (right_strut, w->right_strut);
top_strut = MAX (top_strut, w->top_strut);
@ -402,12 +407,18 @@ meta_workspace_get_work_area (MetaWorkspace *workspace,
if ((left_strut + right_strut) > (workspace->screen->width - MIN_SANE_AREA))
{
meta_topic (META_DEBUG_WORKAREA,
"Making left/right struts %d %d sane\n",
left_strut, right_strut);
left_strut = (workspace->screen->width - MIN_SANE_AREA) / 2;
right_strut = left_strut;
}
if ((top_strut + bottom_strut) > (workspace->screen->height - MIN_SANE_AREA))
{
meta_topic (META_DEBUG_WORKAREA,
"Making top/bottom struts %d %d sane\n",
top_strut, bottom_strut);
top_strut = (workspace->screen->height - MIN_SANE_AREA) / 2;
bottom_strut = top_strut;
}