aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
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 /widgets/table
parent67024e23ee07266a7b9854648454739e1824f91c (diff)
downloadgsoc2013-evolution-d2fb5ee1a86539e49f02c1fe9ea10cf55b0b351a.tar.gz
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 'widgets/table')
-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
4 files changed, 36 insertions, 23 deletions
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;