&& xv_total_y == 0.0));
else
xwidget_motion_notify (xv, xev->event_x, xev->event_y,
- state, xev->time);
+ xev->root_x, xev->root_y, state,
+ xev->time);
goto XI_OTHER;
}
if (!device || !device->master_p)
goto XI_OTHER;
+#ifdef HAVE_XWIDGETS
+ struct xwidget_view *xvw = xwidget_view_from_window (pev->event);
+
+ if (xvw)
+ {
+ *finish = X_EVENT_DROP;
+ xwidget_pinch (xvw, pev);
+ goto XI_OTHER;
+ }
+#endif
+
any = x_any_window_to_frame (dpyinfo, pev->event);
if (any)
{
goto XI_OTHER;
}
case XI_GesturePinchEnd:
- *finish = X_EVENT_DROP;
- goto XI_OTHER;
+ {
+#if defined HAVE_XWIDGETS && HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+ XIGesturePinchEvent *pev = (XIGesturePinchEvent *) xi_event;
+ struct xwidget_view *xvw = xwidget_view_from_window (pev->event);
+
+ if (xvw)
+ xwidget_pinch (xvw, pev);
+#endif
+ *finish = X_EVENT_DROP;
+ goto XI_OTHER;
+ }
#endif
default:
goto XI_OTHER;
#ifdef HAVE_XINPUT2
void
xwidget_motion_notify (struct xwidget_view *view,
- double x, double y, uint state, Time time)
+ double x, double y,
+ double root_x, double root_y,
+ uint state, Time time)
{
GdkEvent *xg_event;
GtkWidget *target;
xg_event->any.window = gtk_widget_get_window (target);
xg_event->motion.x = target_x;
xg_event->motion.y = target_y;
- xg_event->motion.x_root = lrint (x);
- xg_event->motion.y_root = lrint (y);
+ xg_event->motion.x_root = root_x;
+ xg_event->motion.y_root = root_y;
xg_event->motion.time = time;
xg_event->motion.state = state;
xg_event->motion.device = find_suitable_pointer (view->frame);
gtk_main_do_event (xg_event);
gdk_event_free (xg_event);
}
+
+#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+void
+xwidget_pinch (struct xwidget_view *view, XIGesturePinchEvent *xev)
+{
+#if GTK_CHECK_VERSION (3, 18, 0)
+ GdkEvent *xg_event;
+ GtkWidget *target;
+ struct xwidget *model = XXWIDGET (view->model);
+ int target_x, target_y;
+ double x = xev->event_x;
+ double y = xev->event_y;
+
+ if (NILP (model->buffer))
+ return;
+
+ record_osr_embedder (view);
+
+ target = find_widget_at_pos (model->widgetwindow_osr,
+ lrint (x + view->clip_left),
+ lrint (y + view->clip_top),
+ &target_x, &target_y);
+
+ if (!target)
+ {
+ target_x = lrint (x);
+ target_y = lrint (y);
+ target = model->widget_osr;
+ }
+
+ xg_event = gdk_event_new (GDK_TOUCHPAD_PINCH);
+ xg_event->any.window = gtk_widget_get_window (target);
+ xg_event->touchpad_pinch.x = target_x;
+ xg_event->touchpad_pinch.y = target_y;
+ xg_event->touchpad_pinch.dx = xev->delta_x;
+ xg_event->touchpad_pinch.dy = xev->delta_y;
+ xg_event->touchpad_pinch.angle_delta = xev->delta_angle;
+ xg_event->touchpad_pinch.scale = xev->scale;
+ xg_event->touchpad_pinch.x_root = xev->root_x;
+ xg_event->touchpad_pinch.y_root = xev->root_y;
+ xg_event->touchpad_pinch.state = xev->mods.effective;
+ xg_event->touchpad_pinch.n_fingers = 2;
+
+ switch (xev->evtype)
+ {
+ case XI_GesturePinchBegin:
+ xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_BEGIN;
+ break;
+ case XI_GesturePinchUpdate:
+ xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_UPDATE;
+ break;
+ case XI_GesturePinchEnd:
+ xg_event->touchpad_pinch.phase = GDK_TOUCHPAD_GESTURE_PHASE_END;
+ break;
+ }
+
+ gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
+
+ g_object_ref (xg_event->any.window);
+ gtk_main_do_event (xg_event);
+ gdk_event_free (xg_event);
+#endif
+}
+#endif
#endif
#ifdef HAVE_XINPUT2
XISetMask (m, XI_ButtonRelease);
XISetMask (m, XI_Enter);
XISetMask (m, XI_Leave);
+#ifdef XI_GesturePinchBegin
+ XISetMask (m, XI_GesturePinchBegin);
+ XISetMask (m, XI_GesturePinchUpdate);
+ XISetMask (m, XI_GesturePinchEnd);
+#endif
XISelectEvents (xv->dpy, xv->wdesc, &mask, 1);
}
#endif
#import "nsxwidget.h"
#endif
+#ifdef HAVE_XINPUT2
+#include <X11/extensions/XInput2.h>
+#endif
+
struct xwidget
{
union vectorlike_header header;
const XEvent *);
#ifdef HAVE_XINPUT2
extern void xwidget_motion_notify (struct xwidget_view *, double,
- double, uint, Time);
+ double, double, double, uint, Time);
extern void xwidget_scroll (struct xwidget_view *, double, double,
double, double, uint, Time, bool);
+#ifdef HAVE_USABLE_XI_GESTURE_PINCH_EVENT
+extern void xwidget_pinch (struct xwidget_view *, XIGesturePinchEvent *);
+#endif
#endif
#endif
#else