aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-calendar-item.c
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/e-calendar-item.c
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/e-calendar-item.c')
-rw-r--r--widgets/misc/e-calendar-item.c48
1 files changed, 34 insertions, 14 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;
}