mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Constrain the samples label to only grow wider instead of bouncing around.
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. svn path=/trunk/; revision=409
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2008-03-29 Soren Sandmann <sandmann@daimi.au.dk>
|
2008-03-29 Soren Sandmann <sandmann@daimi.au.dk>
|
||||||
|
|
||||||
Work around GTK+ ABI break.
|
Work around GTK+ ABI break.
|
||||||
|
|||||||
30
sysprof.c
30
sysprof.c
@ -71,6 +71,7 @@ struct Application
|
|||||||
GtkWidget * screenshot_item;
|
GtkWidget * screenshot_item;
|
||||||
|
|
||||||
GtkWidget * samples_label;
|
GtkWidget * samples_label;
|
||||||
|
int samples_label_width;
|
||||||
|
|
||||||
gboolean screenshot_window_visible;
|
gboolean screenshot_window_visible;
|
||||||
GtkWidget * screenshot_textview;
|
GtkWidget * screenshot_textview;
|
||||||
@ -1321,6 +1322,31 @@ on_screenshot_close_button_clicked (GtkWidget *widget,
|
|||||||
update_sensitivity (app);
|
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
|
static void
|
||||||
set_sizes (GtkWindow *window,
|
set_sizes (GtkWindow *window,
|
||||||
GtkWindow *screenshot_window,
|
GtkWindow *screenshot_window,
|
||||||
@ -1462,6 +1488,10 @@ build_gui (Application *app)
|
|||||||
|
|
||||||
|
|
||||||
app->samples_label = glade_xml_get_widget (xml, "samples_label");
|
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 */
|
/* Menu items */
|
||||||
app->start_item = glade_xml_get_widget (xml, "start_item");
|
app->start_item = glade_xml_get_widget (xml, "start_item");
|
||||||
|
|||||||
Reference in New Issue
Block a user