From 5fd4fb96f7f54f20be2bfeec646703edeab4c674 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 22 Apr 2002 18:18:38 +0000 Subject: [PATCH] call setlocale ourselves because due to a GLib bug that sticks us in ASCII 2002-04-22 Havoc Pennington * 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 --- ChangeLog | 12 ++++++++++++ src/frame.c | 5 ++++- src/main.c | 22 ++++++++++++++++------ src/workspace.c | 11 +++++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51b530e9f..3905730a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-04-22 Havoc Pennington + + * 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 * src/window.c (meta_window_send_icccm_message): add error trap, diff --git a/src/frame.c b/src/frame.c index 0c0b31985..54d786b8e 100644 --- a/src/frame.c +++ b/src/frame.c @@ -64,7 +64,10 @@ 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 * e.g. DRI games can't be children of a parent that has the same diff --git a/src/main.c b/src/main.c index 2634bf6ce..509a161b4 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,11 @@ main (int argc, char **argv) gboolean disable_sm; 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; @@ -84,19 +89,24 @@ main (int argc, char **argv) if (sigaction (SIGXFSZ, &act, 0) < 0) 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; diff --git a/src/workspace.c b/src/workspace.c index bd98eedc4..e88a976c4 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -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; }