Code

more unreffing temporary styles properly
[inkscape.git] / src / select-context.cpp
index 1e251244bb906ed4f52b89255bf2a68a82892971..089da65b840ea94824cc0d678a2829972c5469c1 100644 (file)
@@ -322,6 +322,10 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
                     sp_canvas_force_full_redraw_after_interruptions(desktop->canvas, 5);
                     
                     // remember the clicked item in sc->item:
+                    if (sc->item) {
+                        sp_object_unref(sc->item, NULL);
+                        sc->item = NULL;
+                    }
                     sc->item = sp_event_context_find_item (desktop,
                                               NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, FALSE);
                     sp_object_ref(sc->item, NULL);
@@ -601,7 +605,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                     } else { // it was just a click, or a too small rubberband
                         r->stop();
                         if (sc->button_press_shift && !rb_escaped && !drag_escaped) {
-                            // this was a shift-click, select what was clicked upon
+                            // this was a shift+click or alt+shift+click, select what was clicked upon
 
                             sc->button_press_shift = false;
 
@@ -621,12 +625,13 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                                 item = NULL;
                             }
 
-                        } else if (sc->button_press_ctrl && !rb_escaped && !drag_escaped) { // ctrl-click
-
-                            sc->button_press_ctrl = FALSE;
+                        } else if ((sc->button_press_ctrl || sc->button_press_alt) && !rb_escaped && !drag_escaped) { // ctrl+click, alt+click
 
                             item = sp_event_context_find_item (desktop,
-                                         NR::Point(event->button.x, event->button.y), event->button.state & GDK_MOD1_MASK, TRUE);
+                                         NR::Point(event->button.x, event->button.y), sc->button_press_alt, sc->button_press_ctrl);
+
+                            sc->button_press_ctrl = FALSE;
+                            sc->button_press_alt = FALSE;
 
                             if (item) {
                                 if (selection->includes(item)) {
@@ -656,6 +661,9 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 
                 desktop->updateNow();
             }
+            if (event->button.button == 1) {
+                Inkscape::Rubberband::get()->stop(); // might have been started in another tool!
+            }
             sc->button_press_shift = false;
             sc->button_press_ctrl = false;
             sc->button_press_alt = false;