summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/testgrid.c13
-rw-r--r--tests/testiconview.c24
-rw-r--r--tests/testtreepos.c10
3 files changed, 25 insertions, 22 deletions
diff --git a/tests/testgrid.c b/tests/testgrid.c
index afd3f12112..67270d76b9 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -32,13 +32,16 @@ test_widget (const gchar *label, const gchar *color)
static GtkOrientation o;
static gboolean
-toggle_orientation (GtkWidget *window, GdkEventButton *event, GtkGrid *grid)
+toggle_orientation (GtkWidget *window, GdkEvent *event, GtkGrid *grid)
{
- o = 1 - o;
+ if (gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
+ {
+ o = 1 - o;
- gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), o);
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (grid), o);
+ }
- return FALSE;
+ return GDK_EVENT_PROPAGATE;
}
static void
@@ -52,7 +55,7 @@ simple_grid (void)
gtk_window_set_title (GTK_WINDOW (window), "Orientation");
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
- g_signal_connect (window, "button-press-event", G_CALLBACK (toggle_orientation), grid);
+ g_signal_connect (window, "event", G_CALLBACK (toggle_orientation), grid);
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
diff --git a/tests/testiconview.c b/tests/testiconview.c
index 2265c0be8c..693e0a557d 100644
--- a/tests/testiconview.c
+++ b/tests/testiconview.c
@@ -329,10 +329,10 @@ item_cb (GtkWidget *menuitem,
}
static void
-do_popup_menu (GtkWidget *icon_list,
- GdkEventButton *event)
+do_popup_menu (GtkWidget *icon_list,
+ GdkEvent *event)
{
- GtkIconView *icon_view = GTK_ICON_VIEW (icon_list);
+ GtkIconView *icon_view = GTK_ICON_VIEW (icon_list);
GtkWidget *menu;
GtkWidget *menuitem;
GtkTreePath *path = NULL;
@@ -344,7 +344,7 @@ do_popup_menu (GtkWidget *icon_list,
{
double x, y;
- gdk_event_get_coords ((GdkEvent *)event, &x, &y);
+ gdk_event_get_coords (event, &x, &y);
path = gtk_icon_view_get_path_at_pos (icon_view, x, y);
}
else
@@ -375,8 +375,8 @@ do_popup_menu (GtkWidget *icon_list,
if (event)
{
- gdk_event_get_button ((GdkEvent*)event, &button);
- event_time = gdk_event_get_time ((GdkEvent *)event);
+ gdk_event_get_button (event, &button);
+ event_time = gdk_event_get_time (event);
}
else
{
@@ -390,12 +390,12 @@ do_popup_menu (GtkWidget *icon_list,
static gboolean
-button_press_event_handler (GtkWidget *widget,
- GdkEventButton *event)
+event_handler (GtkWidget *widget,
+ GdkEvent *event)
{
/* Ignore double-clicks and triple-clicks */
- if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
- gdk_event_get_event_type ((GdkEvent*)event) == GDK_BUTTON_PRESS)
+ if (gdk_event_triggers_context_menu (event) &&
+ gdk_event_get_event_type (event) == GDK_BUTTON_PRESS)
{
do_popup_menu (widget, event);
return TRUE;
@@ -454,8 +454,8 @@ main (gint argc, gchar **argv)
tvc = gtk_tree_view_column_new ();
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), tvc);
- g_signal_connect_after (icon_list, "button_press_event",
- G_CALLBACK (button_press_event_handler), NULL);
+ g_signal_connect_after (icon_list, "event",
+ G_CALLBACK (event_handler), NULL);
g_signal_connect (icon_list, "selection_changed",
G_CALLBACK (selection_changed), NULL);
g_signal_connect (icon_list, "popup_menu",
diff --git a/tests/testtreepos.c b/tests/testtreepos.c
index 88af5e8bd3..49b2324718 100644
--- a/tests/testtreepos.c
+++ b/tests/testtreepos.c
@@ -53,16 +53,16 @@ clicked_icon (GtkTreeView *tv,
}
static gboolean
-release_event (GtkTreeView *tv,
- GdkEventButton *event)
+release_event (GtkTreeView *tv,
+ GdkEvent *event)
{
GtkTreePath *path;
gdouble x, y;
- if (gdk_event_get_event_type ((GdkEvent *)event) != GDK_BUTTON_RELEASE)
+ if (gdk_event_get_event_type (event) != GDK_BUTTON_RELEASE)
return TRUE;
- gdk_event_get_coords ((GdkEvent *)event, &x, &y);
+ gdk_event_get_coords (event, &x, &y);
if (clicked_icon (tv, x, y, &path))
{
GtkTreeModel *model;
@@ -131,7 +131,7 @@ int main (int argc, char *argv[])
gtk_tree_view_set_model (GTK_TREE_VIEW (tv), GTK_TREE_MODEL (store));
- g_signal_connect (tv, "button-release-event",
+ g_signal_connect (tv, "event",
G_CALLBACK (release_event), NULL);
gtk_widget_show (window);