Code

due to the order of processing events, we must disable lmb handling in children conte...
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 29 Jul 2007 19:18:19 +0000 (19:18 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 29 Jul 2007 19:18:19 +0000 (19:18 +0000)
17 files changed:
src/arc-context.cpp
src/box3d-context.cpp
src/connector-context.cpp
src/dropper-context.cpp
src/dyna-draw-context.cpp
src/flood-context.cpp
src/gradient-context.cpp
src/knot.cpp
src/node-context.cpp
src/pen-context.cpp
src/pencil-context.cpp
src/rect-context.cpp
src/select-context.cpp
src/spiral-context.cpp
src/star-context.cpp
src/text-context.cpp
src/zoom-context.cpp

index 716c547ddb5b7d1e6d2f0427d145bbbb697a4274..ef77ce78fa322f87b3718d275b16e7ef6b52c393 100644 (file)
@@ -227,7 +227,7 @@ static gint sp_arc_context_item_handler(SPEventContext *event_context, SPItem *i
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 Inkscape::setup_for_drag_start(desktop, event_context, event);
                 ret = TRUE;
             }
@@ -258,7 +258,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 dragging = true;
                 ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
@@ -274,7 +274,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
             }
             break;
         case GDK_MOTION_NOTIFY:
-            if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
+            if (dragging && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning) {
 
                 if ( event_context->within_tolerance
                      && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -299,7 +299,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
             break;
         case GDK_BUTTON_RELEASE:
             event_context->xp = event_context->yp = 0;
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 dragging = false;
                 if (!event_context->within_tolerance) {
                     // we've been dragging, finish the arc
index 4358d56dd560d25b71c1c9ffea7e38e41094bc01..d5d367d818b1e75473a8105d49ed182741e938e1 100644 (file)
@@ -270,7 +270,7 @@ static gint sp_3dbox_context_item_handler(SPEventContext *event_context, SPItem
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1 && !event_context->space_panning) {
             Inkscape::setup_for_drag_start(desktop, event_context, event);
             ret = TRUE;
         }
@@ -301,7 +301,7 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
     gint ret = FALSE;
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1  && !event_context->space_panning) {
             NR::Point const button_w(event->button.x,
                                      event->button.y);
 
@@ -337,7 +337,7 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
         break;
     case GDK_MOTION_NOTIFY:
         if ( dragging
-             && ( event->motion.state & GDK_BUTTON1_MASK ) )
+             && ( event->motion.state & GDK_BUTTON1_MASK )  && !event_context->space_panning)
         {
             if ( event_context->within_tolerance
                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -395,7 +395,7 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
         break;
     case GDK_BUTTON_RELEASE:
         event_context->xp = event_context->yp = 0;
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1  && !event_context->space_panning) {
             dragging = false;
 
             if (!event_context->within_tolerance) {
index 195272fa2d5219bd85284e57335f666d4566bf62..7e8058eee5c986744049567d97b91360ffabe2ea 100644 (file)
@@ -388,19 +388,19 @@ conn_pt_handle_test(SPConnectorContext *cc, NR::Point& p)
 
 
 static gint
-sp_connector_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
+sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
 {
     gint ret = FALSE;
 
-    SPDesktop *desktop = ec->desktop;
+    SPDesktop *desktop = event_context->desktop;
 
-    SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(ec);
+    SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(event_context);
 
     NR::Point p(event->button.x, event->button.y);
 
     switch (event->type) {
         case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 if ((cc->state == SP_CONNECTOR_CONTEXT_DRAGGING) &&
                         (connector_within_tolerance))
                 {
@@ -489,9 +489,10 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
     NR::Point const event_w(bevent.x, bevent.y);
     /* Find desktop coordinates */
     NR::Point p = cc->desktop->w2d(event_w);
+    SPEventContext *event_context = SP_EVENT_CONTEXT(cc);
 
     gint ret = FALSE;
-    if ( bevent.button == 1 ) {
+    if ( bevent.button == 1 && !event_context->space_panning ) {
 
         SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
 
@@ -586,8 +587,9 @@ static gint
 connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion const &mevent)
 {
     gint ret = FALSE;
+    SPEventContext *event_context = SP_EVENT_CONTEXT(cc);
 
-    if (mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
+    if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
         // allow middle-button scrolling
         return FALSE;
     }
@@ -665,7 +667,8 @@ static gint
 connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton const &revent)
 {
     gint ret = FALSE;
-    if ( revent.button == 1 ) {
+    SPEventContext *event_context = SP_EVENT_CONTEXT(cc);
+    if ( revent.button == 1 && !event_context->space_panning ) {
 
         SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
         SPDocument *doc = sp_desktop_document(desktop);
index 6049c5d36460a4d122913ee9ababcfb0bd2abdf5..b986569aedb0126a6f75e00927d6ca70c48eaf09 100644 (file)
@@ -217,17 +217,18 @@ void sp_dropper_c32_color_copy_hex(guint32 c32)
 }
 
 
-static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
+static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEvent *event)
 {
-    SPDropperContext *dc = (SPDropperContext *) ec;
+    SPDropperContext *dc = (SPDropperContext *) event_context;
     int ret = FALSE;
+    SPDesktop *desktop = event_context->desktop;
 
     int pick = prefs_get_int_attribute("tools.dropper", "pick", SP_DROPPER_PICK_VISIBLE);
     int setalpha = prefs_get_int_attribute("tools.dropper", "setalpha", 1);
 
     switch (event->type) {
        case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 dc->centre = NR::Point(event->button.x, event->button.y);
                 dc->dragging = TRUE;
                 ret = TRUE;
@@ -238,7 +239,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                 // pass on middle-drag
                 ret = FALSE;
                 break;
-            } else {
+            } else if (!event_context->space_panning) {
                 // otherwise, constantly calculate color no matter is any button pressed or not
 
                 double rw = 0.0;
@@ -254,8 +255,8 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                         break;
                     }
 
-                    NR::Point const cd = ec->desktop->w2d(dc->centre);
-                    NR::Matrix const w2dt = ec->desktop->w2d();
+                    NR::Point const cd = desktop->w2d(dc->centre);
+                    NR::Matrix const w2dt = desktop->w2d();
                     const double scale = rw * NR_MATRIX_DF_EXPANSION(&w2dt);
                     NR::Matrix const sm( NR::scale(scale, scale) * NR::translate(cd) );
                     sp_canvas_item_affine_absolute(dc->area, sm);
@@ -271,7 +272,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                         NRPixBlock pb;
                         nr_pixblock_setup_fast(&pb, NR_PIXBLOCK_MODE_R8G8B8A8P, x0, y0, x1, y1, TRUE);
                         /* fixme: (Lauris) */
-                        sp_canvas_arena_render_pixblock(SP_CANVAS_ARENA(sp_desktop_drawing(ec->desktop)), &pb);
+                        sp_canvas_arena_render_pixblock(SP_CANVAS_ARENA(sp_desktop_drawing(desktop)), &pb);
                         for (int y = y0; y < y1; y++) {
                             const unsigned char *s = NR_PIXBLOCK_PX(&pb) + (y - y0) * pb.rs;
                             for (int x = x0; x < x1; x++) {
@@ -305,7 +306,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                     int x = (int) floor(event->button.x);
                     int y = (int) floor(event->button.y);
                     nr_pixblock_setup_fast(&pb, NR_PIXBLOCK_MODE_R8G8B8A8P, x, y, x+1, y+1, TRUE);
-                    sp_canvas_arena_render_pixblock(SP_CANVAS_ARENA(sp_desktop_drawing(ec->desktop)), &pb);
+                    sp_canvas_arena_render_pixblock(SP_CANVAS_ARENA(sp_desktop_drawing(desktop)), &pb);
                     const unsigned char *s = NR_PIXBLOCK_PX(&pb);
 
                     R = s[0] / 255.0;
@@ -316,7 +317,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
 
                 if (pick == SP_DROPPER_PICK_VISIBLE) {
                     // compose with page color
-                    guint32 bg = sp_desktop_namedview(ec->desktop)->pagecolor;
+                    guint32 bg = sp_desktop_namedview(desktop)->pagecolor;
                     R = R + (SP_RGBA32_R_F(bg)) * (1 - A);
                     G = G + (SP_RGBA32_G_F(bg)) * (1 - A);
                     B = B + (SP_RGBA32_B_F(bg)) * (1 - A);
@@ -354,7 +355,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                 gchar *where = dc->dragging ? g_strdup_printf(_(", averaged with radius %d"), (int) rw) : g_strdup_printf(_(" under cursor"));
                 // message, to show in the statusbar
                 const gchar *message = dc->dragging ? _("<b>Release mouse</b> to set color.") : _("<b>Click</b> to set fill, <b>Shift+click</b> to set stroke; <b>drag</b> to average color in area; with <b>Alt</b> to pick inverse color; <b>Ctrl+C</b> to copy the color under mouse to clipboard");
-                ec->defaultMessageContext()->setF(
+                event_context->defaultMessageContext()->setF(
                     Inkscape::NORMAL_MESSAGE,
                     "<b>%s%s</b>%s. %s", c,
                     (pick == SP_DROPPER_PICK_VISIBLE)? "" : alpha,
@@ -368,7 +369,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
             }
             break;
        case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1)
+            if (event->button.button == 1 && !event_context->space_panning)
             {
                 sp_canvas_item_hide(dc->area);
                 dc->dragging = FALSE;
@@ -376,7 +377,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                 double alpha_to_set = setalpha? dc->alpha : 1.0;
 
                 // do the actual color setting
-                sp_desktop_set_color(ec->desktop,
+                sp_desktop_set_color(desktop,
                                      (event->button.state & GDK_MOD1_MASK)?
                                      ColorRGBA(1 - dc->R, 1 - dc->G, 1 - dc->B, alpha_to_set) : ColorRGBA(dc->R, dc->G, dc->B, alpha_to_set),
                                      false,  !(event->button.state & GDK_SHIFT_MASK));
@@ -384,8 +385,8 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                 // REJON: set aux. toolbar input to hex color!
 
 
-                if (!(sp_desktop_selection(ec->desktop)->isEmpty())) {
-                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_DROPPER, 
+                if (!(sp_desktop_selection(desktop)->isEmpty())) {
+                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER, 
                                      _("Set picked color"));
                 }
 
@@ -404,7 +405,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
                     }
                     break;
                case GDK_Escape:
-                    sp_desktop_selection(ec->desktop)->clear();
+                    sp_desktop_selection(desktop)->clear();
                default:
                     break;
             }
@@ -415,7 +416,7 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent *event)
 
     if (!ret) {
         if (((SPEventContextClass *) parent_class)->root_handler) {
-            ret = ((SPEventContextClass *) parent_class)->root_handler(ec, event);
+            ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event);
         }
     }
 
index f6f59fe6b375d5fdab3247be36dec9573905f69d..5c824bc0a5eeff4018c85af6fbb000dc0e145478 100644 (file)
@@ -796,7 +796,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if ( event->button.button == 1 ) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
 
@@ -921,7 +921,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                 }
             } 
 
-            if ( dc->is_drawing && ( event->motion.state & GDK_BUTTON1_MASK ) ) {
+            if ( dc->is_drawing && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning) {
                 dc->dragging = TRUE;
 
                 if (event->motion.state & GDK_CONTROL_MASK && dc->hatch_item) { // hatching
@@ -1091,7 +1091,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
         sp_canvas_end_forced_full_redraws(desktop->canvas);
         dc->is_drawing = false;
 
-        if ( dc->is_dilating && event->button.button == 1 ) {
+        if (dc->is_dilating && event->button.button == 1 && !event_context->space_panning) {
             if (!dc->has_dilated) {
                 // if we did not rub, do a light tap
                 dc->pressure = 0.03;
@@ -1104,7 +1104,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                          (event->button.state & GDK_SHIFT_MASK ? _("Thicken paths") : _("Thin paths")));
             ret = TRUE;
 
-        } else if ( dc->dragging && event->button.button == 1 ) {
+        } else if (dc->dragging && event->button.button == 1 && !event_context->space_panning) {
             dc->dragging = FALSE;
 
             sp_dyna_draw_apply(dc, motion_dt);
index 0b6d96f4525ab189c3c01aaa2dfd2df471c168a8..e95274a1036a80e800af458516a397b7aca082b3 100644 (file)
@@ -935,7 +935,7 @@ static gint sp_flood_context_item_handler(SPEventContext *event_context, SPItem
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if (event->button.state & GDK_CONTROL_MASK) {
+        if ((event->button.state & GDK_CONTROL_MASK) && event->button.button == 1 && !event_context->space_panning) {
             NR::Point const button_w(event->button.x,
                                     event->button.y);
             
@@ -968,7 +968,7 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if (event->button.button == 1 && !event_context->space_panning) {
             if (!(event->button.state & GDK_CONTROL_MASK)) {
                 NR::Point const button_w(event->button.x,
                                         event->button.y);
@@ -989,7 +989,7 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
         }
     case GDK_MOTION_NOTIFY:
         if ( dragging
-             && ( event->motion.state & GDK_BUTTON1_MASK ) )
+             && ( event->motion.state & GDK_BUTTON1_MASK ) && !event_context->space_panning)
         {
             if ( event_context->within_tolerance
                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -1010,7 +1010,7 @@ static gint sp_flood_context_root_handler(SPEventContext *event_context, GdkEven
         break;
 
     case GDK_BUTTON_RELEASE:
-        if ( event->button.button == 1 ) {
+        if (event->button.button == 1 && !event_context->space_panning) {
             Inkscape::Rubberband::Rubberband *r = Inkscape::Rubberband::get();
             if (r->is_started()) {
                 // set "busy" cursor
index 6798a2feb7dcd9d71a5e3b8aab442f3159e236eb..758759d6a29880d8107949a1a139ee6e228a3de5 100644 (file)
@@ -394,7 +394,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
         }
         break;
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1 && !event_context->space_panning ) {
             NR::Point const button_w(event->button.x, event->button.y);
 
             // save drag origin
@@ -420,7 +420,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
         break;
     case GDK_MOTION_NOTIFY:
         if ( dragging
-             && ( event->motion.state & GDK_BUTTON1_MASK ) )
+             && ( event->motion.state & GDK_BUTTON1_MASK ) && !event_context->space_panning )
         {
             if ( event_context->within_tolerance
                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -460,7 +460,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event)
         break;
     case GDK_BUTTON_RELEASE:
         event_context->xp = event_context->yp = 0;
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1 && !event_context->space_panning ) {
             if ( (event->button.state & GDK_CONTROL_MASK) && (event->button.state & GDK_MOD1_MASK ) ) {
                 bool over_line = false;
                 SPCtrlLine *line = NULL;
index d8b3548d772ee09642e4546b5887511a25ce9490..3cc5324d4315f90342e068747f55aaccc1bf12d3 100644 (file)
@@ -311,14 +311,14 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot)
             }
             break;
        case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
                 NR::Point const p = knot->desktop->w2d(NR::Point(event->button.x, event->button.y));
                 sp_knot_start_dragging(knot, p, (gint) event->button.x, (gint) event->button.y, event->button.time);
                 consumed = TRUE;
             }
             break;
        case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !knot->desktop->event_context->space_panning) {
                 knot->pressure = 0;
                 if (transform_escaped) {
                     transform_escaped = false;
@@ -347,7 +347,7 @@ static int sp_knot_handler(SPCanvasItem *item, GdkEvent *event, SPKnot *knot)
             }
             break;
        case GDK_MOTION_NOTIFY:
-            if (grabbed) {
+            if (grabbed && !knot->desktop->event_context->space_panning) {
                 consumed = TRUE;
 
                 if ( within_tolerance
index 352bac58465b917cb3d2166f8419e761f5109e9b..3084cdb296ba34bcfa46472a44f9bc03dbd75373 100644 (file)
@@ -199,7 +199,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
     switch (event->type) {
         case GDK_2BUTTON_PRESS:
         case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 if (!nc->drag) {
 
                     // find out clicked item, disregarding groups, honoring Alt
@@ -257,7 +257,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
             }
             break;
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1 && !(event->button.state & GDK_SHIFT_MASK)) {
+            if (event->button.button == 1 && !(event->button.state & GDK_SHIFT_MASK) && !event_context->space_panning) {
                 // save drag origin
                 event_context->xp = (gint) event->button.x;
                 event_context->yp = (gint) event->button.y;
@@ -316,7 +316,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 // save drag origin
                 event_context->xp = (gint) event->button.x;
                 event_context->yp = (gint) event->button.y;
@@ -333,7 +333,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             }
             break;
         case GDK_MOTION_NOTIFY:
-            if (event->motion.state & GDK_BUTTON1_MASK) {
+            if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
 
                 if ( event_context->within_tolerance
                      && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -413,7 +413,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             break;
         case GDK_BUTTON_RELEASE:
             event_context->xp = event_context->yp = 0;
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 NR::Maybe<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
 
index f201513c8973bb72eee63cf2374dff3a74fae67f..53ee7df6d0756822565ee9304900c8c20172dd3b 100644 (file)
@@ -369,9 +369,10 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
     SPDesktop * const desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
     NR::Point const event_w(bevent.x, bevent.y);
     NR::Point const event_dt(desktop->w2d(event_w));
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
 
     gint ret = FALSE;
-    if (bevent.button == 1) {
+    if (bevent.button == 1 && !event_context->space_panning) {
 
         if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
             return TRUE;
@@ -508,8 +509,10 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
 {
     gint ret = FALSE;
 
-    if (mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
-        // allow middle-button scrolling
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+
+    if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
+        // allow scrolling
         return FALSE;
     }
     
@@ -639,7 +642,8 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
     }
 
     gint ret = FALSE;
-    if ( revent.button == 1 ) {
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+    if ( revent.button == 1  && !event_context->space_panning) {
 
         SPDrawContext *dc = SP_DRAW_CONTEXT (pc);
 
index 5ce9a171e8faa06fd73026c329c6ea9fcde2ebe1..c32a6107a2af21891030fde6a1cd34bca5ace281 100644 (file)
@@ -197,7 +197,8 @@ static gint
 pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &bevent)
 {
     gint ret = FALSE;
-    if ( bevent.button == 1 ) {
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+    if ( bevent.button == 1  && !event_context->space_panning) {
 
         SPDrawContext *dc = SP_DRAW_CONTEXT (pc);
         SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
@@ -257,8 +258,9 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
     gint ret = FALSE;
     SPDesktop *const dt = pc->desktop;
 
-    if (mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
-        // allow middle-button scrolling
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+    if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
+        // allow scrolling
         return FALSE;
     }
 
@@ -340,7 +342,8 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
 {
     gint ret = FALSE;
 
-    if ( revent.button == 1 && pc->is_drawing) {
+    SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+    if ( revent.button == 1 && pc->is_drawing && !event_context->space_panning) {
         SPDesktop *const dt = pc->desktop;
 
         pc->is_drawing = false;
index 329f3910dcea9c0726956686e4142914e55b9017..7de7aa5072505bc6aa520e964b8b0512a704b875 100644 (file)
@@ -249,7 +249,7 @@ static gint sp_rect_context_item_handler(SPEventContext *event_context, SPItem *
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if ( event->button.button == 1 && !event_context->space_panning) {
             Inkscape::setup_for_drag_start(desktop, event_context, event);
             ret = TRUE;
         }
@@ -280,7 +280,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
     gint ret = FALSE;
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if ( event->button.button == 1 ) {
+        if (event->button.button == 1 && !event_context->space_panning) {
             NR::Point const button_w(event->button.x,
                                      event->button.y);
 
@@ -313,7 +313,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
         break;
     case GDK_MOTION_NOTIFY:
         if ( dragging
-             && ( event->motion.state & GDK_BUTTON1_MASK ) )
+             && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning)
         {
             if ( event_context->within_tolerance
                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -339,7 +339,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
         break;
     case GDK_BUTTON_RELEASE:
         event_context->xp = event_context->yp = 0;
-        if ( event->button.button == 1 ) {
+        if (event->button.button == 1 && !event_context->space_panning) {
             dragging = false;
 
             if (!event_context->within_tolerance) {
index 08cb6247a48a863d031641909a45483781a870ac..937e369591542825087469cf66e8ee10cd218cd8 100644 (file)
@@ -299,7 +299,7 @@ sp_select_context_item_handler(SPEventContext *event_context, SPItem *item, GdkE
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 /* Left mousebutton */
 
                 // save drag origin
@@ -428,7 +428,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             }
             break;
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 // save drag origin
                 xp = (gint) event->button.x;
@@ -466,7 +466,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             break;
 
         case GDK_MOTION_NOTIFY:
-            if (event->motion.state & GDK_BUTTON1_MASK) {
+            if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
                 NR::Point const motion_pt(event->motion.x, event->motion.y);
                 NR::Point const p(desktop->w2d(motion_pt));
 
@@ -543,7 +543,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             break;
         case GDK_BUTTON_RELEASE:
             xp = yp = 0;
-            if ((event->button.button == 1) && (sc->grabbed)) {
+            if ((event->button.button == 1) && (sc->grabbed) && !event_context->space_panning) {
                 if (sc->dragging) {
                     if (sc->moved) {
                         // item has been moved
index 82ae8d351982900604ba8958769e73ac186fa55f..1014665a18e42fb3bab9a1a6959b74684a9ba2b2 100644 (file)
@@ -258,7 +258,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 dragging = TRUE;
                 sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
@@ -276,7 +276,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             }
             break;
         case GDK_MOTION_NOTIFY:
-            if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
+            if (dragging && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning) {
 
                 if ( event_context->within_tolerance
                      && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -300,7 +300,7 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
             break;
         case GDK_BUTTON_RELEASE:
             event_context->xp = event_context->yp = 0;
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 dragging = FALSE;
                 if (!event_context->within_tolerance) {
                     // we've been dragging, finish the spiral
index cd33391a4d7273d742798185894520e9cebdfe9f..b9eed3b0e40a007bb693b2fcf3aba0fe9c57322b 100644 (file)
@@ -269,7 +269,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
 
     switch (event->type) {
     case GDK_BUTTON_PRESS:
-        if (event->button.button == 1) {
+        if (event->button.button == 1 && !event_context->space_panning) {
 
             dragging = TRUE;
 
@@ -286,7 +286,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
         }
         break;
     case GDK_MOTION_NOTIFY:
-        if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
+        if (dragging && (event->motion.state & GDK_BUTTON1_MASK) && !event_context->space_panning) {
 
             if ( event_context->within_tolerance
                  && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
@@ -310,7 +310,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent
         break;
     case GDK_BUTTON_RELEASE:
         event_context->xp = event_context->yp = 0;
-        if (event->button.button == 1) {
+        if (event->button.button == 1 && !event_context->space_panning) {
             dragging = FALSE;
             if (!event_context->within_tolerance) {
                 // we've been dragging, finish the star
index 0410ab3b4679a7eb830505b5d8924fc7cb562ede..8f6d6f1e379ca16f6836d404382bfde68db48a09 100644 (file)
@@ -338,10 +338,10 @@ sp_text_context_finish(SPEventContext *ec)
 
 
 static gint
-sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
+sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
 {
-    SPTextContext *tc = SP_TEXT_CONTEXT(ec);
-    SPDesktop *desktop = ec->desktop;
+    SPTextContext *tc = SP_TEXT_CONTEXT(event_context);
+    SPDesktop *desktop = event_context->desktop;
     SPItem *item_ungrouped;
 
     gint ret = FALSE;
@@ -350,14 +350,14 @@ sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 // find out clicked item, disregarding groups
                 item_ungrouped = desktop->item_at_point(NR::Point(event->button.x, event->button.y), TRUE);
                 if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) {
-                    sp_desktop_selection(ec->desktop)->set(item_ungrouped);
+                    sp_desktop_selection(desktop)->set(item_ungrouped);
                     if (tc->text) {
                         // find out click point in document coordinates
-                        NR::Point p = ec->desktop->w2d(NR::Point(event->button.x, event->button.y));
+                        NR::Point p = desktop->w2d(NR::Point(event->button.x, event->button.y));
                         // set the cursor closest to that point
                         tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
                         // update display
@@ -395,17 +395,17 @@ sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
             }
             break;
         case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1 && tc->dragging) {
+            if (event->button.button == 1 && tc->dragging && !event_context->space_panning) {
                 tc->dragging = 0;
                 ret = TRUE;
             }
             break;
         case GDK_MOTION_NOTIFY:
-            if (event->motion.state & GDK_BUTTON1_MASK && tc->dragging) {
+            if (event->motion.state & GDK_BUTTON1_MASK && tc->dragging && !event_context->space_panning) {
                 Inkscape::Text::Layout const *layout = te_get_layout(tc->text);
                 if (!layout) break;
                 // find out click point in document coordinates
-                NR::Point p = ec->desktop->w2d(NR::Point(event->button.x, event->button.y));
+                NR::Point p = desktop->w2d(NR::Point(event->button.x, event->button.y));
                 // set the cursor closest to that point
                 Inkscape::Text::Layout::iterator new_end = sp_te_get_position_by_coords(tc->text, p);
                 if (tc->dragging == 2) {
@@ -441,10 +441,10 @@ sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
                     SP_CTRLRECT(tc->indicator)->setRectangle(*ibbox);
                 }
 
-                ec->cursor_shape = cursor_text_insert_xpm;
-                ec->hot_x = 7;
-                ec->hot_y = 10;
-                sp_event_context_update_cursor(ec);
+                event_context->cursor_shape = cursor_text_insert_xpm;
+                event_context->hot_x = 7;
+                event_context->hot_y = 10;
+                sp_event_context_update_cursor(event_context);
                 sp_text_context_update_text_selection(tc);
 
                 if (SP_IS_TEXT (item_ungrouped)) {
@@ -464,7 +464,7 @@ sp_text_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
 
     if (!ret) {
         if (((SPEventContextClass *) parent_class)->item_handler)
-            ret = ((SPEventContextClass *) parent_class)->item_handler(ec, item, event);
+            ret = ((SPEventContextClass *) parent_class)->item_handler(event_context, item, event);
     }
 
     return ret;
@@ -585,32 +585,30 @@ show_curr_uni_char(SPTextContext *const tc)
 }
 
 static gint
-sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
+sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *const event)
 {
-    SPTextContext *const tc = SP_TEXT_CONTEXT(ec);
+    SPTextContext *const tc = SP_TEXT_CONTEXT(event_context);
 
-    SPDesktop *desktop = ec->desktop;
+    SPDesktop *desktop = event_context->desktop;
 
     sp_canvas_item_hide(tc->indicator);
 
     sp_text_context_validate_cursor_iterators(tc);
 
-    ec->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
+    event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
-
-                SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(ec);
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 if (Inkscape::have_viable_layer(desktop, desktop->messageStack()) == false) {
                     return TRUE;
                 }
 
                 // save drag origin
-                ec->xp = (gint) event->button.x;
-                ec->yp = (gint) event->button.y;
-                ec->within_tolerance = true;
+                event_context->xp = (gint) event->button.x;
+                event_context->yp = (gint) event->button.y;
+                event_context->within_tolerance = true;
 
                 NR::Point const button_pt(event->button.x, event->button.y);
                 tc->p0 = desktop->w2d(button_pt);
@@ -630,23 +628,23 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
             if (tc->over_text) {
                 tc->over_text = 0;
                 // update cursor and statusbar: we are not over a text object now
-                ec->cursor_shape = cursor_text_xpm;
-                ec->hot_x = 7;
-                ec->hot_y = 7;
-                sp_event_context_update_cursor(ec);
+                event_context->cursor_shape = cursor_text_xpm;
+                event_context->hot_x = 7;
+                event_context->hot_y = 7;
+                sp_event_context_update_cursor(event_context);
                 desktop->event_context->defaultMessageContext()->clear();
             }
 
-            if (tc->creating && event->motion.state & GDK_BUTTON1_MASK) {
-                if ( ec->within_tolerance
-                     && ( abs( (gint) event->motion.x - ec->xp ) < ec->tolerance )
-                     && ( abs( (gint) event->motion.y - ec->yp ) < ec->tolerance ) ) {
+            if (tc->creating && event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
+                if ( event_context->within_tolerance
+                     && ( abs( (gint) event->motion.x - event_context->xp ) < event_context->tolerance )
+                     && ( abs( (gint) event->motion.y - event_context->yp ) < event_context->tolerance ) ) {
                     break; // do not drag if we're within tolerance from origin
                 }
                 // Once the user has moved farther than tolerance from the original location
                 // (indicating they intend to draw, not click), then always process the
                 // motion notify coordinates as given (no snapping back to origin)
-                ec->within_tolerance = false;
+                event_context->within_tolerance = false;
 
                 NR::Point const motion_pt(event->motion.x, event->motion.y);
                 NR::Point const p = desktop->w2d(motion_pt);
@@ -657,14 +655,14 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                 // status text
                 GString *xs = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[NR::X]), desktop->namedview->getDefaultMetric());
                 GString *ys = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[NR::Y]), desktop->namedview->getDefaultMetric());
-                ec->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
+                event_context->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>Flowed text frame</b>: %s &#215; %s"), xs->str, ys->str);
                 g_string_free(xs, FALSE);
                 g_string_free(ys, FALSE);
 
             }
             break;
         case GDK_BUTTON_RELEASE:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
 
                 if (tc->grabbed) {
                     sp_canvas_item_ungrab(tc->grabbed, GDK_CURRENT_TIME);
@@ -673,11 +671,11 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
 
                 Inkscape::Rubberband::get()->stop();
 
-                if (tc->creating && ec->within_tolerance) {
+                if (tc->creating && event_context->within_tolerance) {
                     /* Button 1, set X & Y & new item */
                     sp_desktop_selection(desktop)->clear();
-                    NR::Point dtp = ec->desktop->w2d(NR::Point(event->button.x, event->button.y));
-                    tc->pdoc = sp_desktop_dt2root_xy_point(ec->desktop, dtp);
+                    NR::Point dtp = desktop->w2d(NR::Point(event->button.x, event->button.y));
+                    tc->pdoc = sp_desktop_dt2root_xy_point(desktop, dtp);
 
                     tc->show = TRUE;
                     tc->phase = 1;
@@ -687,26 +685,26 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                     sp_canvas_item_show(tc->cursor);
                     // Cursor height is defined by the new text object's font size; it needs to be set
                     // articifically here, for the text object does not exist yet:
-                    double cursor_height = sp_desktop_get_font_size_tool(ec->desktop);
+                    double cursor_height = sp_desktop_get_font_size_tool(desktop);
                     sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), dtp, dtp + NR::Point(0, cursor_height));
-                    ec->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync
+                    event_context->_message_context->set(Inkscape::NORMAL_MESSAGE, _("Type text; <b>Enter</b> to start new line.")); // FIXME:: this is a copy of a string from _update_cursor below, do not desync
 
-                    ec->within_tolerance = false;
+                    event_context->within_tolerance = false;
                 } else if (tc->creating) {
                     NR::Point const button_pt(event->button.x, event->button.y);
                     NR::Point p1 = desktop->w2d(button_pt);
-                    double cursor_height = sp_desktop_get_font_size_tool(ec->desktop);
+                    double cursor_height = sp_desktop_get_font_size_tool(desktop);
                     if (fabs(p1[NR::Y] - tc->p0[NR::Y]) > cursor_height) {
                         // otherwise even one line won't fit; most probably a slip of hand (even if bigger than tolerance)
                         SPItem *ft = create_flowtext_with_internal_frame (desktop, tc->p0, p1);
                         /* Set style */
-                        sp_desktop_apply_style_tool(SP_EVENT_CONTEXT_DESKTOP(ec), SP_OBJECT_REPR(ft), "tools.text", true);
+                        sp_desktop_apply_style_tool(desktop, SP_OBJECT_REPR(ft), "tools.text", true);
                         sp_desktop_selection(desktop)->set(ft);
-                        ec->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created."));
+                        desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Flowed text is created."));
                         sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                          _("Create flowed text"));
                     } else {
-                        ec->desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> for the current font size. Flowed text not created."));
+                        desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("The frame is <b>too small</b> for the current font size. Flowed text not created."));
                     }
                 }
                 tc->creating = false;
@@ -766,7 +764,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     }
                                     /* Exit unimode. */
                                     tc->unimode = false;
-                                    ec->defaultMessageContext()->clear();
+                                    event_context->defaultMessageContext()->clear();
                                     return TRUE;
                                 }
 
@@ -774,7 +772,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     // Cancel unimode.
                                     tc->unimode = false;
                                     gtk_im_context_reset(tc->imc);
-                                    ec->defaultMessageContext()->clear();
+                                    event_context->defaultMessageContext()->clear();
                                     return TRUE;
                                 }
 
@@ -832,8 +830,8 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     tc->text_sel_start = tc->text_sel_end = sp_te_replace(tc->text, tc->text_sel_start, tc->text_sel_end, "\302\240");
                                     sp_text_context_update_cursor(tc);
                                     sp_text_context_update_text_selection(tc);
-                                    ec->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space"));
-                                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                    desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("No-break space"));
+                                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                      _("Insert no-break space"));
                                     return TRUE;
                                 }
@@ -843,11 +841,11 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 if (MOD__CTRL_ONLY || (MOD__CTRL && MOD__SHIFT)) {
                                     if (tc->unimode) {
                                         tc->unimode = false;
-                                        ec->defaultMessageContext()->clear();
+                                        event_context->defaultMessageContext()->clear();
                                     } else {
                                         tc->unimode = true;
                                         tc->unipos = 0;
-                                        ec->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("Unicode (<b>Enter</b> to finish): "));
+                                        event_context->defaultMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("Unicode (<b>Enter</b> to finish): "));
                                     }
                                     if (tc->imc) {
                                         gtk_im_context_reset(tc->imc);
@@ -870,7 +868,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                         sp_repr_css_set_property(css, "font-weight", "normal");
                                     sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
                                     sp_repr_css_attr_unref(css);
-                                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                      _("Make bold"));
                                     sp_text_context_update_cursor(tc);
                                     sp_text_context_update_text_selection(tc);
@@ -888,7 +886,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                         sp_repr_css_set_property(css, "font-style", "normal");
                                     sp_te_apply_style(tc->text, tc->text_sel_start, tc->text_sel_end, css);
                                     sp_repr_css_attr_unref(css);
-                                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                      _("Make italic"));
                                     sp_text_context_update_cursor(tc);
                                     sp_text_context_update_text_selection(tc);
@@ -926,7 +924,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 
                                 sp_text_context_update_cursor(tc);
                                 sp_text_context_update_text_selection(tc);
-                                sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                  _("New line"));
                                 return TRUE;
                             }
@@ -960,7 +958,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     
                                     sp_text_context_update_cursor(tc);
                                     sp_text_context_update_text_selection(tc);
-                                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                      _("Backspace"));
                                 }
                                 return TRUE;
@@ -991,7 +989,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     
                                     sp_text_context_update_cursor(tc);
                                     sp_text_context_update_text_selection(tc);
-                                    sp_document_done(sp_desktop_document(ec->desktop), SP_VERB_CONTEXT_TEXT, 
+                                    sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, 
                                                      _("Delete"));
                                 }
                                 return TRUE;
@@ -1001,12 +999,12 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 if (tc->text) {
                                     if (MOD__ALT) {
                                         if (MOD__SHIFT)
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(-10, 0));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(-10, 0));
                                         else
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(-1, 0));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(-1, 0));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "kern:left", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "kern:left", SP_VERB_CONTEXT_TEXT, 
                                                                _("Kern to the left"));
                                     } else {
                                         cursor_movement_operator = MOD__CTRL ? &Inkscape::Text::Layout::iterator::cursorLeftWithControl
@@ -1021,12 +1019,12 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 if (tc->text) {
                                     if (MOD__ALT) {
                                         if (MOD__SHIFT)
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(10, 0));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(10, 0));
                                         else
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(1, 0));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(1, 0));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "kern:right", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "kern:right", SP_VERB_CONTEXT_TEXT, 
                                                                _("Kern to the right"));
                                     } else {
                                         cursor_movement_operator = MOD__CTRL ? &Inkscape::Text::Layout::iterator::cursorRightWithControl
@@ -1041,12 +1039,12 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 if (tc->text) {
                                     if (MOD__ALT) {
                                         if (MOD__SHIFT)
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(0, -10));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(0, -10));
                                         else
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(0, -1));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(0, -1));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "kern:up", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "kern:up", SP_VERB_CONTEXT_TEXT, 
                                                                _("Kern up"));
 
                                     } else {
@@ -1062,12 +1060,12 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                 if (tc->text) {
                                     if (MOD__ALT) {
                                         if (MOD__SHIFT)
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(0, 10));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(0, 10));
                                         else
-                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, NR::Point(0, 1));
+                                            sp_te_adjust_kerning_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, NR::Point(0, 1));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "kern:down", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "kern:down", SP_VERB_CONTEXT_TEXT, 
                                                                _("Kern down"));
 
                                     } else {
@@ -1106,7 +1104,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     }
                                     Inkscape::Rubberband::get()->stop();
                                 } else {
-                                    sp_desktop_selection(ec->desktop)->clear();
+                                    sp_desktop_selection(desktop)->clear();
                                 }
                                 tc->nascent_object = FALSE;
                                 return TRUE;
@@ -1116,14 +1114,14 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                         if (MOD__ALT) {
                                             if (MOD__SHIFT) {
                                                 // FIXME: alt+shift+[] does not work, don't know why
-                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -10);
+                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
                                             } else {
-                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -1);
+                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
                                             }
                                         } else {
-                                            sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -90);
+                                            sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -90);
                                         }
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "textrot:ccw", SP_VERB_CONTEXT_TEXT, 
                                                                _("Rotate counterclockwise"));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
@@ -1137,14 +1135,14 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                         if (MOD__ALT) {
                                             if (MOD__SHIFT) {
                                                 // FIXME: alt+shift+[] does not work, don't know why
-                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 10);
+                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
                                             } else {
-                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 1);
+                                                sp_te_adjust_rotation_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
                                             }
                                         } else {
-                                            sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 90);
+                                            sp_te_adjust_rotation(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 90);
                                         }
-                                        sp_document_maybe_done(sp_desktop_document(ec->desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, 
+                                        sp_document_maybe_done(sp_desktop_document(desktop), "textrot:cw", SP_VERB_CONTEXT_TEXT, 
                                                                 _("Rotate clockwise"));
                                         sp_text_context_update_cursor(tc);
                                         sp_text_context_update_text_selection(tc);
@@ -1158,18 +1156,18 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     if (MOD__ALT) {
                                         if (MOD__CTRL) {
                                             if (MOD__SHIFT)
-                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -10);
+                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
                                             else
-                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -1);
-                                            sp_document_maybe_done(sp_desktop_document(ec->desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, 
+                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
+                                            sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:dec", SP_VERB_CONTEXT_TEXT, 
                                                                     _("Contract line spacing"));
 
                                         } else {
                                             if (MOD__SHIFT)
-                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -10);
+                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -10);
                                             else
-                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, -1);
-                                            sp_document_maybe_done(sp_desktop_document(ec->desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, 
+                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, -1);
+                                            sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:dec", SP_VERB_CONTEXT_TEXT, 
                                                                     _("Contract letter spacing"));
 
                                         }
@@ -1185,18 +1183,18 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
                                     if (MOD__ALT) {
                                         if (MOD__CTRL) {
                                             if (MOD__SHIFT)
-                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 10);
+                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
                                             else
-                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 1);
-                                            sp_document_maybe_done(sp_desktop_document(ec->desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, 
+                                                sp_te_adjust_linespacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
+                                            sp_document_maybe_done(sp_desktop_document(desktop), "linespacing:inc", SP_VERB_CONTEXT_TEXT, 
                                                                     _("Expand line spacing"));
 
                                         } else {
                                             if (MOD__SHIFT)
-                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 10);
+                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 10);
                                             else
-                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, ec->desktop, 1);
-                                            sp_document_maybe_done(sp_desktop_document(ec->desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, 
+                                                sp_te_adjust_tspan_letterspacing_screen(tc->text, tc->text_sel_start, tc->text_sel_end, desktop, 1);
+                                            sp_document_maybe_done(sp_desktop_document(desktop), "letterspacing:inc", SP_VERB_CONTEXT_TEXT, 
                                                                     _("Expand letter spacing"));
 
                                         }
@@ -1257,7 +1255,7 @@ sp_text_context_root_handler(SPEventContext *const ec, GdkEvent *const event)
 
     // if nobody consumed it so far
     if (((SPEventContextClass *) parent_class)->root_handler) { // and there's a handler in parent context,
-        return ((SPEventContextClass *) parent_class)->root_handler(ec, event); // send event to parent
+        return ((SPEventContextClass *) parent_class)->root_handler(event_context, event); // send event to parent
     } else {
         return FALSE; // return "I did nothing" value so that global shortcuts can be activated
     }
index d2b0d684992bb2e8000256f71c32236fdd5d7ce2..4566a5ab0ed7f165858a440ef107883acbdac653 100644 (file)
@@ -124,7 +124,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
 
     switch (event->type) {
         case GDK_BUTTON_PRESS:
-            if (event->button.button == 1) {
+            if (event->button.button == 1 && !event_context->space_panning) {
                 // save drag origin
                 xp = (gint) event->button.x;
                 yp = (gint) event->button.y;
@@ -141,7 +141,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
             break;
 
        case GDK_MOTION_NOTIFY:
-            if (event->motion.state & GDK_BUTTON1_MASK) {
+            if (event->motion.state & GDK_BUTTON1_MASK && !event_context->space_panning) {
                 ret = TRUE;
 
                 if ( within_tolerance
@@ -161,7 +161,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent
             break;
 
        case GDK_BUTTON_RELEASE:
-            if ( event->button.button == 1 ) {
+            if ( event->button.button == 1  && !event_context->space_panning) {
                 NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
                 if (b && !within_tolerance) {
                     desktop->set_display_area(*b, 10);