From 8204a9ca167232e9b09d32db8cfae784c6625af2 Mon Sep 17 00:00:00 2001 From: Nathan Schulte Date: Thu, 5 Jan 2012 12:49:50 -0600 Subject: [PATCH] gschem: Fix bug with inverted (control key) selection. Fixes a regression caused by commit 7f88749446b61493e881ad6aeb0a82f909a8c0d7. The previous commit made it so that making a selection with the control key pressed no longer inverts the selection state of the objects selected, but instead starts a new selection. --- gschem/src/x_event.c | 25 +++++++------------------ 1 files changed, 7 insertions(+), 18 deletions(-) diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c index 54b5a71..1932e02 100644 --- a/gschem/src/x_event.c +++ b/gschem/src/x_event.c @@ -731,7 +731,6 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event, int w_x, w_y; int unsnapped_wx, unsnapped_wy; int skip_event=0; - int do_move; GdkEvent *test_event; g_return_val_if_fail ((w_current != NULL), 0); @@ -809,24 +808,14 @@ gint x_event_motion(GtkWidget *widget, GdkEventMotion *event, break; case(STARTSELECT): - /* Don't move anything if the shift key is pressed, that means - * the user definately wants to drag out a selection box. + /* If the shift or control keys are pressed, that means the user definately wants to drag out a + * selection box. Otherwise, if there is not a selected object under the cursor, look for one + * that could be selected and start moving it. */ - do_move = 0; - if (!w_current->SHIFTKEY) { - /* If there is a selected object under the cursor, start moving it. - * If we don't find anything selected, look for an object we could - * select to start moving it. - */ - if (o_find_selected_object (w_current, w_current->first_wx, w_current->first_wy) || - (o_find_object (w_current, - w_current->first_wx, w_current->first_wy, TRUE) && - o_select_selected (w_current))) - do_move = 1; - } - - if (!do_move) { - /* Drag out a selection box */ + if (w_current->SHIFTKEY || w_current->CONTROLKEY + || (!o_find_selected_object(w_current, w_current->first_wx, w_current->first_wy) + && (!o_find_object(w_current, w_current->first_wx, w_current->first_wy, TRUE) + || !o_select_selected(w_current)))) { if (o_select_box_start(w_current, unsnapped_wx, unsnapped_wy)) { w_current->event_state = SBOX; w_current->inside_action = 1; -- 1.7.2.5