sysprof r409 - trunk
- From: otaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: sysprof r409 - trunk
- Date: Tue, 1 Apr 2008 18:46:06 +0100 (BST)
Author: otaylor
Date: Tue Apr 1 18:46:06 2008
New Revision: 409
URL: http://svn.gnome.org/viewvc/sysprof?rev=409&view=rev
Log:
2008-04-01 Owen Taylor <otaylor redhat com>
* sysprof.c (on_samples_label_size_request): Constrain the
samples label to only grow wider instead of bouncing around.
Modified:
trunk/ChangeLog
trunk/sysprof.c
Modified: trunk/sysprof.c
==============================================================================
--- trunk/sysprof.c (original)
+++ trunk/sysprof.c Tue Apr 1 18:46:06 2008
@@ -71,6 +71,7 @@
GtkWidget * screenshot_item;
GtkWidget * samples_label;
+ int samples_label_width;
gboolean screenshot_window_visible;
GtkWidget * screenshot_textview;
@@ -1321,6 +1322,31 @@
update_sensitivity (app);
}
+/* If the samples label bounces around in size, this can cause the
+ * entire toolbar to be repeatedly redrawn, consuming significant CPU and
+ * distorting the profile. Constraining the label to only grow wider
+ * means that the toolbar will only be redrawn a few times as we gain
+ * more digits.
+ */
+static void
+on_samples_label_size_request (GtkWidget *widget,
+ GtkRequisition *requistion,
+ Application *app)
+{
+ if (app->samples_label_width >= requistion->width)
+ requistion->width = app->samples_label_width;
+ else if (requistion->width > app->samples_label_width)
+ app->samples_label_width = requistion->width;
+}
+
+static void
+on_samples_label_style_set (GtkWidget *widget,
+ GtkStyle *previous_style,
+ Application *app)
+{
+ app->samples_label_width = 0;
+}
+
static void
set_sizes (GtkWindow *window,
GtkWindow *screenshot_window,
@@ -1462,6 +1488,10 @@
app->samples_label = glade_xml_get_widget (xml, "samples_label");
+ g_signal_connect(app->samples_label, "size-request",
+ G_CALLBACK (on_samples_label_size_request), app);
+ g_signal_connect(app->samples_label, "style-set",
+ G_CALLBACK (on_samples_label_style_set), app);
/* Menu items */
app->start_item = glade_xml_get_widget (xml, "start_item");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]