489
489
return (x >= ax && x < ax + alloc.width && y >= ay && y < ay + alloc.height);
493
static void process_gesture (void *cookie,
494
GeisGestureType type,
497
GeisGestureAttr *attrs,
498
GripTimeType time_type)
500
GripGestureRegistration *reg = (GripGestureRegistration *)cookie;
503
for (l = reg->bindings; l != NULL; l = l->next)
505
GripGestureBinding *binding = (GripGestureBinding *)l->data;
507
if (binding->type == type)
509
GripGestureEvent *event = grip_gesture_event_new (type);
511
if (type == GRIP_GESTURE_DRAG)
513
GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
517
drag->fingers = drag_gesture_handle_properties (drag,
521
if (drag->fingers == binding->touches)
523
if (matches_widget (binding->widget,
524
gtk_widget_get_window(GTK_WIDGET (reg->window)),
526
(gint)drag->focus_y))
528
binding->callback (binding->widget,
535
else if (type == GRIP_GESTURE_PINCH)
537
GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
541
pinch->fingers = pinch_gesture_handle_properties (pinch,
545
if (pinch->fingers == binding->touches)
547
if (matches_widget (binding->widget,
548
gtk_widget_get_window(GTK_WIDGET(reg->window)),
549
(gint)pinch->focus_x,
550
(gint)pinch->focus_y))
552
binding->callback (binding->widget,
559
else if (type == GRIP_GESTURE_ROTATE)
561
GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
565
rotate->fingers = rotate_gesture_handle_properties (rotate,
569
if (rotate->fingers == binding->touches)
571
if (matches_widget (binding->widget,
572
gtk_widget_get_window(GTK_WIDGET (reg->window)),
573
(gint)rotate->focus_x,
574
(gint)rotate->focus_y))
576
binding->callback (binding->widget,
583
else if (type == GRIP_GESTURE_TAP)
585
GripEventGestureTap *tap = (GripEventGestureTap *)event;
589
tap->fingers = tap_gesture_handle_properties (tap,
593
if (tap->fingers == binding->touches)
595
if (matches_widget (binding->widget,
596
gtk_widget_get_window(GTK_WIDGET (reg->window)),
600
binding->callback (binding->widget,
608
grip_gesture_event_free (event);
493
614
gesture_start (void *cookie,
494
615
GeisGestureType type,
496
617
GeisSize attr_count,
497
618
GeisGestureAttr *attrs)
499
GripGestureRegistration *reg = (GripGestureRegistration *)cookie;
502
for (l = reg->bindings; l != NULL; l = l->next)
504
GripGestureBinding *binding = (GripGestureBinding *)l->data;
506
if (binding->type == type)
508
GripGestureEvent *event = grip_gesture_event_new (type);
510
if (type == GRIP_GESTURE_DRAG)
512
GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
516
drag->fingers = drag_gesture_handle_properties (drag,
520
if (drag->fingers == binding->touches)
522
if (matches_widget (binding->widget,
523
gtk_widget_get_window(GTK_WIDGET (reg->window)),
525
(gint)drag->focus_y))
527
binding->callback (binding->widget,
534
else if (type == GRIP_GESTURE_PINCH)
536
GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
540
pinch->fingers = pinch_gesture_handle_properties (pinch,
544
if (pinch->fingers == binding->touches)
546
if (matches_widget (binding->widget,
547
gtk_widget_get_window(GTK_WIDGET(reg->window)),
548
(gint)pinch->focus_x,
549
(gint)pinch->focus_y))
551
binding->callback (binding->widget,
558
else if (type == GRIP_GESTURE_ROTATE)
560
GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
564
rotate->fingers = rotate_gesture_handle_properties (rotate,
568
if (rotate->fingers == binding->touches)
570
if (matches_widget (binding->widget,
571
gtk_widget_get_window(GTK_WIDGET (reg->window)),
572
(gint)rotate->focus_x,
573
(gint)rotate->focus_y))
575
binding->callback (binding->widget,
582
else if (type == GRIP_GESTURE_TAP)
584
GripEventGestureTap *tap = (GripEventGestureTap *)event;
588
tap->fingers = tap_gesture_handle_properties (tap,
592
if (tap->fingers == binding->touches)
594
if (matches_widget (binding->widget,
595
gtk_widget_get_window(GTK_WIDGET (reg->window)),
599
binding->callback (binding->widget,
607
grip_gesture_event_free (event);
620
process_gesture(cookie, type, id, attr_count, attrs, GRIP_TIME_START);
616
627
GeisSize attr_count,
617
628
GeisGestureAttr *attrs)
619
GripGestureRegistration *reg = (GripGestureRegistration *)cookie;
622
for (l = reg->bindings; l != NULL; l = l->next)
624
GripGestureBinding *binding = (GripGestureBinding *)l->data;
626
if (binding->type == type)
628
GripGestureEvent *event = grip_gesture_event_new (type);
630
if (type == GRIP_GESTURE_DRAG)
632
GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
636
drag->fingers = drag_gesture_handle_properties (drag,
640
if (drag->fingers == binding->touches)
642
if (matches_widget (binding->widget,
643
gtk_widget_get_window(GTK_WIDGET (reg->window)),
645
(gint)drag->focus_y))
647
binding->callback (binding->widget,
654
else if (type == GRIP_GESTURE_PINCH)
656
GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
660
pinch->fingers = pinch_gesture_handle_properties (pinch,
664
if (pinch->fingers == binding->touches)
666
if (matches_widget (binding->widget,
667
gtk_widget_get_window(GTK_WIDGET (reg->window)),
668
(gint)pinch->focus_x,
669
(gint)pinch->focus_y))
671
binding->callback (binding->widget,
678
else if (type == GRIP_GESTURE_ROTATE)
680
GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
684
rotate->fingers = rotate_gesture_handle_properties (rotate,
688
if (rotate->fingers == binding->touches)
690
if (matches_widget (binding->widget,
691
gtk_widget_get_window(GTK_WIDGET (reg->window)),
692
(gint)rotate->focus_x,
693
(gint)rotate->focus_y))
695
binding->callback (binding->widget,
702
else if (type == GRIP_GESTURE_TAP)
704
GripEventGestureTap *tap = (GripEventGestureTap *)event;
708
tap->fingers = tap_gesture_handle_properties (tap,
712
if (tap->fingers == binding->touches)
714
if (matches_widget (binding->widget,
715
gtk_widget_get_window(GTK_WIDGET (reg->window)),
719
binding->callback (binding->widget,
727
grip_gesture_event_free (event);
630
process_gesture(cookie, type, id, attr_count, attrs, GRIP_TIME_UPDATE);
736
637
GeisSize attr_count,
737
638
GeisGestureAttr *attrs)
739
GripGestureRegistration *reg = (GripGestureRegistration *)cookie;
742
for (l = reg->bindings; l != NULL; l = l->next)
744
GripGestureBinding *binding = (GripGestureBinding *)l->data;
746
if (binding->type == type)
748
GripGestureEvent *event = grip_gesture_event_new (type);
750
if (type == GRIP_GESTURE_DRAG)
752
GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
756
drag->fingers = drag_gesture_handle_properties (drag,
760
if (drag->fingers == binding->touches)
762
if (matches_widget (binding->widget,
763
gtk_widget_get_window(GTK_WIDGET (reg->window)),
765
(gint)drag->focus_y))
767
binding->callback (binding->widget,
774
else if (type == GRIP_GESTURE_PINCH)
776
GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
780
pinch->fingers = pinch_gesture_handle_properties (pinch,
784
if (pinch->fingers == binding->touches)
786
if (matches_widget (binding->widget,
787
gtk_widget_get_window(GTK_WIDGET (reg->window)),
788
(gint)pinch->focus_x,
789
(gint)pinch->focus_y))
791
binding->callback (binding->widget,
798
else if (type == GRIP_GESTURE_ROTATE)
800
GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
804
rotate->fingers = rotate_gesture_handle_properties (rotate,
808
if (rotate->fingers == binding->touches)
810
if (matches_widget (binding->widget,
811
gtk_widget_get_window(GTK_WIDGET (reg->window)),
812
(gint)rotate->focus_x,
813
(gint)rotate->focus_y))
815
binding->callback (binding->widget,
822
else if (type == GRIP_GESTURE_TAP)
824
GripEventGestureTap *tap = (GripEventGestureTap *)event;
828
tap->fingers = tap_gesture_handle_properties (tap,
832
if (tap->fingers == binding->touches)
834
if (matches_widget (binding->widget,
835
gtk_widget_get_window(GTK_WIDGET (reg->window)),
839
binding->callback (binding->widget,
847
grip_gesture_event_free (event);
640
process_gesture(cookie, type, id, attr_count, attrs, GRIP_TIME_END);