summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-23 12:56:22 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-23 12:58:26 -0300
commit16acfc20c25de008e00d5aa1b70dc5fce823ef81 (patch)
treec9e1d0189af2523e66f87272663ba8c6d552efa4 /gui
parent7ce6d6f0667e61368f550c8f999d76545cbe803a (diff)
downloadeeshow-16acfc20c25de008e00d5aa1b70dc5fce823ef81.tar.gz
eeshow-16acfc20c25de008e00d5aa1b70dc5fce823ef81.tar.bz2
eeshow-16acfc20c25de008e00d5aa1b70dc5fce823ef81.zip
eeshow/gui/input.c: left and middle mouse button are equivalent
This makes it easy to switch between eeshow and eeschema, where only the middle mouse button is used for dragging.
Diffstat (limited to 'gui')
-rw-r--r--gui/input.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gui/input.c b/gui/input.c
index 64644af..b8d388f 100644
--- a/gui/input.c
+++ b/gui/input.c
@@ -41,6 +41,7 @@ static struct input {
struct input *next;
} *sp = NULL;
+static int buttons = 0;
static int curr_x, curr_y; /* last mouse position */
static double clicked_x, clicked_y; /* button down position */
@@ -218,11 +219,13 @@ static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event,
static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
- if (event->button != 1)
+ if (event->button > 2)
return TRUE;
progress(3, "press %s", state());
+ buttons |= 1 << event->button;
+
switch (sp->state) {
case input_idle:
sp->state = input_clicking;
@@ -253,11 +256,15 @@ static gboolean button_release_event(GtkWidget *widget, GdkEventButton *event,
{
const struct input *old_sp = sp;
- if (event->button != 1)
+ if (event->button > 2)
return TRUE;
progress(3, "release %s", state());
+ buttons &= ~(1 << event->button);
+ if (buttons)
+ return TRUE;
+
switch (sp->state) {
case input_idle:
/* hover_click changed the input configuration */