From ccc270eea1acaf9a9eb7e0c3a6f289c9c844d129 Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Sun, 10 Jun 2007 16:23:59 +0000 Subject: Don't bother resizing/repositioning frames when the core asks us to if it would result in no difference. Hopefully this fixes nsgtk consuming all available CPU on sites like news.bbc.co.uk svn path=/trunk/netsurf/; revision=3328 --- gtk/gtk_window.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gtk/gtk_window.c') diff --git a/gtk/gtk_window.c b/gtk/gtk_window.c index 6be2c37d0..638df28dc 100644 --- a/gtk/gtk_window.c +++ b/gtk/gtk_window.c @@ -245,8 +245,22 @@ void gui_window_position_frame(struct gui_window *g, int x0, int y0, int x1, int assert(w); assert(f); LOG(("%s: %d,%d %dx%d", g->bw->name, x0, y0, x1-x0+2, y1-y0+2)); - gtk_fixed_move(f, w, x0, y0); - gtk_widget_set_size_request(w, x1 - x0 + 2, y1 - y0 + 2); + + /* if the window has not changed position or size, do not bother + * moving/resising it. + */ + + LOG((" current: %d,%d %dx%d", + w->allocation.x, w->allocation.y, + w->allocation.width, w->allocation.height)); + + if (w->allocation.x != x0 || w->allocation.y != y0 || + w->allocation.width != x1 - x0 + 2 || + w->allocation.height != y1 - y0 + 2) { + LOG((" frame has moved/resized.")); + gtk_fixed_move(f, w, x0, y0); + gtk_widget_set_size_request(w, x1 - x0 + 2, y1 - y0 + 2); + } } gboolean nsgtk_window_expose_event(GtkWidget *widget, -- cgit v1.2.3