forked from AuroraMiddleware/gtk
Merge branch 'gtk-fix-gesture-get-center' into 'master'
gtkgesture: Fix gtk_gesture_get_bounding_box_center() for touchpads Closes #2316 See merge request GNOME/gtk!1257
This commit is contained in:
commit
23f84e3a3d
@ -94,9 +94,12 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
cairo_pattern_t *pat;
|
||||
cairo_matrix_t matrix;
|
||||
gdouble angle, scale;
|
||||
gdouble x_center, y_center;
|
||||
|
||||
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
|
||||
|
||||
cairo_get_matrix (cr, &matrix);
|
||||
cairo_matrix_translate (&matrix, width / 2, height / 2);
|
||||
cairo_matrix_translate (&matrix, x_center, y_center);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
|
@ -1335,12 +1335,19 @@ gtk_gesture_get_bounding_box_center (GtkGesture *gesture,
|
||||
gdouble *x,
|
||||
gdouble *y)
|
||||
{
|
||||
const GdkEvent *last_event;
|
||||
GdkRectangle rect;
|
||||
GdkEventSequence *sequence;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
|
||||
g_return_val_if_fail (x != NULL && y != NULL, FALSE);
|
||||
|
||||
if (!gtk_gesture_get_bounding_box (gesture, &rect))
|
||||
sequence = gtk_gesture_get_last_updated_sequence (gesture);
|
||||
last_event = gtk_gesture_get_last_event (gesture, sequence);
|
||||
|
||||
if (EVENT_IS_TOUCHPAD_GESTURE (last_event))
|
||||
return gtk_gesture_get_point (gesture, sequence, x, y);
|
||||
else if (!gtk_gesture_get_bounding_box (gesture, &rect))
|
||||
return FALSE;
|
||||
|
||||
*x = rect.x + rect.width / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user