[gtk/wip/damaged-but-no-frost-bite: 3/5] xxx! add alex's hack for getting reproducible timings
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/damaged-but-no-frost-bite: 3/5] xxx! add alex's hack for getting reproducible timings
- Date: Fri, 29 May 2020 20:22:54 +0000 (UTC)
commit 4c7eb9d8282c0242ffdb5b69fdf92c8db7ebeb68
Author: Ray Strode <rstrode redhat com>
Date: Fri May 29 09:26:12 2020 -0400
xxx! add alex's hack for getting reproducible timings
demos/gtk-demo/fishbowl.ui | 1 +
demos/gtk-demo/gtkfishbowl.c | 10 +++++-----
demos/gtk-demo/main.c | 10 ++++++++--
3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/demos/gtk-demo/fishbowl.ui b/demos/gtk-demo/fishbowl.ui
index fcf5d38fa4..3f887c6df3 100644
--- a/demos/gtk-demo/fishbowl.ui
+++ b/demos/gtk-demo/fishbowl.ui
@@ -50,6 +50,7 @@
<object class="GtkToggleButton" id="changes_allow">
<property name="icon-name">changes-allow</property>
<property name="has-frame">0</property>
+ <property name="active">1</property>
<signal name="notify::active" handler="fishbowl_changes_toggled_cb"/>
</object>
</child>
diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c
index 0d9f85f124..42536d0a3b 100644
--- a/demos/gtk-demo/gtkfishbowl.c
+++ b/demos/gtk-demo/gtkfishbowl.c
@@ -160,7 +160,7 @@ static double
new_speed (void)
{
/* 5s to 50s to cross screen seems fair */
- return g_random_double_range (0.02, 0.2);
+ return 0.4;//g_random_double_range (0.02, 0.2);
}
static void
@@ -574,23 +574,23 @@ gtk_fishbowl_tick (GtkWidget *widget,
if (child->x <= 0)
{
- child->x = 0;
+ child->x = -child->x;
child->dx = new_speed ();
}
else if (child->x >= 1)
{
- child->x = 1;
+ child->x = 2 - child->x;
child->dx = - new_speed ();
}
if (child->y <= 0)
{
- child->y = 0;
+ child->y = -child->y;
child->dy = new_speed ();
}
else if (child->y >= 1)
{
- child->y = 1;
+ child->y = 2 - child->y;
child->dy = - new_speed ();
}
}
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 653e7a2f4a..df13f0f71a 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -10,6 +10,7 @@
#include "demos.h"
+static gboolean is_run;
static GtkWidget *info_view;
static GtkWidget *source_view;
@@ -1031,7 +1032,8 @@ activate (GApplication *app)
gtk_tree_view_collapse_all (GTK_TREE_VIEW (treeview));
- gtk_widget_show (GTK_WIDGET (window));
+ if (!is_run)
+ gtk_widget_show (GTK_WIDGET (window));
g_object_unref (builder);
}
@@ -1077,13 +1079,17 @@ command_line (GApplication *app,
GDoDemoFunc func = 0;
GtkWidget *window, *demo;
- activate (app);
options = g_application_command_line_get_options_dict (cmdline);
g_variant_dict_lookup (options, "run", "&s", &name);
g_variant_dict_lookup (options, "autoquit", "b", &autoquit);
g_variant_dict_lookup (options, "list", "b", &list);
+ is_run = name != NULL;
+
+ activate (app);
+
+
if (list)
{
list_demos ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]