Пример #1
0
/*!
 * Sets the backbuffer for this surface. The back buffer is not yet on
 * screen and will become live during the next swapBuffers().
 *
 * The backbuffer represents the current state of the surface for the
 * purpose of GUI-thread accessible properties such as size and visibility.
 */
void Surface::setBackBuffer(SurfaceBuffer *buffer)
{
    m_buffer = buffer;

    if (m_buffer) {
        bool valid = m_buffer->waylandBufferHandle() != 0;
        setSize(valid ? m_buffer->size() : QSize());

        m_damage = m_damage.intersected(QRect(QPoint(), m_size));
        emit m_waylandSurface->damaged(m_damage);
    } else {
        InputDevice *inputDevice = m_compositor->defaultInputDevice();
        if (inputDevice->keyboardFocus() == this)
            inputDevice->setKeyboardFocus(0);
        if (inputDevice->mouseFocus() && inputDevice->mouseFocus()->surface() == waylandSurface())
            inputDevice->setMouseFocus(0, QPointF(), QPointF());
    }
    m_damage = QRegion();
}
Пример #2
0
void DataDeviceManager::overrideSelection(const QMimeData &mimeData)
{
    QStringList formats = mimeData.formats();
    if (formats.isEmpty())
        return;

    m_retainedData.clear();
    foreach (const QString &format, formats)
        m_retainedData.setData(format, mimeData.data(format));

    m_compositor->feedRetainedSelectionData(&m_retainedData);

    m_compositorOwnsSelection = true;

    InputDevice *dev = m_compositor->defaultInputDevice();
    Surface *focusSurface = dev->keyboardFocus();
    if (focusSurface)
        offerFromCompositorToClient(
                    dev->dataDevice(focusSurface->base()->resource.client)->dataDeviceResource());
}