diff options
author | Thomas White <taw@bitwiz.org.uk> | 2011-10-13 23:45:18 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2011-10-13 23:45:18 +0200 |
commit | f663680514da83368464df0020d9c2e04ef770c8 (patch) | |
tree | bd93db3eb900665e6a07c1edb1e4186798f62c18 /src/mainwindow.c | |
parent | 2e0f09d78f28c576d9a10dfcd1eeaae81e3baa07 (diff) |
Check object type before asking the tool to do things
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r-- | src/mainwindow.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c index d02268f..7301fe3 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -382,7 +382,11 @@ static gint set_tool_sig(GtkWidget *widget, GtkRadioAction *action, } if ( p->editing_object != NULL ) { - p->cur_tool->select(p->editing_object, p->cur_tool); + if ( p->cur_tool->valid_object(p->editing_object) ) { + p->cur_tool->select(p->editing_object, p->cur_tool); + } else { + p->editing_object = NULL; + } } gdk_window_invalidate_rect(p->drawingarea->window, NULL, FALSE); @@ -645,12 +649,16 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, p->editing_object = NULL; } - p->editing_object = clicked; p->drag_status = DRAG_STATUS_NONE; p->drag_reason = DRAG_REASON_NONE; - p->cur_tool->click_select(p, p->cur_tool, x, y, event, - &p->drag_status, - &p->drag_reason); + + if ( p->cur_tool->valid_object(clicked) ) { + p->editing_object = clicked; + p->cur_tool->click_select(p, p->cur_tool, x, y, event, + &p->drag_status, + &p->drag_reason); + } + } gtk_widget_grab_focus(GTK_WIDGET(da)); |