summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-04-08 04:42:33 +0000
committerDavid Robillard <d@drobilla.net>2014-04-08 04:42:33 +0000
commit07bf185d1641f1611667bd52eb1cc4efde1c49e9 (patch)
tree0ddf9bc8cb39395c94034b160ff190581a39fc0f /src
parent2f2a44f916e44d7051ad55a98bcc2401d7a14faf (diff)
downloadganv-07bf185d1641f1611667bd52eb1cc4efde1c49e9.tar.gz
ganv-07bf185d1641f1611667bd52eb1cc4efde1c49e9.tar.bz2
ganv-07bf185d1641f1611667bd52eb1cc4efde1c49e9.zip
Fix input port selection (regression in previous commit).
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5364 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9858713..8d0358d 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -322,6 +322,7 @@ struct GanvCanvasImpl {
bool port_event(GdkEvent* event, GanvPort* port);
void ports_joined(GanvPort* port1, GanvPort* port2);
+ void port_clicked(GdkEvent* event, GanvPort* port);
void move_contents_to_internal(double x, double y, double min_x, double min_y);
@@ -1507,13 +1508,7 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
ports_joined(port, _connect_port);
unselect_ports();
} else {
- bool modded = event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK);
- if (!modded && _last_selected_port && _last_selected_port->impl->is_input != port->impl->is_input) {
- selection_joined_with(port);
- unselect_ports();
- } else {
- select_port_toggle(port, event->button.state);
- }
+ port_clicked(event, port);
}
port_dragging = false;
} else if (control_dragging) {
@@ -1523,11 +1518,8 @@ GanvCanvasImpl::port_event(GdkEvent* event, GanvPort* port)
event->button.y_root == control_start_y) {
select_port_toggle(port, event->button.state);
}
- } else if (_selected_ports.empty() ||
- (event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK))) {
- select_port_toggle(port, event->button.state);
} else {
- selection_joined_with(port);
+ port_clicked(event, port);
}
return true;
@@ -1597,6 +1589,19 @@ GanvCanvasImpl::ports_joined(GanvPort* port1, GanvPort* port2)
}
}
+void
+GanvCanvasImpl::port_clicked(GdkEvent* event, GanvPort* port)
+{
+ const bool modded = event->button.state & (GDK_SHIFT_MASK|GDK_CONTROL_MASK);
+ if (!modded && _last_selected_port &&
+ _last_selected_port->impl->is_input != port->impl->is_input) {
+ selection_joined_with(port);
+ unselect_ports();
+ } else {
+ select_port_toggle(port, event->button.state);
+ }
+}
+
/** Update animated "rubber band" selection effect. */
gboolean
GanvCanvasImpl::on_animate_timeout(gpointer data)