summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-10 05:21:00 +0000
committerDavid Robillard <d@drobilla.net>2011-12-10 05:21:00 +0000
commita7a3bce6d878c1150946a99f85bc58fc4fcd6256 (patch)
treec57547203382a68a043911cf917e303b69955277 /src
parent985d9b8babb2faac0de62cb684fc14c7910e9909 (diff)
downloadganv-a7a3bce6d878c1150946a99f85bc58fc4fcd6256.tar.gz
ganv-a7a3bce6d878c1150946a99f85bc58fc4fcd6256.tar.bz2
ganv-a7a3bce6d878c1150946a99f85bc58fc4fcd6256.zip
Fix event handling.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3852 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Canvas.cpp2
-rw-r--r--src/node.c43
-rw-r--r--src/port.c9
3 files changed, 24 insertions, 30 deletions
diff --git a/src/Canvas.cpp b/src/Canvas.cpp
index 9de1a43..ca7a9ad 100644
--- a/src/Canvas.cpp
+++ b/src/Canvas.cpp
@@ -1366,7 +1366,7 @@ Canvas::Canvas(double width, double height)
{
g_object_set_qdata(G_OBJECT(impl()->_gcanvas), wrapper_key(), this);
- g_signal_connect_after(gobj(), "event",
+ g_signal_connect_after(impl()->root(), "event",
G_CALLBACK(on_event_after), this);
g_signal_connect(gobj(), "connect",
G_CALLBACK(on_connect), this);
diff --git a/src/node.c b/src/node.c
index 843fb27..6092924 100644
--- a/src/node.c
+++ b/src/node.c
@@ -45,12 +45,6 @@ enum {
PROP_DRAGGABLE
};
-static gboolean
-on_event(GanvNode* node, GdkEvent* event)
-{
- return GANV_NODE_GET_CLASS(node)->on_event(node, event);
-}
-
static void
ganv_node_init(GanvNode* node)
{
@@ -71,9 +65,6 @@ ganv_node_init(GanvNode* node)
impl->selected = FALSE;
impl->highlighted = FALSE;
impl->draggable = FALSE;
-
- g_signal_connect(G_OBJECT(node),
- "event", G_CALLBACK(on_event), node);
}
static void
@@ -120,9 +111,9 @@ ganv_node_set_property(GObject* object,
g_return_if_fail(object != NULL);
g_return_if_fail(GANV_IS_NODE(object));
- GanvNode* node = GANV_NODE(object);
- GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
+ GanvNode* node = GANV_NODE(object);
+ GanvNodeImpl* impl = node->impl;
+ GanvItem* item = GANV_ITEM(object);
switch (prop_id) {
SET_CASE(PARTNER, object, impl->partner);
@@ -164,9 +155,9 @@ ganv_node_get_property(GObject* object,
g_return_if_fail(object != NULL);
g_return_if_fail(GANV_IS_NODE(object));
- GanvNode* node = GANV_NODE(object);
- GanvNodeImpl* impl = node->impl;
- GanvItem* item = GANV_ITEM(object);
+ GanvNode* node = GANV_NODE(object);
+ GanvNodeImpl* impl = node->impl;
+ GanvItem* item = GANV_ITEM(object);
typedef char* gstring;
@@ -329,9 +320,10 @@ ganv_node_default_move_to(GanvNode* node,
}
static gboolean
-ganv_node_default_on_event(GanvNode* node,
- GdkEvent* event)
+ganv_node_default_event(GanvItem* item,
+ GdkEvent* event)
{
+ GanvNode* node = GANV_NODE(item);
GanvCanvas* canvas = GANV_CANVAS(GANV_ITEM(node)->canvas);
// FIXME: put these somewhere better
@@ -580,15 +572,16 @@ ganv_node_class_init(GanvNodeClass* class)
object_class->destroy = ganv_node_destroy;
item_class->realize = ganv_node_realize;
-
- class->disconnect = ganv_node_default_disconnect;
- class->move = ganv_node_default_move;
- class->move_to = ganv_node_default_move_to;
- class->tick = ganv_node_default_tick;
- class->tail_vector = ganv_node_default_tail_vector;
- class->head_vector = ganv_node_default_head_vector;
- class->on_event = ganv_node_default_on_event;
+ item_class->event = ganv_node_default_event;
+
+ class->disconnect = ganv_node_default_disconnect;
+ class->move = ganv_node_default_move;
+ class->move_to = ganv_node_default_move_to;
+ class->tick = ganv_node_default_tick;
+ class->tail_vector = ganv_node_default_tail_vector;
+ class->head_vector = ganv_node_default_head_vector;
}
+
gboolean
ganv_node_can_tail(const GanvNode* self)
{
diff --git a/src/port.c b/src/port.c
index f7d41ac..b804617 100644
--- a/src/port.c
+++ b/src/port.c
@@ -203,12 +203,11 @@ ganv_port_set_height(GanvBox* box,
}
static gboolean
-on_event(GanvNode* node, GdkEvent* event)
+event(GanvItem* item, GdkEvent* event)
{
- GanvItem* item = GANV_ITEM(node);
GanvCanvas* canvas = GANV_CANVAS(item->canvas);
- return ganv_canvas_port_event(canvas, GANV_PORT(node), event);
+ return ganv_canvas_port_event(canvas, GANV_PORT(item), event);
}
static void
@@ -216,6 +215,7 @@ ganv_port_class_init(GanvPortClass* class)
{
GObjectClass* gobject_class = (GObjectClass*)class;
GtkObjectClass* object_class = (GtkObjectClass*)class;
+ GanvItemClass* item_class = (GanvItemClass*)class;
GanvNodeClass* node_class = (GanvNodeClass*)class;
GanvBoxClass* box_class = (GanvBoxClass*)class;
@@ -236,7 +236,8 @@ ganv_port_class_init(GanvPortClass* class)
object_class->destroy = ganv_port_destroy;
- node_class->on_event = on_event;
+ item_class->event = event;
+
node_class->tail_vector = ganv_port_tail_vector;
node_class->head_vector = ganv_port_head_vector;
node_class->resize = ganv_port_resize;