diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-04-18 03:38:27 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-04-18 03:38:27 +0800 |
commit | 822505f93b2211eb209c7644156858b7bc83ef50 (patch) | |
tree | 1774e96e25912dc7e16296370e4b96bb3c9652ba /widgets/misc | |
parent | ea772d632da26ac497b11463ae2a870ecabfbb67 (diff) | |
download | gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar.gz gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar.bz2 gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar.lz gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar.xz gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.tar.zst gsoc2013-evolution-822505f93b2211eb209c7644156858b7bc83ef50.zip |
If there is a grabbed_item, send all events to it.
2002-04-17 Christopher James Lahey <clahey@ximian.com>
* gal/widgets/e-canvas.c (emit_event): If there is a grabbed_item,
send all events to it.
svn path=/trunk/; revision=16492
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/e-canvas.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 50443a4364..594591f011 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -51,6 +51,8 @@ static int emit_event (GnomeCanvas *canvas, GdkEvent *event); static GnomeCanvasClass *parent_class = NULL; +#define d(x) + enum { REFLOW, LAST_SIGNAL @@ -163,17 +165,6 @@ e_canvas_new () } -/* Returns whether the item is an inferior of or is equal to the parent. */ -static int -is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) -{ - for (; item; item = item->parent) - if (item == parent) - return TRUE; - - return FALSE; -} - /* Emits an event for an item in the canvas, be it the current item, grabbed * item, or focused item, as appropriate. */ @@ -186,10 +177,18 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) GnomeCanvasItem *parent; guint mask; - /* Perform checks for grabbed items */ + /* Choose where we send the event */ - if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) - return FALSE; + item = canvas->current_item; + + if (canvas->focused_item + && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) + item = canvas->focused_item; + + if (canvas->grabbed_item) + item = canvas->grabbed_item; + + /* Perform checks for grabbed items */ if (canvas->grabbed_item) { switch (event->type) { @@ -260,14 +259,6 @@ emit_event (GnomeCanvas *canvas, GdkEvent *event) break; } - /* Choose where we send the event */ - - item = canvas->current_item; - - if (canvas->focused_item - && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) - item = canvas->focused_item; - /* The event is propagated up the hierarchy (for if someone connected to * a group instead of a leaf event), and emission is stopped if a * handler returns TRUE, just like for GtkWidget events. @@ -368,6 +359,7 @@ pick_current_item (GnomeCanvas *canvas, GdkEvent *event) | GDK_BUTTON3_MASK | GDK_BUTTON4_MASK | GDK_BUTTON5_MASK); + d(g_print ("%s:%d: button_down = %s\n", __FUNCTION__, __LINE__, button_down ? "TRUE" : "FALSE")); if (!button_down) canvas->left_grabbed_item = FALSE; @@ -506,6 +498,12 @@ e_canvas_button (GtkWidget *widget, GdkEventButton *event) canvas = GNOME_CANVAS (widget); + d(g_print ("button %d, event type %d, grabbed=%p, current=%p\n", + event->button, + event->type, + canvas->grabbed_item, + canvas->current_item)); + /* dispatch normally regardless of the event's window if an item has has a pointer grab in effect */ if (!canvas->grabbed_item && event->window != canvas->layout.bin_window) |