diff options
author | Rob Kendrick <rjek@netsurf-browser.org> | 2007-06-10 16:23:59 +0000 |
---|---|---|
committer | Rob Kendrick <rjek@netsurf-browser.org> | 2007-06-10 16:23:59 +0000 |
commit | ccc270eea1acaf9a9eb7e0c3a6f289c9c844d129 (patch) | |
tree | 27e433666dc8f04357aaf374e780fea1be3e829b | |
parent | b46f0cb2b3418b37d4fea68e3d193a024d32f918 (diff) | |
download | netsurf-ccc270eea1acaf9a9eb7e0c3a6f289c9c844d129.tar.gz netsurf-ccc270eea1acaf9a9eb7e0c3a6f289c9c844d129.tar.bz2 |
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
-rw-r--r-- | gtk/gtk_window.c | 18 |
1 files changed, 16 insertions, 2 deletions
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, |