Hello everyone,
I am trying to catch the gtk "rotate" and "zoom" gestures. I wrote a small program just to test how they work in gtk. However both callback functions for "zoom" and "rotate" gesture are getting called even if I make only one type of gesture, but this shouldn't be correct, Could anyone please explain me what am I missing here ?Thank you very much
#include <gtk/gtk.h>
static void
zoom_gesture_update(GtkGestureZoom* gesture,GdkEventSequence *sequence,GtkWidget* window)
{
static int i=1;
g_print("\nzoom gesture update %d",i);
i++;
}
static void
rotate_gesture_update(GtkGestureRotate* gesture, GdkEventSequence *sequence, GtkWidget* window)
{
static int i=1;
g_print("\nrotate_gesture_update %d",i);
++i;
}
int
main (int argc,
char **argv)
{
GtkWidget *window;
gtk_init(&argc,&argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
GtkGesture* gesture_zoom = gtk_gesture_zoom_new(window);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture_zoom), GTK_PHASE_BUBBLE);
g_signal_connect(gesture_zoom,"update",G_CALLBACK(zoom_gesture_update),window);
GtkGesture* gesture_rotate = gtk_gesture_rotate_new(window);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture_rotate), GTK_PHASE_BUBBLE);
g_signal_connect(gesture_rotate,"update",G_CALLBACK(rotate_gesture_update),window);
gtk_widget_show_all (window);
gtk_main();
}
#include <gtk/gtk.h>
static void
zoom_gesture_update(GtkGestureZoom* gesture,GdkEventSequence *sequence,GtkWidget* window)
{
static int i=1;
g_print("\nzoom gesture update %d",i);
i++;
}
static void
rotate_gesture_update(GtkGestureRotate* gesture, GdkEventSequence *sequence, GtkWidget* window)
{
static int i=1;
g_print("\nrotate_gesture_update %d",i);
++i;
}
int
main (int argc,
char **argv)
{
GtkWidget *window;
gtk_init(&argc,&argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
GtkGesture* gesture_zoom = gtk_gesture_zoom_new(window);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture_zoom), GTK_PHASE_BUBBLE);
g_signal_connect(gesture_zoom,"update",G_CALLBACK(zoom_gesture_update),window);
GtkGesture* gesture_rotate = gtk_gesture_rotate_new(window);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture_rotate), GTK_PHASE_BUBBLE);
g_signal_connect(gesture_rotate,"update",G_CALLBACK(rotate_gesture_update),window);
gtk_widget_show_all (window);
gtk_main();
}
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list