aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-week-view-event-item.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-11-30 02:12:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-11-30 02:24:24 +0800
commitd2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a (patch)
tree0a0da6f348d8c41ac3e7712a5c18abe78e23d891 /calendar/gui/e-week-view-event-item.c
parent67024e23ee07266a7b9854648454739e1824f91c (diff)
downloadgsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.gz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.bz2
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.lz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.xz
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.zst
gsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.zip
Avoid using GdkEventButton directly in certain places.
Prefer dealing with GdkEvent pointers and using accessor functions like gdk_event_get_button(). This is complicated by the fact that some GtkWidget method declarations still use GdkEventButton pointers, and synthesizing button events pretty much requires direct GdkEventButton access. But GDK seems to be nudging itself toward sealing the GdkEvent union. Likely to happen in GDK4. Mainly clean up signal handlers and leave method overrides alone for now.
Diffstat (limited to 'calendar/gui/e-week-view-event-item.c')
-rw-r--r--calendar/gui/e-week-view-event-item.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 6cd4a9048a..f517159e1b 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -120,7 +120,7 @@ week_view_event_item_get_position (EWeekViewEventItem *event_item,
static gboolean
week_view_event_item_double_click (EWeekViewEventItem *event_item,
- GdkEvent *bevent)
+ GdkEvent *button_event)
{
EWeekView *week_view;
EWeekViewEvent *event;
@@ -179,7 +179,7 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
static gboolean
week_view_event_item_button_press (EWeekViewEventItem *event_item,
- GdkEvent *bevent)
+ GdkEvent *button_event)
{
EWeekView *week_view;
ECalendarViewPosition pos;
@@ -187,6 +187,12 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
EWeekViewEventSpan *span;
GnomeCanvasItem *item;
GtkWidget *parent;
+ guint event_button = 0;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
+
+ gdk_event_get_button (button_event, &event_button);
+ gdk_event_get_coords (button_event, &event_x_win, &event_y_win);
item = GNOME_CANVAS_ITEM (event_item);
@@ -211,12 +217,11 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
event->spans_index + event_item->priv->span_num);
pos = week_view_event_item_get_position (
- event_item, bevent->button.x,
- bevent->button.y);
+ event_item, event_x_win, event_y_win);
if (pos == E_CALENDAR_VIEW_POS_NONE)
return FALSE;
- if (bevent->button.button == 1) {
+ if (event_button == 1) {
week_view->pressed_event_num = event_item->priv->event_num;
week_view->pressed_span_num = event_item->priv->span_num;
@@ -226,14 +231,15 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
/* Remember the item clicked and the mouse position,
* so we can start a drag if the mouse moves. */
- week_view->drag_event_x = bevent->button.x;
- week_view->drag_event_y = bevent->button.y;
+ week_view->drag_event_x = event_x_win;
+ week_view->drag_event_y = event_y_win;
/* FIXME: Remember the day offset from the start of the event.
*/
return TRUE;
- } else if (bevent->button.button == 3) {
+
+ } else if (event_button == 3) {
if (!gtk_widget_has_focus (GTK_WIDGET (week_view))) {
gtk_widget_grab_focus (GTK_WIDGET (week_view));
if (week_view->event_destroyed) {
@@ -247,7 +253,7 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
week_view, event->start, event->end);
e_week_view_show_popup_menu (
- week_view, (GdkEventButton *) bevent,
+ week_view, button_event,
event_item->priv->event_num);
g_signal_stop_emission_by_name (
item->canvas, "button_press_event");