aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-canvas.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-05-10 06:12:01 +0800
committerChris Lahey <clahey@src.gnome.org>2002-05-10 06:12:01 +0800
commit57a877702667674f5ddb845c1c7d4378866c391c (patch)
treeb13644c59f3ea9743bc7dda63944b27d45192356 /widgets/misc/e-canvas.c
parentc670e9d15bdaf3c99a42191e48fa315b80800c69 (diff)
downloadgsoc2013-evolution-57a877702667674f5ddb845c1c7d4378866c391c.tar.gz
gsoc2013-evolution-57a877702667674f5ddb845c1c7d4378866c391c.tar.zst
gsoc2013-evolution-57a877702667674f5ddb845c1c7d4378866c391c.zip
Switch from gnome_canvas_item_grab to e_canvas_item_grab.
2002-05-09 Christopher James Lahey <clahey@ximian.com> * gal/e-text/e-text.c: Switch from gnome_canvas_item_grab to e_canvas_item_grab. * gal/widgets/e-canvas.c, gal/widgets/e-canvas.h (e_canvas_item_grab, e_canvas_item_ungrab): Added these functions. From gal/e-table/ChangeLog: 2002-05-09 Christopher James Lahey <clahey@ximian.com> * e-table-item.c, e-table-item.h: Switched from gnome_canvas_item_grab to e_canvas_item_grab. svn path=/trunk/; revision=16738
Diffstat (limited to 'widgets/misc/e-canvas.c')
-rw-r--r--widgets/misc/e-canvas.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index 378bc31e56..e5b0b78bcd 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -24,6 +24,8 @@
#include <gtk/gtksignal.h>
#include "e-canvas.h"
#include "gal/util/e-util.h"
+#include <X11/Xlib.h>
+#include <gtk/gtkmain.h>
static void e_canvas_init (ECanvas *card);
static void e_canvas_destroy (GtkObject *object);
@@ -1082,3 +1084,69 @@ void e_canvas_hide_tooltip (ECanvas *canvas)
canvas->tooltip_window = NULL;
}
}
+
+
+static gboolean
+grab_cancelled_check (gpointer data)
+{
+ ECanvas *canvas = data;
+
+ if (gtk_grab_get_current ()) {
+ gnome_canvas_item_ungrab(GNOME_CANVAS (canvas)->grabbed_item, canvas->grab_cancelled_time);
+ if (canvas->grab_cancelled_cb) {
+ canvas->grab_cancelled_cb (canvas,
+ GNOME_CANVAS (canvas)->grabbed_item,
+ canvas->grab_cancelled_data);
+ }
+ canvas->grab_cancelled_cb = NULL;
+ canvas->grab_cancelled_check_id = 0;
+ canvas->grab_cancelled_time = 0;
+ canvas->grab_cancelled_data = NULL;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int
+e_canvas_item_grab (ECanvas *canvas,
+ GnomeCanvasItem *item,
+ guint event_mask,
+ GdkCursor *cursor,
+ guint32 etime,
+ ECanvasItemGrabCancelled cancelled_cb,
+ gpointer cancelled_data)
+{
+ if (gtk_grab_get_current ()) {
+ return AlreadyGrabbed;
+ } else {
+ int ret_val = gnome_canvas_item_grab (item, event_mask, cursor, etime);
+ if (ret_val == GrabSuccess) {
+ canvas->grab_cancelled_cb = cancelled_cb;
+ canvas->grab_cancelled_check_id =
+ g_timeout_add_full (G_PRIORITY_LOW,
+ 100,
+ grab_cancelled_check,
+ canvas,
+ NULL);
+ canvas->grab_cancelled_time = etime;
+ canvas->grab_cancelled_data = cancelled_data;
+ }
+
+ return ret_val;
+ }
+}
+
+void
+e_canvas_item_ungrab (ECanvas *canvas,
+ GnomeCanvasItem *item,
+ guint32 etime)
+{
+ if (canvas->grab_cancelled_check_id) {
+ g_source_remove (canvas->grab_cancelled_check_id);
+ canvas->grab_cancelled_cb = NULL;
+ canvas->grab_cancelled_check_id = 0;
+ canvas->grab_cancelled_time = 0;
+ canvas->grab_cancelled_data = NULL;
+ gnome_canvas_item_ungrab (item, etime);
+ }
+}