From 582a80f518033c13dc58906f14afce90b15de93b Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Mon, 17 Sep 2001 05:50:02 +0000 Subject: ref the returned icon, oops. 2001-09-17 Havoc Pennington * src/ui.c (meta_ui_get_default_mini_icon): (meta_ui_get_default_window_icon): ref the returned icon, oops. * src/main.c (main): get the GLib warning/error output into the metacity logfile, set warnings to be always fatal * configure.in: bump version to 2.3.13 * src/window.c (get_text_property): hrm, fix bug where we didn't check errors on XGetTextProperty --- ChangeLog | 13 +++++++++++++ configure.in | 2 +- src/main.c | 14 ++++++++++++++ src/ui.c | 4 ++++ src/window.c | 41 ++++++++++++++++++++++++++--------------- 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index d290d5a1..4172a874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-09-17 Havoc Pennington + + * src/ui.c (meta_ui_get_default_mini_icon): + (meta_ui_get_default_window_icon): ref the returned icon, oops. + + * src/main.c (main): get the GLib warning/error output into + the metacity logfile, set warnings to be always fatal + + * configure.in: bump version to 2.3.13 + + * src/window.c (get_text_property): hrm, fix bug where we didn't + check errors on XGetTextProperty + 2001-09-17 Havoc Pennington * src/Makefile.am (VARIABLES): fix srcdir != builddir glitch diff --git a/configure.in b/configure.in index 8d4741da..77e816d5 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ AC_INIT(src/display.c) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(metacity, 2.3.8) +AM_INIT_AUTOMAKE(metacity, 2.3.13) GETTEXT_PACKAGE=metacity AC_SUBST(GETTEXT_PACKAGE) diff --git a/src/main.c b/src/main.c index 8f3bb411..a5eddb12 100644 --- a/src/main.c +++ b/src/main.c @@ -38,6 +38,15 @@ static MetaExitCode meta_exit_code = META_EXIT_SUCCESS; static GMainLoop *meta_main_loop = NULL; +static void +log_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) +{ + meta_warning ("GLib log level %d: %s\n", log_level, message); +} + static void usage (void) { @@ -164,6 +173,11 @@ main (int argc, char **argv) /* must be after UI init so we can override GDK handlers */ meta_errors_init (); + + g_log_set_handler (NULL, + G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, + log_handler, NULL); + g_log_set_always_fatal (G_LOG_LEVEL_MASK); if (!meta_display_open (NULL)) meta_exit (META_EXIT_ERROR); diff --git a/src/ui.c b/src/ui.c index f56f427a..0376e8f5 100644 --- a/src/ui.c +++ b/src/ui.c @@ -444,6 +444,8 @@ meta_ui_get_default_window_icon (MetaUI *ui) g_object_unref (G_OBJECT (base)); } + g_object_ref (G_OBJECT (default_icon)); + return default_icon; } @@ -470,6 +472,8 @@ meta_ui_get_default_mini_icon (MetaUI *ui) g_object_unref (G_OBJECT (base)); } + g_object_ref (G_OBJECT (default_icon)); + return default_icon; } diff --git a/src/window.c b/src/window.c index c253526b..c90299fb 100644 --- a/src/window.c +++ b/src/window.c @@ -3568,16 +3568,23 @@ get_text_property (MetaDisplay *display, meta_error_trap_push (display); - XGetTextProperty (display->xdisplay, - xwindow, - &text, - atom); - - retval = meta_text_property_to_utf8 (display->xdisplay, &text); - - if (text.nitems > 0) - XFree (text.value); + text.nitems = 0; + if (XGetTextProperty (display->xdisplay, + xwindow, + &text, + atom)) + { + retval = meta_text_property_to_utf8 (display->xdisplay, &text); + if (text.nitems > 0) + XFree (text.value); + } + else + { + retval = NULL; + meta_verbose ("XGetTextProperty() failed\n"); + } + meta_error_trap_pop (display); return retval; @@ -4043,7 +4050,9 @@ static void replace_icon (MetaWindow *window, GdkPixbuf *unscaled, GdkPixbuf *unscaled_mini) -{ +{ + clear_icon (window); + if (gdk_pixbuf_get_width (unscaled) != META_ICON_WIDTH || gdk_pixbuf_get_height (unscaled) != META_ICON_HEIGHT) { @@ -4296,7 +4305,6 @@ update_icon (MetaWindow *window, { meta_verbose ("No WM_NORMAL_HINTS icon, or failed to retrieve it\n"); } - if (try_pixmap_and_mask (window, window->kwm_pixmap, @@ -4312,10 +4320,13 @@ update_icon (MetaWindow *window, /* Fallback to a default icon */ if (window->icon == NULL) - { - window->icon = meta_ui_get_default_window_icon (window->screen->ui); - window->mini_icon = meta_ui_get_default_mini_icon (window->screen->ui); - } + window->icon = meta_ui_get_default_window_icon (window->screen->ui); + + if (window->mini_icon == NULL) + window->mini_icon = meta_ui_get_default_mini_icon (window->screen->ui); + + g_assert (window->icon); + g_assert (window->mini_icon); return Success; } -- cgit v1.2.1