Beispiel #1
0
static void popup_grab_motion(struct weston_pointer_grab *grab,  uint32_t time)
{
    struct wl_resource *resource = grab->pointer->focus_resource;
    if (resource) {
        wl_fixed_t sx, sy;
        weston_surface_from_global_fixed(grab->pointer->focus, grab->pointer->x, grab->pointer->y, &sx, &sy);
        wl_pointer_send_motion(resource, time, sx, sy);
    }
}
Beispiel #2
0
void Shell::defaultPointerGrabMotion(weston_pointer_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y)
{
    weston_pointer *pointer = grab->pointer;

    movePointer(pointer, time, x, y);

    wl_list *resource_list = &pointer->focus_resource_list;
    wl_resource *resource;
    wl_resource_for_each(resource, resource_list) {
        wl_fixed_t sx, sy;
        weston_view_from_global_fixed(pointer->focus, pointer->x, pointer->y, &sx, &sy);
        wl_pointer_send_motion(resource, time, sx, sy);
    }
Beispiel #3
0
static void
default_grab_motion(struct weston_pointer_grab *grab, uint32_t time)
{
	struct weston_pointer *pointer = grab->pointer;
	wl_fixed_t sx, sy;
	struct wl_list *resource_list;
	struct wl_resource *resource;

	resource_list = &pointer->focus_resource_list;
	wl_resource_for_each(resource, resource_list) {
		weston_surface_from_global_fixed(pointer->focus,
						 pointer->x, pointer->y,
						 &sx, &sy);
		wl_pointer_send_motion(resource, time, sx, sy);
	}
/*!
 * Sets the current mouse focus to \a view and sends a mouse move event to it with the
 * local position \a localPos and output space position \a outputSpacePos.
 */
void QWaylandPointer::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos)
{
    Q_D(QWaylandPointer);
    if (view && (!view->surface() || view->surface()->isCursorSurface()))
        view = Q_NULLPTR;
    d->seat->setMouseFocus(view);
    d->localPosition = localPos;
    d->spacePosition = outputSpacePos;

    //we adjust if the mouse position is on the edge
    //to work around Qt's event propagation
    if (view && view->surface()) {
        QSizeF size(view->surface()->size());
        if (d->localPosition.x() ==  size.width())
            d->localPosition.rx() -= 0.01;

        if (d->localPosition.y() == size.height())
            d->localPosition.ry() -= 0.01;
    }

    QWaylandPointerPrivate::Resource *resource = view ? d->resourceMap().value(view->surface()->waylandClient()) : 0;
    if (resource && !d->hasSentEnter) {
        uint32_t serial = d->compositor()->nextSerial();
        QWaylandKeyboard *keyboard = d->seat->keyboard();
        if (keyboard) {
            keyboard->sendKeyModifiers(view->surface()->client(), serial);
        }
        d->send_enter(resource->handle, serial, view->surface()->resource(),
                   wl_fixed_from_double(d->localPosition.x()), wl_fixed_from_double(d->localPosition.y()));

        d->focusDestroyListener.listenForDestruction(view->surface()->resource());
        d->hasSentEnter = true;
    }

    d->focusResource = resource ? resource->handle : 0;

    if (view && view->output())
        setOutput(view->output());

    uint32_t time = d->compositor()->currentTimeMsecs();

    if (d->focusResource) {
        wl_fixed_t x = wl_fixed_from_double(currentLocalPosition().x());
        wl_fixed_t y = wl_fixed_from_double(currentLocalPosition().y());
        wl_pointer_send_motion(d->focusResource, time, x, y);
    }
}
Beispiel #5
0
void
meta_wayland_pointer_send_motion (MetaWaylandPointer *pointer,
                                  const ClutterEvent *event)
{
  struct wl_resource *resource;
  struct wl_list *l;

  l = &pointer->focus_resource_list;
  wl_resource_for_each(resource, l)
    {
      wl_fixed_t sx, sy;

      meta_wayland_pointer_get_relative_coordinates (pointer,
                                                     pointer->focus_surface,
                                                     &sx, &sy);
      wl_pointer_send_motion (resource, clutter_event_get_time (event), sx, sy);
    }