summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6b956cc)
raw | patch | inline | side by side (parent: 6b956cc)
author | mjwybrow <mjwybrow@users.sourceforge.net> | |
Tue, 14 Feb 2006 23:16:36 +0000 (23:16 +0000) | ||
committer | mjwybrow <mjwybrow@users.sourceforge.net> | |
Tue, 14 Feb 2006 23:16:36 +0000 (23:16 +0000) |
Revert a previous change that generated enter events for canvas items
other than the current one when mouse buttons were depressed. These
events are now only generated in the connector context, where they are
required.
other than the current one when mouse buttons were depressed. These
events are now only generated in the connector context, where they are
required.
ChangeLog | patch | blob | history | |
src/connector-context.cpp | patch | blob | history | |
src/display/sp-canvas.cpp | patch | blob | history | |
src/display/sp-canvas.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index c5ff0b589f65596630a1f1ac0e3b3a3220738f83..0e596f050919f7b3648099d734b114145a4b14aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-02-14 Michael Wybrow <mjwybrow@users.sourceforge.net>
+
+ * src/display/sp-canvas.cpp, display/sp-canvas.h, connector-context.cpp:
+
+ Revert a previous change that generated enter events for canvas items
+ other than the current one when mouse buttons were depressed. These
+ events are now only generated in the connector context, where they are
+ required.
+
2006-02-13 Michael Wybrow <mjwybrow@users.sourceforge.net>
* src/graphlayout/graphlayout.cpp, src/conn-avoid-ref.cpp,
index cceea8267272a4887eb0933b054bd159f65d5335..93db0f844aea4b8d5d857370438943ffd34bbcab 100644 (file)
if (prefs_get_int_attribute("tools.connector", "selcue", 0) != 0) {
ec->enableSelectionCue();
}
+
+ // Make sure we see all enter events for canvas items,
+ // even if a mouse button is depressed.
+ dt->canvas->gen_all_enter_events = true;
}
}
cc_clear_active_shape(cc);
cc_clear_active_conn(cc);
+
+ // Restore the default event generating behaviour.
+ SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(ec);
+ desktop->canvas->gen_all_enter_events = false;
}
index 1c1171d35c0c474626f28ac626aada592f0ab71c..b1ed7d3d23fd81537decc9e9656e17bd03b97116 100644 (file)
canvas->need_repick = TRUE;
+ // See comment at in sp-canvas.h.
+ canvas->gen_all_enter_events = false;
+
canvas->tiles=NULL;
canvas->tLeft=canvas->tTop=canvas->tRight=canvas->tBottom=0;
canvas->tileH=canvas->tileV=0;
static int
pick_current_item (SPCanvas *canvas, GdkEvent *event)
{
+ int button_down;
double x, y;
int retval = FALSE;
+ if (canvas->gen_all_enter_events == false) {
+ // If a button is down, we'll perform enter and leave events on the
+ // current item, but not enter on any other item. This is more or
+ // less like X pointer grabbing for canvas items.
+ //
+ button_down = canvas->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
+ GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK);
+
+ if (!button_down) canvas->left_grabbed_item = FALSE;
+ }
+
/* Save the event in the canvas. This is used to synthesize enter and
* leave events in case the current item changes. It is also used to
* re-pick the current item if the current one gets deleted. Also,
canvas->in_repick = FALSE;
}
+ if (canvas->gen_all_enter_events == false) {
+ // new_current_item may have been set to NULL during the call to
+ // emit_event() above
+ if ((canvas->new_current_item != canvas->current_item) && button_down) {
+ canvas->left_grabbed_item = TRUE;
+ return retval;
+ }
+ }
+
/* Handle the rest of cases */
canvas->left_grabbed_item = FALSE;
index a9bf2e4c35fe7bb0aceca27622aea3905cbff099..86522870a19cc321b118fdaeb009cf8bb7697a6d 100644 (file)
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
/* For use by internal pick_current_item() function */
unsigned int in_repick : 1;
+ // In most tools Inkscape only generates enter and leave events
+ // on the current item, but no other enter events if a mouse button
+ // is depressed -- see function pick_current_item(). Some tools
+ // may wish the canvas to generate to all enter events, (e.g., the
+ // connector tool). If so, they may temporarily set this flag to
+ // 'true'.
+ bool gen_all_enter_events;
+
int rendermode;
NR::Rect getViewbox() const;