From 9e8800561e0f8c00a342a8f77289030c0590e1fb Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 8 Jun 2002 05:13:55 +0000 Subject: [PATCH] only invalidate things if the struts actually change, since the panel 2002-06-08 Havoc Pennington * src/window.c (update_struts): only invalidate things if the struts actually change, since the panel likes to set them over and over. May fix the infinite loop that caused 100% CPU usage. --- ChangeLog | 6 ++++++ src/window.c | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef38bdbdf..4dc7b4df4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-06-08 Havoc Pennington + + * src/window.c (update_struts): only invalidate things if the + struts actually change, since the panel likes to set them over and + over. May fix the infinite loop that caused 100% CPU usage. + 2002-06-07 Havoc Pennington * src/screen.c (meta_screen_new): use XineramaIsActive() not diff --git a/src/window.c b/src/window.c index d0b84f990..ca26a2598 100644 --- a/src/window.c +++ b/src/window.c @@ -4653,9 +4653,22 @@ update_struts (MetaWindow *window) { gulong *struts = NULL; int nitems; - + gboolean old_has_struts; + gboolean old_do_not_cover; + int old_left; + int old_right; + int old_top; + int old_bottom; + meta_verbose ("Updating struts for %s\n", window->desc); + old_has_struts = window->has_struts; + old_do_not_cover = window->do_not_cover; + old_left = window->left_strut; + old_right = window->right_strut; + old_top = window->top_strut; + old_bottom = window->bottom_strut; + window->has_struts = FALSE; window->do_not_cover = FALSE; window->left_strut = 0; @@ -4727,10 +4740,23 @@ update_struts (MetaWindow *window) } } - meta_topic (META_DEBUG_WORKAREA, - "Invalidating work areas of window %s due to struts update\n", - window->desc); - invalidate_work_areas (window); + if (old_has_struts != window->has_struts || + old_do_not_cover != window->do_not_cover || + old_left != window->left_strut || + old_right != window->right_strut || + old_top != window->top_strut || + old_bottom != window->bottom_strut) + { + meta_topic (META_DEBUG_WORKAREA, + "Invalidating work areas of window %s due to struts update\n", + window->desc); + invalidate_work_areas (window); + } + else + { + meta_topic (META_DEBUG_WORKAREA, + "Struts on %s were unchanged\n", window->desc); + } } static void