[gtk+/extended-layout-jhs: 10/64] Don't create the tile pixmap with every expose event.
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/extended-layout-jhs: 10/64] Don't create the tile pixmap with every expose event.
- Date: Wed, 25 Nov 2009 11:19:45 +0000 (UTC)
commit 1942e6f2a947c62e359bfcf39cfe5cb7a73adfd3
Author: Mathias Hasselmann <mathias hasselmann gmx de>
Date: Wed Jun 20 18:58:07 2007 +0000
Don't create the tile pixmap with every expose event.
2007-06-20 Mathias Hasselmann <mathias hasselmann gmx de>
* tests/testextendedlayout.c: Don't create
the tile pixmap with every expose event.
svn path=/branches/extended-layout/; revision=18211
ChangeLog.gtk-extended-layout | 5 +++++
tests/testextendedlayout.c | 33 ++++++++++++++++++++++++++-------
2 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog.gtk-extended-layout b/ChangeLog.gtk-extended-layout
index 71fbb0d..5e0b18e 100644
--- a/ChangeLog.gtk-extended-layout
+++ b/ChangeLog.gtk-extended-layout
@@ -1,5 +1,10 @@
2007-06-20 Mathias Hasselmann <mathias hasselmann gmx de>
+ * tests/testextendedlayout.c: Don't create
+ the tile pixmap with every expose event.
+
+2007-06-20 Mathias Hasselmann <mathias hasselmann gmx de>
+
* gtk/gtkextendedlayout.h, tests/testextendedlayout.c:
Dynamically highlight the currently hovered widget and its guides.
diff --git a/tests/testextendedlayout.c b/tests/testextendedlayout.c
index 7edefaa..06a4a73 100644
--- a/tests/testextendedlayout.c
+++ b/tests/testextendedlayout.c
@@ -92,6 +92,7 @@ struct _TestSuite
gint n_test_cases;
gint level;
+ GdkPixmap *tile;
GtkWidget *current;
gint timestamp;
};
@@ -684,7 +685,6 @@ draw_guides (gpointer data)
{
TestCase *test = data;
GdkDrawable *drawable;
- GdkPixmap *tile;
const GList *iter;
@@ -698,11 +698,7 @@ draw_guides (gpointer data)
gc = gdk_gc_new_with_values (drawable, &values,
GDK_GC_SUBWINDOW);
- tile = gdk_pixmap_colormap_create_from_xpm_d (drawable, NULL, NULL,
- NULL, mask_xpm);
- gdk_gc_set_tile (gc, tile);
- g_object_unref (tile);
-
+ gdk_gc_set_tile (gc, test->suite->tile);
gdk_gc_set_dashes (gc, 1, dashes, 2);
for (iter = test->guides; iter; iter = iter->next)
@@ -821,6 +817,18 @@ test_suite_append (TestSuite *self,
attach_sub_windows, test);
}
+static void
+realize_notebook_cb (GtkWidget *widget,
+ gpointer data)
+{
+ TestSuite *suite = data;
+
+ suite->tile =
+ gdk_pixmap_colormap_create_from_xpm_d (
+ suite->notebook->window, NULL, NULL, NULL,
+ mask_xpm);
+}
+
static TestSuite*
test_suite_new ()
{
@@ -878,10 +886,20 @@ test_suite_new ()
gtk_notebook_append_page (GTK_NOTEBOOK (self->notebook),
scroller, gtk_label_new ("Results"));
+ g_signal_connect (self->notebook, "realize",
+ G_CALLBACK (realize_notebook_cb), self);
+
return self;
}
static void
+test_suite_free (TestSuite* self)
+{
+ g_object_unref (self->tile);
+ g_free (self);
+}
+
+static void
test_suite_start (TestSuite *self)
{
if (0 == self->level++)
@@ -1231,7 +1249,6 @@ main (int argc, char *argv[])
gtk_init (&argc, &argv);
suite = test_suite_new ();
-
actions = gtk_hbox_new (FALSE, 12);
align = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
@@ -1266,6 +1283,8 @@ main (int argc, char *argv[])
gtk_main ();
+ test_suite_free (suite);
+
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]