struct ::wl_resource *LibHybrisEglServerBuffer::resourceForClient(struct ::wl_client *client)
{
    QMultiMap<struct ::wl_client *, Resource *>::iterator it = resourceMap().find(client);
    if (it == resourceMap().end()) {
        QMultiMap<struct ::wl_client *, QtWaylandServer::qt_libhybris_egl_server_buffer::Resource *>::iterator egl_it = m_integration->resourceMap().find(client);
        if (egl_it == m_integration->resourceMap().end()) {
            qWarning("LibHybrisEglServerBuffer::resourceForClient: Trying to get resource for ServerBuffer. But client is not bound to the libhybris_egl interface");
            return 0;
        }
        struct ::wl_resource *egl_resource = (*egl_it)->handle;
        Resource *resource = add(client, 1, 1);
        wl_resource *bufRes = wl_client_new_object(client, &qt_libhybris_buffer_interface, 0, 0);

        m_integration->send_server_buffer_created(egl_resource, resource->handle, bufRes, m_fds.size(), QByteArray((char *)m_ints.data(), m_ints.size() * sizeof(int32_t)),
                                    m_name, m_size.width(), m_size.height(), m_stride, m_format);

        m_qtbuffers.insert(resource, bufRes);

        for (int i = 0; i < m_fds.size(); ++i) {
            send_add_fd(resource->handle, m_fds.at(i));
        }

        return bufRes;
    }
    return m_qtbuffers.value(*it);
}
struct ::wl_resource *DrmEglServerBuffer::resourceForClient(struct ::wl_client *client)
{
    QMultiMap<struct ::wl_client *, Resource *>::iterator it = resourceMap().find(client);
    if (it == resourceMap().end()) {
        QMultiMap<struct ::wl_client *, QtWaylandServer::qt_drm_egl_server_buffer::Resource *>::iterator drm_egl_it = m_integration->resourceMap().find(client);
        if (drm_egl_it == m_integration->resourceMap().end()) {
            qWarning("DrmEglServerBuffer::resourceForClient: Trying to get resource for ServerBuffer. But client is not bound to the drm_egl interface");
            return 0;
        }
        struct ::wl_resource *drm_egl_resource = (*drm_egl_it)->handle;
        Resource *resource = add(client, 1, 1);
        m_integration->send_server_buffer_created(drm_egl_resource, resource->handle, m_name, m_size.width(), m_size.height(), m_stride, m_drm_format);
        return resource->handle;
    }
    return (*it)->handle;
}
Exemplo n.º 3
0
void Touch::setFocus(Surface *surface)
{
    wl_list_remove(&m_focusDestroyListener.listener.link);
    wl_list_init(&m_focusDestroyListener.listener.link);
    if (surface)
        wl_signal_add(&surface->resource()->handle->destroy_signal, &m_focusDestroyListener.listener);

    m_focus = surface;
    m_focusResource = surface ? resourceMap().value(surface->resource()->client()) : 0;
}
Exemplo n.º 4
0
void QWaylandKeyboardPrivate::updateKeymap()
{
    // There must be no keys pressed when changing the keymap,
    // see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
    if (!pendingKeymap || !keys.isEmpty())
        return;

    pendingKeymap = false;
#ifndef QT_NO_WAYLAND_XKB
    if (!xkb_context)
        return;

    createXKBKeymap();
    foreach (Resource *res, resourceMap()) {
        send_keymap(res->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymap_fd, keymap_size);
    }
Exemplo n.º 5
0
void Pointer::setFocus(Surface *surface, const QPoint &pos)
{
    if (m_focusResource && m_focus != surface) {
        uint32_t serial = m_compositor->nextSerial();
        send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
    }

    Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;

    if (resource && (m_focus != surface || resource != m_focusResource)) {
        uint32_t serial = m_compositor->nextSerial();
        send_enter(resource->handle, serial, surface->resource()->handle,
                   wl_fixed_from_int(pos.x()), wl_fixed_from_int(pos.y()));
    }

    m_focusResource = resource;
    m_focus = surface;
}
Exemplo n.º 6
0
void Keyboard::setFocus(Surface *surface)
{
    if (m_focusResource && m_focus != surface) {
        uint32_t serial = m_compositor->nextSerial();
        send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
    }

    Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;

    if (resource && (m_focus != surface || m_focusResource != resource)) {
        uint32_t serial = m_compositor->nextSerial();
        send_modifiers(resource->handle, serial, 0, 0, 0, 0);
        send_enter(resource->handle, serial, surface->resource()->handle, QByteArray());
    }

    m_focusResource = resource;
    m_focus = surface;
}
Exemplo n.º 7
0
void QWaylandKeyboardPrivate::focused(QWaylandSurface *surface)
{
    if (surface && surface->isCursorSurface())
        surface = Q_NULLPTR;
    if (focus != surface) {
        if (focusResource) {
            uint32_t serial = compositor()->nextSerial();
            send_leave(focusResource->handle, serial, focus->resource());
        }
        focusDestroyListener.reset();
        if (surface)
            focusDestroyListener.listenForDestruction(surface->resource());
    }

    Resource *resource = surface ? resourceMap().value(surface->waylandClient()) : 0;

    if (resource && (focus != surface || focusResource != resource))
        sendEnter(surface, resource);

    focusResource = resource;
    focus = surface;
    Q_EMIT q_func()->focusChanged(focus);
}
Exemplo n.º 8
0
void Touch::setFocus(Surface *surface)
{
    m_focus = surface;
    m_focusResource = surface ? resourceMap().value(surface->resource()->client()) : 0;
}