[gromit] Fixed stray lines bug
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gromit] Fixed stray lines bug
- Date: Tue, 16 Mar 2010 23:16:25 +0000 (UTC)
commit e2a030eae4496b70c94bceebb30180ae7ca52ce8
Author: Simon Budig <simon budig de>
Date: Tue Mar 16 23:42:37 2010 +0100
Fixed stray lines bug
- using GIMPs hack for gdk_device_get_history() quirks
- check return values of gdk_device_get_axis() (not bug-related AFAIKT)
- tweaks for build and git migration.
.gitignore | 18 ++++++++++++++++++
Makefile.am | 2 +-
autogen.sh | 2 +-
gromit.c | 34 ++++++++++++++++++++++------------
gromit.doap | 18 ++++++++++++++++++
5 files changed, 60 insertions(+), 14 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2aada1f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,18 @@
+.deps/
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache/
+config.guess
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+gromit
+gromit-gromit.o
+
diff --git a/Makefile.am b/Makefile.am
index b6c0eaa..7477a1f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
bin_PROGRAMS = gromit
gromit_SOURCES = gromit.c
-gromit_CFLAGS = $(GTK_CFLAGS)
+gromit_CFLAGS = -g $(GTK_CFLAGS)
gromit_LDADD = $(GTK_LIBS)
EXTRA_DIST = \
diff --git a/autogen.sh b/autogen.sh
index 3c614c5..d53cc4c 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-version=1.9
+version=1.11
set -x
aclocal-$version
autoconf
diff --git a/gromit.c b/gromit.c
index 0fb8119..f840cf5 100644
--- a/gromit.c
+++ b/gromit.c
@@ -698,7 +698,7 @@ paint (GtkWidget *win, GdkEventButton *ev, gpointer user_data)
(double) data->cur_context->width);
}
if (ev->button <= 5)
- gromit_draw_line (data, ev->x, ev->y, ev->x, ev->y);
+ gromit_draw_line (data, ev->x, ev->y, ev->x, ev->y);
gromit_coord_list_prepend (data, ev->x, ev->y, data->maxwidth);
@@ -716,7 +716,7 @@ paintto (GtkWidget *win,
{
GromitData *data = (GromitData *) user_data;
GdkTimeCoord **coords = NULL;
- int nevents;
+ int nevents = 0;
int i;
gboolean ret;
gdouble pressure = 0.5;
@@ -728,18 +728,22 @@ paintto (GtkWidget *win,
gromit_select_tool (data, ev->device, ev->state);
ret = gdk_device_get_history (ev->device, ev->window,
- data->motion_time, ev->time,
+ data->motion_time + 1, ev->time - 1,
&coords, &nevents);
/* g_printerr ("Got %d coords\n", nevents); */
- if (!data->xinerama && nevents > 0)
+ if (!data->xinerama && ret && nevents > 0)
{
for (i=0; i < nevents; i++)
{
gdouble x, y;
- gdk_device_get_axis (ev->device, coords[i]->axes,
- GDK_AXIS_PRESSURE, &pressure);
+ ret = gdk_device_get_axis (ev->device, coords[i]->axes,
+ GDK_AXIS_PRESSURE, &pressure);
+
+ if (!ret)
+ pressure = 1.0;
+
if (pressure > 0)
{
if (ev->device->source == GDK_SOURCE_MOUSE)
@@ -748,10 +752,14 @@ paintto (GtkWidget *win,
data->maxwidth = (CLAMP (pressure * pressure, 0, 1) *
(double) data->cur_context->width);
- gdk_device_get_axis(ev->device, coords[i]->axes,
- GDK_AXIS_X, &x);
- gdk_device_get_axis(ev->device, coords[i]->axes,
- GDK_AXIS_Y, &y);
+ ret = gdk_device_get_axis(ev->device, coords[i]->axes,
+ GDK_AXIS_X, &x);
+
+ ret &= gdk_device_get_axis(ev->device, coords[i]->axes,
+ GDK_AXIS_Y, &y);
+
+ if (!ret)
+ continue;
gromit_draw_line (data, data->lastx, data->lasty, x, y);
@@ -762,9 +770,11 @@ paintto (GtkWidget *win,
}
data->motion_time = coords[nevents-1]->time;
- g_free (coords);
}
+ if (coords)
+ gdk_device_free_history (coords, nevents);
+
/* always paint to the current event coordinate. */
gdk_event_get_axis ((GdkEvent *) ev, GDK_AXIS_PRESSURE, &pressure);
@@ -1679,7 +1689,7 @@ main (int argc, char **argv)
GromitData *data;
gtk_init (&argc, &argv);
- data = g_malloc (sizeof (GromitData));
+ data = g_malloc0 (sizeof (GromitData));
/* g_set_printerr_handler (quiet_print_handler); */
diff --git a/gromit.doap b/gromit.doap
new file mode 100644
index 0000000..fdee6b6
--- /dev/null
+++ b/gromit.doap
@@ -0,0 +1,18 @@
+<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:gnome="http://api.gnome.org/doap-extensions#"
+ xmlns="http://usefulinc.com/ns/doap#">
+
+ <name xml:lang="en">Gromit</name>
+ <shortdesc xml:lang="en">Gromit draws annotations on the screen</shortdesc>
+ <homepage rdf:resource="http://www.home.unix-ag.org/simon/gromit/" />
+
+ <maintainer>
+ <foaf:Person>
+ <foaf:name>Simon Budig</foaf:name>
+ <foaf:mbox rdf:resource="mailto:simon budig de" />
+ <gnome:userid>simon</gnome:userid>
+ </foaf:Person>
+ </maintainer>
+</Project>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]