aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c6
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c8
-rw-r--r--calendar/alarm-notify/alarm-queue.c8
-rw-r--r--calendar/gui/e-cal-list-view.c7
-rw-r--r--calendar/gui/e-calendar-view.c6
-rw-r--r--calendar/gui/e-calendar-view.h4
-rw-r--r--calendar/gui/e-day-view.c264
-rw-r--r--calendar/gui/e-week-view-event-item.c24
-rw-r--r--calendar/gui/e-week-view.c128
-rw-r--r--calendar/gui/e-week-view.h2
-rw-r--r--libgnomecanvas/gnome-canvas.c80
-rw-r--r--modules/addressbook/e-book-shell-view-private.c20
-rw-r--r--modules/calendar/e-cal-shell-view-private.c16
-rw-r--r--modules/calendar/e-memo-shell-view-private.c8
-rw-r--r--modules/calendar/e-task-shell-view-private.c8
-rw-r--r--modules/mail/e-mail-shell-view-private.c11
-rw-r--r--plugins/image-inline/image-inline.c2
-rw-r--r--shell/e-shell-switcher.c9
-rw-r--r--shell/e-shell-view.c25
-rw-r--r--shell/e-shell-view.h2
-rw-r--r--smime/gui/certificate-manager.c11
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c15
-rw-r--r--widgets/misc/e-buffer-tagger.c35
-rw-r--r--widgets/misc/e-calendar-item.c15
-rw-r--r--widgets/misc/e-dateedit.c6
-rw-r--r--widgets/misc/e-map.c9
-rw-r--r--widgets/table/e-cell-combo.c24
-rw-r--r--widgets/table/e-cell-date-edit.c10
-rw-r--r--widgets/table/e-table-header-item.c23
-rw-r--r--widgets/table/e-table-header-item.h2
-rw-r--r--widgets/text/e-text.c72
-rw-r--r--widgets/text/e-text.h2
32 files changed, 535 insertions, 327 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 4d6aea77ae..9d7b1826c7 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -230,9 +230,11 @@ table_white_space_event (ETable *table,
GdkEvent *event,
EAddressbookView *view)
{
- gint button = ((GdkEventButton *) event)->button;
+ guint event_button = 0;
- if (event->type == GDK_BUTTON_PRESS && button == 3) {
+ gdk_event_get_button (event, &event_button);
+
+ if (event->type == GDK_BUTTON_PRESS && event_button == 3) {
addressbook_view_emit_popup_event (view, event);
return TRUE;
}
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 88633d4492..1889399f3d 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -404,12 +404,14 @@ e_minicard_view_event (GnomeCanvasItem *item,
GdkEvent *event)
{
EMinicardView *view;
+ guint event_button = 0;
view = E_MINICARD_VIEW (item);
switch (event->type) {
case GDK_2BUTTON_PRESS:
- if (((GdkEventButton *) event)->button == 1) {
+ gdk_event_get_button (event, &event_button);
+ if (event_button == 1) {
gboolean editable;
g_object_get (view->adapter, "editable", &editable, NULL);
@@ -419,9 +421,9 @@ e_minicard_view_event (GnomeCanvasItem *item,
return TRUE;
}
case GDK_BUTTON_PRESS:
- if (event->button.button == 3) {
+ gdk_event_get_button (event, &event_button);
+ if (event_button == 3)
e_minicard_view_right_click (view, event);
- }
break;
case GDK_KEY_PRESS:
if (event->key.keyval & GDK_SHIFT_MASK &&
diff --git a/calendar/alarm-notify/alarm-queue.c b/calendar/alarm-notify/alarm-queue.c
index f24a17b135..360a95edf2 100644
--- a/calendar/alarm-notify/alarm-queue.c
+++ b/calendar/alarm-notify/alarm-queue.c
@@ -1476,12 +1476,16 @@ open_alarm_dialog (TrayIconData *tray_data)
static gint
tray_icon_clicked_cb (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *event,
gpointer user_data)
{
if (event->type == GDK_BUTTON_PRESS) {
+ guint event_button = 0;
+
debug (("left click and %d alarms", g_list_length (tray_icons_list)));
- if (event->button == 1 && g_list_length (tray_icons_list) > 0) {
+
+ gdk_event_get_button (event, &event_button);
+ if (event_button == 1 && g_list_length (tray_icons_list) > 0) {
GList *tmp;
for (tmp = tray_icons_list; tmp; tmp = tmp->next) {
open_alarm_dialog (tmp->data);
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 6427002904..55280ce79c 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -68,7 +68,7 @@ static gboolean e_cal_list_view_get_visible_time_range (ECalendarView *cal_view
static gboolean e_cal_list_view_popup_menu (GtkWidget *widget);
static void e_cal_list_view_show_popup_menu (ECalListView *cal_list_view, gint row,
- GdkEventButton *event);
+ GdkEvent *event);
static gboolean e_cal_list_view_on_table_double_click (GtkWidget *table, gint row, gint col,
GdkEvent *event, gpointer data);
static gboolean e_cal_list_view_on_table_right_click (GtkWidget *table, gint row, gint col,
@@ -359,7 +359,7 @@ e_cal_list_view_dispose (GObject *object)
static void
e_cal_list_view_show_popup_menu (ECalListView *cal_list_view,
gint row,
- GdkEventButton *event)
+ GdkEvent *event)
{
e_calendar_view_popup_event (E_CALENDAR_VIEW (cal_list_view), event);
}
@@ -398,7 +398,8 @@ e_cal_list_view_on_table_right_click (GtkWidget *table,
{
ECalListView *cal_list_view = E_CAL_LIST_VIEW (data);
- e_cal_list_view_show_popup_menu (cal_list_view, row, (GdkEventButton *) event);
+ e_cal_list_view_show_popup_menu (cal_list_view, row, event);
+
return TRUE;
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 88f8abc86c..bbf890af59 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -998,12 +998,12 @@ calendar_view_selectable_init (ESelectableInterface *interface)
void
e_calendar_view_popup_event (ECalendarView *calendar_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
g_return_if_fail (E_IS_CALENDAR_VIEW (calendar_view));
- g_return_if_fail (event != NULL);
+ g_return_if_fail (button_event != NULL);
- g_signal_emit (calendar_view, signals[POPUP_EVENT], 0, event);
+ g_signal_emit (calendar_view, signals[POPUP_EVENT], 0, button_event);
}
gboolean
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index ab4d4e3778..9ed1173533 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -133,7 +133,7 @@ struct _ECalendarViewClass {
/* Notification signals */
void (*popup_event) (ECalendarView *cal_view,
- GdkEventButton *event);
+ GdkEvent *button_event);
void (*selection_changed) (ECalendarView *cal_view);
void (*selected_time_changed)(ECalendarView *cal_view);
void (*timezone_changed) (ECalendarView *cal_view,
@@ -217,7 +217,7 @@ CompEditor * e_calendar_view_open_event_with_flags
guint32 flags);
void e_calendar_view_popup_event (ECalendarView *cal_view,
- GdkEventButton *event);
+ GdkEvent *button_event);
gboolean e_calendar_view_add_event (ECalendarView *cal_view,
ECalClient *client,
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 59d558078d..5c3b4f2202 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -175,20 +175,20 @@ static void e_day_view_on_canvas_realized (GtkWidget *widget,
EDayView *day_view);
static gboolean e_day_view_on_top_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view);
static gboolean e_day_view_on_top_canvas_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view);
static gboolean e_day_view_on_top_canvas_motion (GtkWidget *widget,
GdkEventMotion *event,
EDayView *day_view);
static gboolean e_day_view_on_main_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view);
static gboolean e_day_view_on_main_canvas_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view);
static gboolean e_day_view_on_top_canvas_scroll (GtkWidget *widget,
@@ -219,27 +219,27 @@ static void e_day_view_abort_resize (EDayView *day_view);
static gboolean e_day_view_on_long_event_button_press (EDayView *day_view,
gint event_num,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y);
static gboolean e_day_view_on_event_button_press (EDayView *day_view,
gint day,
gint event_num,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y);
static void e_day_view_on_long_event_click (EDayView *day_view,
gint event_num,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y);
static void e_day_view_on_event_click (EDayView *day_view,
gint day,
gint event_num,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y);
@@ -247,11 +247,11 @@ static void e_day_view_on_event_double_click (EDayView *day_view,
gint day,
gint event_num);
static void e_day_view_on_event_right_click (EDayView *day_view,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
gint day,
gint event_num);
static void e_day_view_show_popup_menu (EDayView *day_view,
- GdkEventButton *event,
+ GdkEvent *button_event,
gint day,
gint event_num);
@@ -3098,17 +3098,24 @@ e_day_view_convert_time_to_position (EDayView *day_view,
static gboolean
e_day_view_on_top_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view)
{
gint event_x, event_y, day, event_num;
ECalendarViewPosition pos;
GtkLayout *layout;
GdkWindow *window;
+ GdkDevice *event_device;
+ guint event_button = 0;
+ guint32 event_time;
layout = GTK_LAYOUT (widget);
window = gtk_layout_get_bin_window (layout);
+ gdk_event_get_button (button_event, &event_button);
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
if (day_view->resize_event_num != -1)
day_view->resize_event_num = -1;
@@ -3118,7 +3125,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
/* Convert the coords to the main canvas window, or return if the
* window is not found. */
if (!e_day_view_convert_event_coords (
- day_view, (GdkEvent *) event, window, &event_x, &event_y))
+ day_view, button_event, window, &event_x, &event_y))
return FALSE;
pos = e_day_view_convert_position_in_top_canvas (
@@ -3133,14 +3140,17 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
return e_day_view_on_long_event_button_press (
day_view,
event_num,
- event, pos,
+ button_event,
+ pos,
event_x,
event_y);
e_day_view_stop_editing_event (day_view);
- if (event->button == 1) {
- if (event->type == GDK_2BUTTON_PRESS) {
+ if (event_button == 1) {
+ GdkGrabStatus grab_status;
+
+ if (button_event->type == GDK_2BUTTON_PRESS) {
time_t dtstart, dtend;
e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend);
@@ -3150,25 +3160,36 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
e_day_view_set_selected_time_range ((ECalendarView *) day_view, dtstart, dtend);
}
- e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view),
- dtstart, dtend,
- TRUE, calendar_config_get_prefer_meeting ());
+ e_calendar_view_new_appointment_for (
+ E_CALENDAR_VIEW (day_view),
+ dtstart, dtend, TRUE,
+ calendar_config_get_prefer_meeting ());
return TRUE;
}
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (window, FALSE,
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time) == 0) {
- if (event->time - day_view->bc_event_time > 250)
- e_day_view_get_selected_time_range ((ECalendarView *) day_view, &day_view->before_click_dtstart, &day_view->before_click_dtend);
- day_view->bc_event_time = event->time;
+ grab_status = gdk_device_grab (
+ event_device,
+ window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_time);
+
+ if (grab_status == GDK_GRAB_SUCCESS) {
+ if (event_time - day_view->bc_event_time > 250)
+ e_day_view_get_selected_time_range (
+ E_CALENDAR_VIEW (day_view),
+ &day_view->before_click_dtstart,
+ &day_view->before_click_dtend);
+ day_view->bc_event_time = event_time;
e_day_view_start_selection (day_view, day, -1);
}
- } else if (event->button == 3) {
+ } else if (event_button == 3) {
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
@@ -3177,7 +3198,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
e_day_view_finish_selection (day_view);
}
- e_day_view_on_event_right_click (day_view, event, -1, -1);
+ e_day_view_on_event_right_click (day_view, button_event, -1, -1);
}
return TRUE;
@@ -3235,17 +3256,24 @@ e_day_view_convert_event_coords (EDayView *day_view,
static gboolean
e_day_view_on_main_canvas_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view)
{
gint event_x, event_y, row, day, event_num;
ECalendarViewPosition pos;
GtkLayout *layout;
GdkWindow *window;
+ GdkDevice *event_device;
+ guint event_button = 0;
+ guint32 event_time;
layout = GTK_LAYOUT (widget);
window = gtk_layout_get_bin_window (layout);
+ gdk_event_get_button (button_event, &event_button);
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
if (day_view->resize_event_num != -1)
day_view->resize_event_num = -1;
@@ -3255,7 +3283,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
/* Convert the coords to the main canvas window, or return if the
* window is not found. */
if (!e_day_view_convert_event_coords (
- day_view, (GdkEvent *) event, window, &event_x, &event_y))
+ day_view, button_event, window, &event_x, &event_y))
return FALSE;
/* Find out where the mouse is. */
@@ -3270,15 +3298,21 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
if (pos != E_CALENDAR_VIEW_POS_NONE)
return e_day_view_on_event_button_press (
- day_view, day,
- event_num, event, pos,
- event_x, event_y);
+ day_view,
+ day,
+ event_num,
+ button_event,
+ pos,
+ event_x,
+ event_y);
e_day_view_stop_editing_event (day_view);
/* Start the selection drag. */
- if (event->button == 1) {
- if (event->type == GDK_2BUTTON_PRESS) {
+ if (event_button == 1) {
+ GdkGrabStatus grab_status;
+
+ if (button_event->type == GDK_2BUTTON_PRESS) {
time_t dtstart, dtend;
e_day_view_get_selected_time_range ((ECalendarView *) day_view, &dtstart, &dtend);
@@ -3287,26 +3321,37 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
dtend = day_view->before_click_dtend;
e_day_view_set_selected_time_range ((ECalendarView *) day_view, dtstart, dtend);
}
- e_calendar_view_new_appointment_for (E_CALENDAR_VIEW (day_view),
- dtstart, dtend,
- FALSE, calendar_config_get_prefer_meeting ());
+ e_calendar_view_new_appointment_for (
+ E_CALENDAR_VIEW (day_view),
+ dtstart, dtend, FALSE,
+ calendar_config_get_prefer_meeting ());
return TRUE;
}
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)) && !gtk_widget_has_focus (GTK_WIDGET (day_view->main_canvas)))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (window, FALSE,
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time) == 0) {
- if (event->time - day_view->bc_event_time > 250)
- e_day_view_get_selected_time_range ((ECalendarView *) day_view, &day_view->before_click_dtstart, &day_view->before_click_dtend);
- day_view->bc_event_time = event->time;
+ grab_status = gdk_device_grab (
+ event_device,
+ window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_time);
+
+ if (grab_status == GDK_GRAB_SUCCESS) {
+ if (event_time - day_view->bc_event_time > 250)
+ e_day_view_get_selected_time_range (
+ E_CALENDAR_VIEW (day_view),
+ &day_view->before_click_dtstart,
+ &day_view->before_click_dtend);
+ day_view->bc_event_time = event_time;
e_day_view_start_selection (day_view, day, row);
g_signal_emit_by_name (day_view, "selected_time_changed");
}
- } else if (event->button == 3) {
+ } else if (event_button == 3) {
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
@@ -3317,7 +3362,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
e_day_view_finish_selection (day_view);
}
- e_day_view_on_event_right_click (day_view, event, -1, -1);
+ e_day_view_on_event_right_click (day_view, button_event, -1, -1);
}
return TRUE;
@@ -3414,26 +3459,30 @@ e_day_view_on_time_canvas_scroll (GtkWidget *widget,
static gboolean
e_day_view_on_long_event_button_press (EDayView *day_view,
gint event_num,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
- if (event->button == 1) {
- if (event->type == GDK_BUTTON_PRESS) {
+ guint event_button = 0;
+
+ gdk_event_get_button (button_event, &event_button);
+
+ if (event_button == 1) {
+ if (button_event->type == GDK_BUTTON_PRESS) {
e_day_view_on_long_event_click (
day_view, event_num,
- event, pos,
+ button_event, pos,
event_x, event_y);
return TRUE;
- } else if (event->type == GDK_2BUTTON_PRESS) {
+ } else if (button_event->type == GDK_2BUTTON_PRESS) {
e_day_view_on_event_double_click (
day_view, -1,
event_num);
g_signal_stop_emission_by_name (day_view->top_canvas, "button_press_event");
return TRUE;
}
- } else if (event->button == 3) {
+ } else if (event_button == 3) {
EDayViewEvent *e;
if (!is_array_index_in_bounds (day_view->long_events, event_num))
@@ -3444,7 +3493,7 @@ e_day_view_on_long_event_button_press (EDayView *day_view,
e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end);
e_day_view_on_event_right_click (
- day_view, event,
+ day_view, button_event,
E_DAY_VIEW_LONG_EVENT,
event_num);
@@ -3457,19 +3506,23 @@ static gboolean
e_day_view_on_event_button_press (EDayView *day_view,
gint day,
gint event_num,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y)
{
- if (event->button == 1) {
- if (event->type == GDK_BUTTON_PRESS) {
+ guint event_button = 0;
+
+ gdk_event_get_button (button_event, &event_button);
+
+ if (event_button == 1) {
+ if (button_event->type == GDK_BUTTON_PRESS) {
e_day_view_on_event_click (
day_view, day, event_num,
- event, pos,
+ button_event, pos,
event_x, event_y);
return TRUE;
- } else if (event->type == GDK_2BUTTON_PRESS) {
+ } else if (button_event->type == GDK_2BUTTON_PRESS) {
e_day_view_on_event_double_click (
day_view, day,
event_num);
@@ -3477,7 +3530,7 @@ e_day_view_on_event_button_press (EDayView *day_view,
g_signal_stop_emission_by_name (day_view->main_canvas, "button_press_event");
return TRUE;
}
- } else if (event->button == 3) {
+ } else if (event_button == 3) {
EDayViewEvent *e;
if (!is_array_index_in_bounds (day_view->events[day], event_num))
@@ -3488,8 +3541,7 @@ e_day_view_on_event_button_press (EDayView *day_view,
e_day_view_set_selected_time_range_visible (day_view, e->start, e->end);
e_day_view_on_event_right_click (
- day_view, event,
- day, event_num);
+ day_view, button_event, day, event_num);
return TRUE;
}
@@ -3499,7 +3551,7 @@ e_day_view_on_event_button_press (EDayView *day_view,
static void
e_day_view_on_long_event_click (EDayView *day_view,
gint event_num,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y)
@@ -3522,7 +3574,8 @@ e_day_view_on_long_event_click (EDayView *day_view,
/* Ignore clicks on the EText while editing. */
if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing) {
- GNOME_CANVAS_ITEM_GET_CLASS (event->canvas_item)->event (event->canvas_item, (GdkEvent *) bevent);
+ GNOME_CANVAS_ITEM_GET_CLASS (event->canvas_item)->event (
+ event->canvas_item, button_event);
return;
}
@@ -3530,6 +3583,10 @@ e_day_view_on_long_event_click (EDayView *day_view,
!e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
&& (pos == E_CALENDAR_VIEW_POS_LEFT_EDGE
|| pos == E_CALENDAR_VIEW_POS_RIGHT_EDGE)) {
+ GdkGrabStatus grab_status;
+ GdkDevice *event_device;
+ guint32 event_time;
+
if (!e_day_view_find_long_event_days (event,
day_view->days_shown,
day_view->day_starts,
@@ -3544,11 +3601,20 @@ e_day_view_on_long_event_click (EDayView *day_view,
layout = GTK_LAYOUT (day_view->top_canvas);
window = gtk_layout_get_bin_window (layout);
- if (gdk_pointer_grab (window, FALSE,
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, bevent->time) == 0) {
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
+ grab_status = gdk_device_grab (
+ event_device,
+ window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_time);
+ if (grab_status == GDK_GRAB_SUCCESS) {
day_view->resize_event_day = E_DAY_VIEW_LONG_EVENT;
day_view->resize_event_num = event_num;
day_view->resize_drag_pos = pos;
@@ -3582,7 +3648,7 @@ static void
e_day_view_on_event_click (EDayView *day_view,
gint day,
gint event_num,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
ECalendarViewPosition pos,
gint event_x,
gint event_y)
@@ -3609,7 +3675,8 @@ e_day_view_on_event_click (EDayView *day_view,
/* Ignore clicks on the EText while editing. */
if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing) {
- GNOME_CANVAS_ITEM_GET_CLASS (event->canvas_item)->event (event->canvas_item, (GdkEvent *) bevent);
+ GNOME_CANVAS_ITEM_GET_CLASS (event->canvas_item)->event (
+ event->canvas_item, button_event);
return;
}
@@ -3617,6 +3684,10 @@ e_day_view_on_event_click (EDayView *day_view,
!e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
&& (pos == E_CALENDAR_VIEW_POS_TOP_EDGE
|| pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE)) {
+ GdkGrabStatus grab_status;
+ GdkDevice *event_device;
+ guint32 event_time;
+
if (event && (!event->is_editable || e_client_is_readonly (E_CLIENT (event->comp_data->client)))) {
return;
}
@@ -3629,11 +3700,20 @@ e_day_view_on_event_click (EDayView *day_view,
layout = GTK_LAYOUT (day_view->main_canvas);
window = gtk_layout_get_bin_window (layout);
- if (gdk_pointer_grab (window, FALSE,
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, bevent->time) == 0) {
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
+ grab_status = gdk_device_grab (
+ event_device,
+ window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_time);
+ if (grab_status != GDK_GRAB_SUCCESS) {
day_view->resize_event_day = day;
day_view->resize_event_num = event_num;
day_view->resize_drag_pos = pos;
@@ -3699,7 +3779,7 @@ e_day_view_on_event_double_click (EDayView *day_view,
static void
e_day_view_show_popup_menu (EDayView *day_view,
- GdkEventButton *event,
+ GdkEvent *button_event,
gint day,
gint event_num)
{
@@ -3708,7 +3788,7 @@ e_day_view_show_popup_menu (EDayView *day_view,
day_view->popup_event_day = day;
day_view->popup_event_num = event_num;
- e_calendar_view_popup_event (E_CALENDAR_VIEW (day_view), event);
+ e_calendar_view_popup_event (E_CALENDAR_VIEW (day_view), button_event);
}
static gboolean
@@ -3806,23 +3886,29 @@ e_day_view_update_query (EDayView *day_view)
static void
e_day_view_on_event_right_click (EDayView *day_view,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
gint day,
gint event_num)
{
- e_day_view_show_popup_menu (day_view, bevent, day, event_num);
+ e_day_view_show_popup_menu (day_view, button_event, day, event_num);
}
static gboolean
e_day_view_on_top_canvas_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view)
{
+ GdkDevice *event_device;
+ guint32 event_time;
+
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
if (day_view->selection_is_being_dragged) {
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event_device, event_time);
e_day_view_finish_selection (day_view);
} else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event_device, event_time);
e_day_view_finish_long_event_resize (day_view);
} else if (day_view->pressed_event_day != -1) {
e_day_view_start_editing_event (
@@ -3839,23 +3925,29 @@ e_day_view_on_top_canvas_button_release (GtkWidget *widget,
static gboolean
e_day_view_on_main_canvas_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EDayView *day_view)
{
+ GdkDevice *event_device;
+ guint32 event_time;
+
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
if (day_view->selection_is_being_dragged) {
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event_device, event_time);
e_day_view_finish_selection (day_view);
e_day_view_stop_auto_scroll (day_view);
} else if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE) {
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event_device, event_time);
e_day_view_finish_resize (day_view);
e_day_view_stop_auto_scroll (day_view);
} else if (day_view->pressed_event_day != -1) {
e_day_view_start_editing_event (
day_view,
- day_view->pressed_event_day,
- day_view->pressed_event_num,
- NULL);
+ day_view->pressed_event_day,
+ day_view->pressed_event_num,
+ NULL);
}
day_view->pressed_event_day = -1;
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");
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 574b79efab..83c41499cf 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -112,10 +112,10 @@ static void e_week_view_paste_text (ECalendarView *week_view);
static void e_week_view_update_query (EWeekView *week_view);
static gboolean e_week_view_on_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EWeekView *week_view);
static gboolean e_week_view_on_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EWeekView *week_view);
static gboolean e_week_view_on_scroll (GtkWidget *widget,
GdkEventScroll *scroll,
@@ -2416,26 +2416,32 @@ ewv_pass_gdkevent_to_etext (EWeekView *week_view,
static gboolean
e_week_view_on_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EWeekView *week_view)
{
+ guint event_button = 0;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
gint x, y, day;
+ gdk_event_get_button (button_event, &event_button);
+ gdk_event_get_coords (button_event, &event_x_win, &event_y_win);
+
/* Convert the mouse position to a week & day. */
- x = event->x;
- y = event->y;
+ x = (gint) event_x_win;
+ y = (gint) event_y_win;
day = e_week_view_convert_position_to_day (week_view, x, y);
if (day == -1)
return FALSE;
- if (ewv_pass_gdkevent_to_etext (week_view, (GdkEvent *) event))
+ if (ewv_pass_gdkevent_to_etext (week_view, button_event))
return TRUE;
/* If an event is pressed just return. */
if (week_view->pressed_event_num != -1)
return FALSE;
- if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
+ if (event_button == 1 && button_event->type == GDK_2BUTTON_PRESS) {
time_t dtstart, dtend;
e_calendar_view_get_selected_time_range ((ECalendarView *) week_view, &dtstart, &dtend);
@@ -2446,8 +2452,11 @@ e_week_view_on_button_press (GtkWidget *widget,
return TRUE;
}
- if (event->button == 1) {
+ if (event_button == 1) {
+ GdkGrabStatus grab_status;
GdkWindow *window;
+ GdkDevice *event_device;
+ guint32 event_time;
/* Start the selection drag. */
if (!gtk_widget_has_focus (GTK_WIDGET (week_view)) && !gtk_widget_has_focus (GTK_WIDGET (week_view->main_canvas)))
@@ -2455,13 +2464,26 @@ e_week_view_on_button_press (GtkWidget *widget,
window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
- if (gdk_pointer_grab (window, FALSE,
- GDK_POINTER_MOTION_MASK
- | GDK_BUTTON_RELEASE_MASK,
- NULL, NULL, event->time) == 0) {
- if (event->time - week_view->bc_event_time > 250)
- e_calendar_view_get_selected_time_range ((ECalendarView *) week_view, &week_view->before_click_dtstart, &week_view->before_click_dtend);
- week_view->bc_event_time = event->time;
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
+ grab_status = gdk_device_grab (
+ event_device,
+ window,
+ GDK_OWNERSHIP_NONE,
+ FALSE,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK,
+ NULL,
+ event_time);
+
+ if (grab_status == GDK_GRAB_SUCCESS) {
+ if (event_time - week_view->bc_event_time > 250)
+ e_calendar_view_get_selected_time_range (
+ E_CALENDAR_VIEW (week_view),
+ &week_view->before_click_dtstart,
+ &week_view->before_click_dtend);
+ week_view->bc_event_time = event_time;
week_view->selection_start_day = day;
week_view->selection_end_day = day;
week_view->selection_drag_pos = E_WEEK_VIEW_DRAG_END;
@@ -2470,7 +2492,7 @@ e_week_view_on_button_press (GtkWidget *widget,
/* FIXME: Optimise? */
gtk_widget_queue_draw (week_view->main_canvas);
}
- } else if (event->button == 3) {
+ } else if (event_button == 3) {
if (!gtk_widget_has_focus (GTK_WIDGET (week_view)))
gtk_widget_grab_focus (GTK_WIDGET (week_view));
@@ -2483,7 +2505,7 @@ e_week_view_on_button_press (GtkWidget *widget,
gtk_widget_queue_draw (week_view->main_canvas);
}
- e_week_view_show_popup_menu (week_view, event, -1);
+ e_week_view_show_popup_menu (week_view, button_event, -1);
}
return TRUE;
@@ -2491,14 +2513,20 @@ e_week_view_on_button_press (GtkWidget *widget,
static gboolean
e_week_view_on_button_release (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
EWeekView *week_view)
{
+ GdkDevice *event_device;
+ guint32 event_time;
+
+ event_device = gdk_event_get_device (button_event);
+ event_time = gdk_event_get_time (button_event);
+
if (week_view->selection_drag_pos != E_WEEK_VIEW_DRAG_NONE) {
week_view->selection_drag_pos = E_WEEK_VIEW_DRAG_NONE;
- gdk_pointer_ungrab (event->time);
+ gdk_device_ungrab (event_device, event_time);
} else {
- ewv_pass_gdkevent_to_etext (week_view, (GdkEvent *) event);
+ ewv_pass_gdkevent_to_etext (week_view, button_event);
}
return FALSE;
@@ -3530,20 +3558,26 @@ cancel_editing (EWeekView *week_view)
static gboolean
e_week_view_on_text_item_event (GnomeCanvasItem *item,
- GdkEvent *gdkevent,
+ GdkEvent *gdk_event,
EWeekView *week_view)
{
EWeekViewEvent *event;
gint event_num, span_num;
gint nevent = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "event-num"));
EWeekViewEvent *pevent;
+ guint event_button = 0;
+ guint event_keyval = 0;
+ gdouble event_x_root = 0;
+ gdouble event_y_root = 0;
pevent = tooltip_get_view_event (week_view, -1, nevent);
- switch (gdkevent->type) {
+ switch (gdk_event->type) {
case GDK_KEY_PRESS:
tooltip_destroy (week_view, item);
- if (!E_TEXT (item)->preedit_len && gdkevent && gdkevent->key.keyval == GDK_KEY_Return) {
+ gdk_event_get_keyval (gdk_event, &event_keyval);
+
+ if (!E_TEXT (item)->preedit_len && event_keyval == GDK_KEY_Return) {
/* We set the keyboard focus to the EDayView, so the
* EText item loses it and stops the edit. */
gtk_widget_grab_focus (GTK_WIDGET (week_view));
@@ -3552,7 +3586,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
* other events getting to the EText item. */
g_signal_stop_emission_by_name (item, "event");
return TRUE;
- } else if (gdkevent->key.keyval == GDK_KEY_Escape) {
+ } else if (event_keyval == GDK_KEY_Escape) {
cancel_editing (week_view);
g_signal_stop_emission_by_name (item, "event");
/* focus should go to week view when stop editing */
@@ -3592,7 +3626,8 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
&event_num, &span_num))
return FALSE;
- if (gdkevent->button.button == 3) {
+ gdk_event_get_button (gdk_event, &event_button);
+ if (event_button == 3) {
EWeekViewEvent *e;
if (E_TEXT (item)->editing) {
@@ -3612,29 +3647,30 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
e_week_view_set_selected_time_range_visible (week_view, e->start, e->end);
e_week_view_show_popup_menu (
- week_view,
- (GdkEventButton *) gdkevent,
- event_num);
+ week_view, gdk_event, event_num);
g_signal_stop_emission_by_name (
item->canvas, "button_press_event");
return TRUE;
}
- if (gdkevent->button.button != 3) {
+ if (event_button != 3) {
week_view->pressed_event_num = event_num;
week_view->pressed_span_num = span_num;
}
/* Only let the EText handle the event while editing. */
if (!E_TEXT (item)->editing) {
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
+
g_signal_stop_emission_by_name (item, "event");
- if (gdkevent) {
- week_view->drag_event_x = gdkevent->button.x;
- week_view->drag_event_y = gdkevent->button.y;
- } else
- g_warning ("No GdkEvent");
+ gdk_event_get_coords (
+ gdk_event, &event_x_win, &event_y_win);
+
+ week_view->drag_event_x = (gint) event_x_win;
+ week_view->drag_event_y = (gint) event_y_win;
/* FIXME: Remember the day offset from the start of
* the event, for DnD. */
@@ -3684,8 +3720,11 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
data = g_malloc (sizeof (ECalendarViewEventData));
- pevent->x = ((GdkEventCrossing *) gdkevent)->x_root;
- pevent->y = ((GdkEventCrossing *) gdkevent)->y_root;
+ gdk_event_get_root_coords (
+ gdk_event, &event_x_root, &event_y_root);
+
+ pevent->x = (gint) event_x_root;
+ pevent->y = (gint) event_y_root;
pevent->tooltip = NULL;
data->cal_view = (ECalendarView *) week_view;
@@ -3705,8 +3744,11 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
case GDK_MOTION_NOTIFY:
- pevent->x = ((GdkEventMotion *) gdkevent)->x_root;
- pevent->y = ((GdkEventMotion *) gdkevent)->y_root;
+ gdk_event_get_root_coords (
+ gdk_event, &event_x_root, &event_y_root);
+
+ pevent->x = (gint) event_x_root;
+ pevent->y = (gint) event_y_root;
pevent->tooltip = (GtkWidget *) g_object_get_data (G_OBJECT (week_view), "tooltip-window");
if (pevent->tooltip) {
@@ -3714,7 +3756,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
}
return TRUE;
case GDK_FOCUS_CHANGE:
- if (gdkevent->focus_change.in) {
+ if (gdk_event->focus_change.in) {
e_week_view_on_editing_started (week_view, item);
} else {
e_week_view_on_editing_stopped (week_view, item);
@@ -3728,7 +3770,9 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
}
-static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
+static gboolean
+e_week_view_event_move (ECalendarView *cal_view,
+ ECalViewMoveDirection direction)
{
EWeekViewEvent *event;
gint event_num, adjust_days, current_start_day, current_end_day;
@@ -4584,12 +4628,12 @@ e_week_view_key_press (GtkWidget *widget,
void
e_week_view_show_popup_menu (EWeekView *week_view,
- GdkEventButton *bevent,
+ GdkEvent *button_event,
gint event_num)
{
week_view->popup_event_num = event_num;
- e_calendar_view_popup_event (E_CALENDAR_VIEW (week_view), bevent);
+ e_calendar_view_popup_event (E_CALENDAR_VIEW (week_view), button_event);
}
static gboolean
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 5a1f2e6d22..bb84e2b8f6 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -438,7 +438,7 @@ gboolean e_week_view_start_editing_event (EWeekView *week_view,
void e_week_view_stop_editing_event (EWeekView *week_view);
void e_week_view_show_popup_menu (EWeekView *week_view,
- GdkEventButton *event,
+ GdkEvent *button_event,
gint event_num);
void e_week_view_convert_time_to_display
diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c
index 7daf42dc1c..10f2da53ae 100644
--- a/libgnomecanvas/gnome-canvas.c
+++ b/libgnomecanvas/gnome-canvas.c
@@ -2575,52 +2575,50 @@ gnome_canvas_button (GtkWidget *widget,
return retval;
switch (event->button) {
- case 1:
- mask = GDK_BUTTON1_MASK;
- break;
- case 2:
- mask = GDK_BUTTON2_MASK;
- break;
- case 3:
- mask = GDK_BUTTON3_MASK;
- break;
- case 4:
- mask = GDK_BUTTON4_MASK;
- break;
- case 5:
- mask = GDK_BUTTON5_MASK;
- break;
- default:
- mask = 0;
+ case 1:
+ mask = GDK_BUTTON1_MASK;
+ break;
+ case 2:
+ mask = GDK_BUTTON2_MASK;
+ break;
+ case 3:
+ mask = GDK_BUTTON3_MASK;
+ break;
+ case 4:
+ mask = GDK_BUTTON4_MASK;
+ break;
+ case 5:
+ mask = GDK_BUTTON5_MASK;
+ break;
+ default:
+ mask = 0;
}
switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- /* Pick the current item as if the button were not pressed, and
- * then process the event.
- */
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- canvas->state ^= mask;
- retval = emit_event (canvas, (GdkEvent *) event);
- break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ /* Pick the current item as if the button were
+ * not pressed, and then process the event. */
+ canvas->state = event->state;
+ pick_current_item (canvas, (GdkEvent *) event);
+ canvas->state ^= mask;
+ retval = emit_event (canvas, (GdkEvent *) event);
+ break;
- case GDK_BUTTON_RELEASE:
- /* Process the event as if the button were pressed, then repick
- * after the button has been released
- */
- canvas->state = event->state;
- retval = emit_event (canvas, (GdkEvent *) event);
- event->state ^= mask;
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- event->state ^= mask;
- break;
+ case GDK_BUTTON_RELEASE:
+ /* Process the event as if the button were pressed,
+ * then repick after the button has been released. */
+ canvas->state = event->state;
+ retval = emit_event (canvas, (GdkEvent *) event);
+ event->state ^= mask;
+ canvas->state = event->state;
+ pick_current_item (canvas, (GdkEvent *) event);
+ event->state ^= mask;
+ break;
- default:
- g_warn_if_reached ();
+ default:
+ g_warn_if_reached ();
}
return retval;
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 360deb9bb9..947f680f6e 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -64,7 +64,7 @@ open_contact (EBookShellView *book_shell_view,
static void
popup_event (EBookShellView *book_shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
EShellView *shell_view;
const gchar *widget_path;
@@ -72,7 +72,7 @@ popup_event (EBookShellView *book_shell_view,
widget_path = "/contact-popup";
shell_view = E_SHELL_VIEW (book_shell_view);
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static void
@@ -381,27 +381,31 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view,
}
static gboolean
-book_shell_view_show_popup_menu (GdkEventButton *event,
+book_shell_view_show_popup_menu (GdkEvent *button_event,
EShellView *shell_view)
{
const gchar *widget_path;
widget_path = "/address-book-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
return TRUE;
}
static gboolean
book_shell_view_selector_button_press_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
+ guint event_button = 0;
+
/* XXX Use ESourceSelector's "popup-event" signal instead. */
- if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
- return book_shell_view_show_popup_menu (event, shell_view);
+ gdk_event_get_button (button_event, &event_button);
+
+ if (button_event->type != GDK_BUTTON_PRESS || event_button != 3)
+ return FALSE;
- return FALSE;
+ return book_shell_view_show_popup_menu (button_event, shell_view);
}
static gboolean
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 8d20cd974a..8159e3d22b 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -283,7 +283,7 @@ cal_shell_view_date_navigator_scroll_event_cb (ECalShellView *cal_shell_view,
static void
cal_shell_view_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
GList *list;
GnomeCalendar *calendar;
@@ -309,18 +309,18 @@ cal_shell_view_popup_event_cb (EShellView *shell_view,
else
widget_path = "/calendar-event-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static gboolean
cal_shell_view_selector_popup_event_cb (EShellView *shell_view,
ESource *primary_source,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/calendar-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
return TRUE;
}
@@ -361,22 +361,22 @@ cal_shell_view_selector_client_removed_cb (ECalShellView *cal_shell_view,
static void
cal_shell_view_memopad_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/calendar-memopad-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static void
cal_shell_view_taskpad_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/calendar-taskpad-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static void
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 5e7c7552cc..9f31e446ac 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -48,12 +48,12 @@ memo_shell_view_model_row_appended_cb (EMemoShellView *memo_shell_view,
static void
memo_shell_view_table_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/memo-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static void
@@ -90,12 +90,12 @@ memo_shell_view_selector_client_removed_cb (EMemoShellView *memo_shell_view,
static gboolean
memo_shell_view_selector_popup_event_cb (EShellView *shell_view,
ESource *primary_source,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/memo-list-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
return TRUE;
}
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index b77317a1dd..ba66c59caa 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -92,12 +92,12 @@ task_shell_view_schedule_process_completed_tasks (ETaskShellView *task_shell_vie
static void
task_shell_view_table_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/task-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
}
static void
@@ -134,12 +134,12 @@ task_shell_view_selector_client_removed_cb (ETaskShellView *task_shell_view,
static gboolean
task_shell_view_selector_popup_event_cb (EShellView *shell_view,
ESource *primary_source,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/task-list-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
return TRUE;
}
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 9376f437ae..6bdbcb3adf 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -242,13 +242,12 @@ mail_shell_view_folder_tree_selection_done_cb (EMailShellView *mail_shell_view,
static void
mail_shell_view_folder_tree_popup_event_cb (EShellView *shell_view,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
GtkWidget *menu;
- const gchar *widget_path;
- widget_path = "/mail-folder-popup";
- menu = e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ menu = e_shell_view_show_popup_menu (
+ shell_view, "/mail-folder-popup", button_event);
g_signal_connect_object (
menu, "selection-done",
@@ -386,12 +385,12 @@ mail_shell_view_message_list_right_click_cb (EShellView *shell_view,
gint row,
ETreePath path,
gint col,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
const gchar *widget_path;
widget_path = "/mail-message-popup";
- e_shell_view_show_popup_menu (shell_view, widget_path, event);
+ e_shell_view_show_popup_menu (shell_view, widget_path, button_event);
return TRUE;
}
diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c
index cfb05a1b00..cef3bf8633 100644
--- a/plugins/image-inline/image-inline.c
+++ b/plugins/image-inline/image-inline.c
@@ -144,7 +144,7 @@ set_drag_source (GtkImageView *image_view)
static gboolean
button_press_press_cb (GtkImageView *image_view,
- GdkEventButton *event,
+ GdkEvent *button_event,
ImageInlinePObject *image_object)
{
if (event->type != GDK_2BUTTON_PRESS)
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index 195dc7c896..9e8f9a3a44 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -609,15 +609,20 @@ tool_item_get_button (GtkWidget *widget)
static gboolean
tool_item_button_cb (GtkWidget *internal_widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
GtkAction *action)
{
+ guint event_button = 0;
+
g_return_val_if_fail (GTK_IS_ACTION (action), FALSE);
- if (event->button == 2) {
+ gdk_event_get_button (button_event, &event_button);
+
+ if (event_button == 2) {
gtk_action_activate (action);
return TRUE;
}
+
return FALSE;
}
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 90fdbc852e..16d09fcb2d 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1786,7 +1786,7 @@ e_shell_view_unblock_update_actions (EShellView *shell_view)
* e_shell_view_show_popup_menu:
* @shell_view: an #EShellView
* @widget_path: path in the UI definition
- * @event: a #GdkEventButton
+ * @button_event: a #GdkEvent, or %NULL
*
* Displays a context-sensitive (or "popup") menu that is described in
* the UI definition loaded into @shell_view<!-- -->'s user interface
@@ -1801,10 +1801,12 @@ e_shell_view_unblock_update_actions (EShellView *shell_view)
GtkWidget *
e_shell_view_show_popup_menu (EShellView *shell_view,
const gchar *widget_path,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
EShellWindow *shell_window;
GtkWidget *menu;
+ guint event_button = 0;
+ guint32 event_time;
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
@@ -1814,14 +1816,17 @@ e_shell_view_show_popup_menu (EShellView *shell_view,
menu = e_shell_window_get_managed_widget (shell_window, widget_path);
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
- if (event != NULL)
- gtk_menu_popup (
- GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
- else
- gtk_menu_popup (
- GTK_MENU (menu), NULL, NULL, NULL, NULL,
- 0, gtk_get_current_event_time ());
+ if (button_event != NULL) {
+ gdk_event_get_button (button_event, &event_button);
+ event_time = gdk_event_get_time (button_event);
+ } else {
+ event_time = gtk_get_current_event_time ();
+ }
+
+ gtk_menu_popup (
+ GTK_MENU (menu),
+ NULL, NULL, NULL, NULL,
+ event_button, event_time);
return menu;
}
diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h
index 736af40b6a..fe2b63c5b2 100644
--- a/shell/e-shell-view.h
+++ b/shell/e-shell-view.h
@@ -225,7 +225,7 @@ void e_shell_view_unblock_update_actions
(EShellView *shell_view);
GtkWidget * e_shell_view_show_popup_menu (EShellView *shell_view,
const gchar *widget_path,
- GdkEventButton *event);
+ GdkEvent *button_event);
GalViewInstance *
e_shell_view_new_view_instance (EShellView *shell_view,
const gchar *instance_id);
diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c
index acddc8a974..a48442f50b 100644
--- a/smime/gui/certificate-manager.c
+++ b/smime/gui/certificate-manager.c
@@ -325,16 +325,21 @@ report_and_free_error (CertPage *cp,
static gboolean
treeview_header_clicked (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
gpointer user_data)
{
GtkMenu *menu = user_data;
+ guint event_button = 0;
+ guint32 event_time;
- if (event->button != 3)
+ gdk_event_get_button (button_event, &event_button);
+ event_time = gdk_event_get_time (button_event);
+
+ if (event_button != 3)
return FALSE;
gtk_widget_show_all (GTK_WIDGET (menu));
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event_button, event_time);
return TRUE;
}
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 337cb0ad99..9fd6b91446 100644
--- a/widgets/e-timezone-dialog/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -95,7 +95,7 @@ static gboolean on_map_visibility_changed (GtkWidget *w,
GdkEventVisibility *event,
gpointer data);
static gboolean on_map_button_pressed (GtkWidget *w,
- GdkEventButton *event,
+ GdkEvent *button_event,
gpointer data);
static icaltimezone * get_zone_from_point (ETimezoneDialog *etd,
@@ -591,21 +591,26 @@ on_map_visibility_changed (GtkWidget *w,
static gboolean
on_map_button_pressed (GtkWidget *w,
- GdkEventButton *event,
+ GdkEvent *button_event,
gpointer data)
{
ETimezoneDialog *etd;
ETimezoneDialogPrivate *priv;
+ guint event_button = 0;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
gdouble longitude, latitude;
etd = E_TIMEZONE_DIALOG (data);
priv = etd->priv;
+ gdk_event_get_button (button_event, &event_button);
+ gdk_event_get_coords (button_event, &event_x_win, &event_y_win);
+
e_map_window_to_world (
- priv->map, (gdouble) event->x, (gdouble) event->y,
- &longitude, &latitude);
+ priv->map, event_x_win, event_y_win, &longitude, &latitude);
- if (event->button != 1) {
+ if (event_button != 1) {
e_map_zoom_out (priv->map);
} else {
if (e_map_get_magnification (priv->map) <= 1.0)
diff --git a/widgets/misc/e-buffer-tagger.c b/widgets/misc/e-buffer-tagger.c
index 8a0d7ccbc3..b68d414868 100644
--- a/widgets/misc/e-buffer-tagger.c
+++ b/widgets/misc/e-buffer-tagger.c
@@ -466,30 +466,36 @@ update_ctrl_state (GtkTextView *textview,
/* Links can also be activated by clicking. */
static gboolean
textview_event_after (GtkTextView *textview,
- GdkEvent *ev)
+ GdkEvent *event)
{
GtkTextIter start, end, iter;
GtkTextBuffer *buffer;
- GdkEventButton *event;
gint x, y;
GdkModifierType mt = 0;
+ guint event_button = 0;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
g_return_val_if_fail (GTK_IS_TEXT_VIEW (textview), FALSE);
- if (ev->type == GDK_KEY_PRESS || ev->type == GDK_KEY_RELEASE) {
- GdkEventKey *event_key = (GdkEventKey *) ev;
+ if (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE) {
+ guint event_keyval = 0;
- switch (event_key->keyval) {
- case GDK_KEY_Control_L:
- case GDK_KEY_Control_R:
- update_ctrl_state (textview, ev->type == GDK_KEY_PRESS);
- break;
+ gdk_event_get_keyval (event, &event_keyval);
+
+ switch (event_keyval) {
+ case GDK_KEY_Control_L:
+ case GDK_KEY_Control_R:
+ update_ctrl_state (
+ textview,
+ event->type == GDK_KEY_PRESS);
+ break;
}
return FALSE;
}
- if (!gdk_event_get_state (ev, &mt)) {
+ if (!gdk_event_get_state (event, &mt)) {
GdkWindow *window;
GdkDisplay *display;
GdkDeviceManager *device_manager;
@@ -505,12 +511,13 @@ textview_event_after (GtkTextView *textview,
update_ctrl_state (textview, (mt & GDK_CONTROL_MASK) != 0);
- if (ev->type != GDK_BUTTON_RELEASE)
+ if (event->type != GDK_BUTTON_RELEASE)
return FALSE;
- event = (GdkEventButton *) ev;
+ gdk_event_get_button (event, &event_button);
+ gdk_event_get_coords (event, &event_x_win, &event_y_win);
- if (event->button != 1 || (event->state & GDK_CONTROL_MASK) == 0)
+ if (event_button != 1 || (mt & GDK_CONTROL_MASK) == 0)
return FALSE;
buffer = gtk_text_view_get_buffer (textview);
@@ -523,7 +530,7 @@ textview_event_after (GtkTextView *textview,
gtk_text_view_window_to_buffer_coords (
textview,
GTK_TEXT_WINDOW_WIDGET,
- event->x, event->y, &x, &y);
+ event_x_win, event_y_win, &x, &y);
gtk_text_view_get_iter_at_location (textview, &iter, x, y);
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 0f38c7b16a..1b1a72281d 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -188,7 +188,7 @@ static gboolean e_calendar_item_ensure_days_visible
gint end_day,
gboolean emission);
static void e_calendar_item_show_popup_menu (ECalendarItem *calitem,
- GdkEventButton *event,
+ GdkEvent *button_event,
gint month_offset);
static void e_calendar_item_on_menu_item_activate
(GtkWidget *menuitem,
@@ -2253,9 +2253,7 @@ e_calendar_item_button_press (ECalendarItem *calitem,
if (event->button.button == 3 && day == -1
&& e_calendar_item_get_display_popup (calitem)) {
e_calendar_item_show_popup_menu (
- calitem,
- (GdkEventButton *) event,
- month_offset);
+ calitem, event, month_offset);
return TRUE;
}
@@ -3529,13 +3527,15 @@ deactivate_menu_cb (GtkWidget *menu)
static void
e_calendar_item_show_popup_menu (ECalendarItem *calitem,
- GdkEventButton *event,
+ GdkEvent *button_event,
gint month_offset)
{
GtkWidget *menu, *submenu, *menuitem, *label;
gint year, month;
const gchar *name;
gchar buffer[64];
+ guint event_button = 0;
+ guint32 event_time;
menu = gtk_menu_new ();
@@ -3582,10 +3582,13 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem,
menu, "deactivate",
G_CALLBACK (deactivate_menu_cb), NULL);
+ gdk_event_get_button (button_event, &event_button);
+ event_time = gdk_event_get_time (button_event);
+
gtk_menu_popup (
GTK_MENU (menu), NULL, NULL,
e_calendar_item_position_menu, calitem,
- event->button, event->time);
+ event_button, event_time);
}
static void
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 45c4f7148b..e24d4137cb 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -161,7 +161,7 @@ static gint on_date_popup_key_press (GtkWidget *widget,
GdkEventKey *event,
EDateEdit *dedit);
static gint on_date_popup_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
gpointer data);
static void on_date_popup_date_selected (ECalendarItem *calitem,
EDateEdit *dedit);
@@ -1537,7 +1537,7 @@ on_date_popup_key_press (GtkWidget *widget,
* (This function is yanked from gtkcombo.c) */
static gint
on_date_popup_button_press (GtkWidget *widget,
- GdkEventButton *event,
+ GdkEvent *button_event,
gpointer data)
{
EDateEdit *dedit;
@@ -1545,7 +1545,7 @@ on_date_popup_button_press (GtkWidget *widget,
dedit = data;
- child = gtk_get_event_widget ((GdkEvent *) event);
+ child = gtk_get_event_widget (button_event);
/* We don't ask for button press events on the grab widget, so
* if an event is reported directly to the grab widget, it must
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 40fe589a8c..ebccf385d7 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -722,15 +722,18 @@ static gint
e_map_button_press (GtkWidget *widget,
GdkEventButton *event)
{
- if (!gtk_widget_has_focus (widget)) gtk_widget_grab_focus (widget);
- return TRUE;
+ if (!gtk_widget_has_focus (widget))
+ gtk_widget_grab_focus (widget);
+
+ return TRUE;
}
static gint
e_map_button_release (GtkWidget *widget,
GdkEventButton *event)
{
- if (event->button != 1) return FALSE;
+ if (event->button != 1)
+ return FALSE;
gdk_pointer_ungrab (event->time);
return TRUE;
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index 48bf24724d..cc72e90a20 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -95,10 +95,10 @@ static void e_cell_combo_get_popup_pos (ECellCombo *ecc,
static void e_cell_combo_selection_changed (GtkTreeSelection *selection,
ECellCombo *ecc);
static gint e_cell_combo_button_press (GtkWidget *popup_window,
- GdkEvent *event,
+ GdkEvent *button_event,
ECellCombo *ecc);
static gint e_cell_combo_button_release (GtkWidget *popup_window,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECellCombo *ecc);
static gint e_cell_combo_key_press (GtkWidget *popup_window,
GdkEventKey *event,
@@ -575,12 +575,14 @@ e_cell_combo_selection_changed (GtkTreeSelection *selection,
* which we ignore. */
static gint
e_cell_combo_button_press (GtkWidget *popup_window,
- GdkEvent *event,
+ GdkEvent *button_event,
ECellCombo *ecc)
{
GtkWidget *event_widget;
+ guint32 event_time;
- event_widget = gtk_get_event_widget (event);
+ event_time = gdk_event_get_time (button_event);
+ event_widget = gtk_get_event_widget (button_event);
/* If the button press was for a widget inside the popup list, but
* not the popup window itself, then we ignore the event and return
@@ -595,8 +597,8 @@ e_cell_combo_button_press (GtkWidget *popup_window,
}
gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->button.time);
- gdk_keyboard_ungrab (event->button.time);
+ gdk_pointer_ungrab (event_time);
+ gdk_keyboard_ungrab (event_time);
gtk_widget_hide (ecc->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
@@ -618,12 +620,14 @@ e_cell_combo_button_press (GtkWidget *popup_window,
* cell with the new selection. */
static gint
e_cell_combo_button_release (GtkWidget *popup_window,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECellCombo *ecc)
{
GtkWidget *event_widget;
+ guint32 event_time;
- event_widget = gtk_get_event_widget ((GdkEvent *) event);
+ event_time = gdk_event_get_time (button_event);
+ event_widget = gtk_get_event_widget (button_event);
/* See if the button was released in the list (or its children). */
while (event_widget && event_widget != ecc->popup_tree_view)
@@ -636,8 +640,8 @@ e_cell_combo_button_release (GtkWidget *popup_window,
/* The button was released inside the list, so we hide the popup and
* update the cell to reflect the new selection. */
gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->time);
- gdk_keyboard_ungrab (event->time);
+ gdk_pointer_ungrab (event_time);
+ gdk_keyboard_ungrab (event_time);
gtk_widget_hide (ecc->popup_window);
e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index 46f224f315..be834f5686 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -81,7 +81,7 @@ static gint e_cell_date_edit_key_press (GtkWidget *popup_window,
GdkEventKey *event,
ECellDateEdit *ecde);
static gint e_cell_date_edit_button_press (GtkWidget *popup_window,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECellDateEdit *ecde);
static void e_cell_date_edit_on_ok_clicked (GtkWidget *button,
ECellDateEdit *ecde);
@@ -746,15 +746,15 @@ e_cell_date_edit_key_press (GtkWidget *popup_window,
*/
static gint
e_cell_date_edit_button_press (GtkWidget *popup_window,
- GdkEventButton *event,
+ GdkEvent *button_event,
ECellDateEdit *ecde)
{
GtkWidget *event_widget;
- event_widget = gtk_get_event_widget ((GdkEvent *) event);
- if (gtk_widget_get_toplevel (event_widget) != popup_window) {
+ event_widget = gtk_get_event_widget (button_event);
+
+ if (gtk_widget_get_toplevel (event_widget) != popup_window)
e_cell_date_edit_hide_popup (ecde);
- }
return TRUE;
}
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index d8e0665b8e..8bec92fa10 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -1674,7 +1674,7 @@ popup_custom (GtkWidget *menu_item,
static void
ethi_header_context_menu (ETableHeaderItem *ethi,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
EthiHeaderInfo *info = g_new (EthiHeaderInfo, 1);
GtkMenu *popup;
@@ -1682,10 +1682,19 @@ ethi_header_context_menu (ETableHeaderItem *ethi,
GtkWidget *menu_item, *sub_menu;
ETableSortColumn column;
gboolean ascending = TRUE;
+ gdouble event_x_win = 0;
+ gdouble event_y_win = 0;
+ guint event_button = 0;
+ guint32 event_time;
+
d (g_print ("ethi_header_context_menu: \n"));
+ gdk_event_get_button (button_event, &event_button);
+ gdk_event_get_coords (button_event, &event_x_win, &event_y_win);
+ event_time = gdk_event_get_time (button_event);
+
info->ethi = ethi;
- info->col = ethi_find_col_by_x (ethi, event->x);
+ info->col = ethi_find_col_by_x (ethi, event_x_win);
popup = e_popup_menu_create_with_domain (
ethi_context_menu,
@@ -1771,14 +1780,14 @@ ethi_header_context_menu (ETableHeaderItem *ethi,
gtk_menu_popup (
GTK_MENU (popup),
NULL, NULL, NULL, NULL,
- event->button, event->time);
+ event_button, event_time);
}
static void
ethi_button_pressed (ETableHeaderItem *ethi,
- GdkEventButton *event)
+ GdkEvent *button_event)
{
- g_signal_emit (ethi, ethi_signals[BUTTON_PRESSED], 0, event);
+ g_signal_emit (ethi, ethi_signals[BUTTON_PRESSED], 0, button_event);
}
void
@@ -1957,9 +1966,9 @@ ethi_event (GnomeCanvasItem *item,
if (gtk_widget_get_can_focus (GTK_WIDGET (item->canvas)))
e_canvas_item_grab_focus (item, TRUE);
} else if (e->button.button == 3) {
- ethi_header_context_menu (ethi, &e->button);
+ ethi_header_context_menu (ethi, e);
} else
- ethi_button_pressed (ethi, &e->button);
+ ethi_button_pressed (ethi, e);
}
break;
diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h
index be8e10820a..baaa07cacf 100644
--- a/widgets/table/e-table-header-item.h
+++ b/widgets/table/e-table-header-item.h
@@ -131,7 +131,7 @@ struct _ETableHeaderItemClass {
/* Signals */
void (*button_pressed) (ETableHeaderItem *ethi,
- GdkEventButton *button);
+ GdkEvent *button_event);
};
GType e_table_header_item_get_type (void) G_GNUC_CONST;
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index cb97e8e26a..da10bb02f9 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -120,7 +120,9 @@ static void calc_height (EText *text);
static gboolean show_pango_rectangle (EText *text, PangoRectangle rect);
-static void e_text_do_popup (EText *text, GdkEventButton *button, gint position);
+static void e_text_do_popup (EText *text,
+ GdkEvent *event_button,
+ gint position);
static void e_text_update_primary_selection (EText *text);
static void e_text_paste (EText *text, GdkAtom selection);
@@ -1678,13 +1680,12 @@ e_text_event (GnomeCanvasItem *item,
/* Simulate a GdkEventButton here, so that we can
* call e_text_do_popup directly */
- GdkEventButton *button;
+ GdkEvent *button_event;
- button = (GdkEventButton *)
- gdk_event_new (GDK_BUTTON_PRESS);
- button->time = event->key.time;
- button->button = 0;
- e_text_do_popup (text, button, 0);
+ button_event = gdk_event_new (GDK_BUTTON_PRESS);
+ button_event->button.time = event->key.time;
+ button_event->button.button = 0;
+ e_text_do_popup (text, button_event, 0);
return 1;
}
@@ -1748,7 +1749,7 @@ e_text_event (GnomeCanvasItem *item,
if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) {
if (text->handle_popup) {
e_text_do_popup (
- text, &(event->button),
+ text, event,
get_position_from_xy (
text, event->button.x,
event->button.y));
@@ -2006,7 +2007,7 @@ e_text_paste (EText *text,
typedef struct {
EText *text;
- GdkEventButton *button;
+ GdkEvent *event;
gint position;
} PopupClosure;
@@ -2046,10 +2047,15 @@ popup_targets_received (GtkClipboard *clipboard,
{
PopupClosure *closure = user_data;
EText *text = closure->text;
- GdkEventButton *button = closure->button;
+ GdkEvent *event = closure->event;
gint position = closure->position;
GtkWidget *popup_menu = gtk_menu_new ();
GtkWidget *menuitem, *submenu;
+ guint event_button = 0;
+ guint32 event_time;
+
+ gdk_event_get_button (event, &event_button);
+ event_time = gdk_event_get_time (event);
g_free (closure);
@@ -2114,36 +2120,40 @@ popup_targets_received (GtkClipboard *clipboard,
GTK_MENU_SHELL (submenu));
}
- g_signal_emit (text,
- e_text_signals[E_TEXT_POPULATE_POPUP],
- 0,
- button, position,
- popup_menu);
-
- /* If invoked by S-F10 key binding, button will be 0. */
- if (button->button == 0) {
- gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
- popup_menu_placement_cb, (gpointer) text,
- button->button, GDK_CURRENT_TIME);
- } else {
- gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
- NULL, NULL,
- button->button, button->time);
- }
-
- g_object_unref (text);
- gdk_event_free ((GdkEvent *) button);
+ g_signal_emit (
+ text,
+ e_text_signals[E_TEXT_POPULATE_POPUP],
+ 0,
+ event,
+ position,
+ popup_menu);
+
+ /* If invoked by S-F10 key binding, button will be 0. */
+ if (event_button == 0) {
+ gtk_menu_popup (
+ GTK_MENU (popup_menu), NULL, NULL,
+ popup_menu_placement_cb, (gpointer) text,
+ event_button, GDK_CURRENT_TIME);
+ } else {
+ gtk_menu_popup (
+ GTK_MENU (popup_menu), NULL, NULL,
+ NULL, NULL,
+ event_button, event_time);
+ }
+
+ g_object_unref (text);
+ gdk_event_free (event);
}
static void
e_text_do_popup (EText *text,
- GdkEventButton *button,
+ GdkEvent *button_event,
gint position)
{
PopupClosure *closure = g_new (PopupClosure, 1);
closure->text = g_object_ref (text);
- closure->button = (GdkEventButton *) gdk_event_copy ((GdkEvent *) button);
+ closure->event = gdk_event_copy (button_event);
closure->position = position;
gtk_clipboard_request_contents (
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index 17e51eb9b3..b3099f1a64 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -212,7 +212,7 @@ struct _ETextClass {
void (* changed) (EText *text);
void (* activate) (EText *text);
void (* keypress) (EText *text, guint keyval, guint state);
- void (* populate_popup) (EText *text, GdkEventButton *ev, gint pos, GtkMenu *menu);
+ void (* populate_popup) (EText *text, GdkEvent *button_event, gint pos, GtkMenu *menu);
void (* style_set) (EText *text, GtkStyle *previous_style);
};