summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-31 16:31:27 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-03-31 16:33:19 +0200
commit969f9a2be5e7c8abfb362d89fedb6b1f3e768155 (patch)
tree4065b0a32df31e9c46a364044a36f1778ba6fd61
parent0f67d5d7893f2b3c61c1ae113bb5d763a6aab476 (diff)
downloadcv-969f9a2be5e7c8abfb362d89fedb6b1f3e768155.tar.gz
cv-969f9a2be5e7c8abfb362d89fedb6b1f3e768155.tar.bz2
cv-969f9a2be5e7c8abfb362d89fedb6b1f3e768155.zip
roi: Use GDK_BUTTON_PRIMARY in button_release
-rw-r--r--roi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/roi.c b/roi.c
index d278502..173832c 100644
--- a/roi.c
+++ b/roi.c
@@ -5,6 +5,11 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
+/* Only available as of GTK 3.4 */
+#ifndef GDK_BUTTON_PRIMARY
+#define GDK_BUTTON_PRIMARY 1
+#endif
+
struct roi {
GtkWidget *window;
GtkWidget *drawing_area;
@@ -122,9 +127,6 @@ button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer userdata)
struct roi *roi = userdata;
switch (event->button) {
-#ifndef GDK_BUTTON_PRIMARY
-#define GDK_BUTTON_PRIMARY 1
-#endif
case GDK_BUTTON_PRIMARY:
roi->rubberband.x1 = event->x;
roi->rubberband.x2 = event->x;
@@ -154,7 +156,7 @@ button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer userdata
{
struct roi *roi = userdata;
- if (event->button != 1)
+ if (event->button != GDK_BUTTON_PRIMARY)
return TRUE;
calc_rubberband_rect(roi, &roi->area.x, &roi->area.y,