aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-11-30 05:33:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-11-30 07:15:35 +0800
commitd52ad1054d509bbe02809b7f5a9471e95727ef08 (patch)
tree6db76f4f0919e05eec1813f3020e144c936f8773 /widgets/misc
parent1d3ccfb8e6ee69403eb6237692222a112e7b400d (diff)
downloadgsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar.gz
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar.bz2
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar.lz
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar.xz
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.tar.zst
gsoc2013-evolution-d52ad1054d509bbe02809b7f5a9471e95727ef08.zip
Add a GdkDevice parameter to gnome_canvas_item_grab().
GnomeCanvas will stash the GdkDevice and reuse it in the subsequent gnome_canvas_item_ungrab() call.
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-calendar-item.c48
-rw-r--r--widgets/misc/e-canvas.c12
-rw-r--r--widgets/misc/e-canvas.h1
3 files changed, 42 insertions, 19 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 1b1a72281d..414311bb2b 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -2228,45 +2228,61 @@ e_calendar_item_get_day_style (ECalendarItem *calitem,
static gboolean
e_calendar_item_button_press (ECalendarItem *calitem,
- GdkEvent *event)
+ GdkEvent *button_event)
{
+ GdkGrabStatus grab_status;
+ GdkDevice *event_device;
+ guint event_button = 0;
+ guint32 event_time;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
gint month_offset, day, add_days = 0;
gboolean all_week, round_up_end = FALSE, round_down_start = FALSE;
- if (event->button.button == 4)
+ gdk_event_get_button (button_event, &event_button);
+ gdk_event_get_coords (button_event, &event_x_win, &event_y_win);
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
+ if (event_button == 4)
e_calendar_item_set_first_month (
calitem, calitem->year,
calitem->month - 1);
- else if (event->button.button == 5)
+ else if (event_button == 5)
e_calendar_item_set_first_month (
calitem, calitem->year,
calitem->month + 1);
if (!e_calendar_item_convert_position_to_day (calitem,
- event->button.x,
- event->button.y,
+ event_x_win,
+ event_y_win,
TRUE,
&month_offset, &day,
&all_week))
return FALSE;
- if (event->button.button == 3 && day == -1
+ if (event_button == 3 && day == -1
&& e_calendar_item_get_display_popup (calitem)) {
e_calendar_item_show_popup_menu (
- calitem, event, month_offset);
+ calitem, button_event, month_offset);
return TRUE;
}
- if (event->button.button != 1 || day == -1)
+ if (event_button != 1 || day == -1)
return FALSE;
if (calitem->max_days_selected < 1)
return TRUE;
- if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (calitem),
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, event->button.time) != 0)
+ grab_status = gnome_canvas_item_grab (
+ GNOME_CANVAS_ITEM (calitem),
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_device,
+ event_time);
+
+ if (grab_status != GDK_GRAB_SUCCESS)
return FALSE;
if (all_week && calitem->keep_wdays_on_weeknum_click) {
@@ -2341,9 +2357,13 @@ e_calendar_item_button_press (ECalendarItem *calitem,
static gboolean
e_calendar_item_button_release (ECalendarItem *calitem,
- GdkEvent *event)
+ GdkEvent *button_event)
{
- e_calendar_item_stop_selecting (calitem, event->button.time);
+ guint32 event_time;
+
+ event_time = gdk_event_get_time (button_event);
+ e_calendar_item_stop_selecting (calitem, event_time);
+
return FALSE;
}
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
index e2e9ddd0cc..3ffc105867 100644
--- a/widgets/misc/e-canvas.c
+++ b/widgets/misc/e-canvas.c
@@ -835,21 +835,23 @@ e_canvas_item_grab (ECanvas *canvas,
GnomeCanvasItem *item,
guint event_mask,
GdkCursor *cursor,
+ GdkDevice *device,
guint32 etime,
ECanvasItemGrabCancelled cancelled_cb,
gpointer cancelled_data)
{
- gint ret_val;
+ GdkGrabStatus grab_status;
g_return_val_if_fail (E_IS_CANVAS (canvas), -1);
g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), -1);
+ g_return_val_if_fail (GDK_IS_DEVICE (device), -1);
if (gtk_grab_get_current ())
return GDK_GRAB_ALREADY_GRABBED;
- ret_val = gnome_canvas_item_grab (
- item, event_mask, cursor, etime);
- if (ret_val == GDK_GRAB_SUCCESS) {
+ grab_status = gnome_canvas_item_grab (
+ item, event_mask, cursor, device, etime);
+ if (grab_status == GDK_GRAB_SUCCESS) {
canvas->grab_cancelled_cb = cancelled_cb;
canvas->grab_cancelled_check_id = g_timeout_add_full (
G_PRIORITY_LOW, 100,
@@ -858,7 +860,7 @@ e_canvas_item_grab (ECanvas *canvas,
canvas->grab_cancelled_data = cancelled_data;
}
- return ret_val;
+ return grab_status;
}
void
diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h
index 72a2e47f54..c5f2087cd0 100644
--- a/widgets/misc/e-canvas.h
+++ b/widgets/misc/e-canvas.h
@@ -124,6 +124,7 @@ gint e_canvas_item_grab (ECanvas *canvas,
GnomeCanvasItem *item,
guint event_mask,
GdkCursor *cursor,
+ GdkDevice *device,
guint32 etime,
ECanvasItemGrabCancelled cancelled,
gpointer cancelled_data);