当前位置: 首页>>代码示例>>C++>>正文


C++ QWaylandSurface类代码示例

本文整理汇总了C++中QWaylandSurface的典型用法代码示例。如果您正苦于以下问题:C++ QWaylandSurface类的具体用法?C++ QWaylandSurface怎么用?C++ QWaylandSurface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QWaylandSurface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onXdgToplevelCreated

void Compositor::onXdgToplevelCreated(QWaylandXdgToplevel *toplevel, QWaylandXdgSurface *shellSurface)
//void Compositor::onXdgSurfaceCreated(QWaylandXdgSurface *shellSurface)
{
    unsigned int windowId = mNextWindowId++;
    QWaylandSurface *surface = shellSurface->surface();

    qDebug() << Q_FUNC_INFO << "windowId" << windowId << surface;

    QQuickWindow *defaultOutputWindow = static_cast<QQuickWindow*>(defaultOutput()->window());
    CompositorWindow *window = new CompositorWindow(windowId, defaultOutputWindow->contentItem());

    window->setOutput(defaultOutput()); //useful ?
    window->setFlag(QQuickItem::ItemIsFocusScope, true);
    // window->setUseTextureAlpha(true);

    window->initialize(shellSurface);
    window->setSize(surface->size());
    window->setTouchEventsEnabled(true);

    mWindows.insert(windowId, window);

    connect(window, &CompositorWindow::readyChanged, this, &Compositor::windowIsReady);
    connect(window, &QWaylandQuickItem::surfaceDestroyed, this, &Compositor::onSurfaceDestroyed);

    window->sendWindowIdToClient();
}
开发者ID:webOS-ports,项目名称:luna-next,代码行数:26,代码来源:compositor.cpp

示例2: if

void QtWaylandMotorcarCompositor::surfaceMapped()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());

    std::cout << "mapped surface: " << surface << std::endl;

    QPoint pos;
    //if (!m_surfaces.contains(surface)) {

    //surface->setPos(QPoint(0, 0));
    if (surface->hasShellSurface()) {

        motorcar::WaylandSurface::SurfaceType surfaceType;

        int type = static_cast<int>(surface->windowType());
        float popupZOffset = 0.05;


        if(type == QWaylandSurface::WindowType::Toplevel) {
            surfaceType = motorcar::WaylandSurface::SurfaceType::TOPLEVEL;
        } else if(type == QWaylandSurface::WindowType::Popup) {
            surfaceType = motorcar::WaylandSurface::SurfaceType::POPUP;
        } else if(type == QWaylandSurface::WindowType::Transient) {
            surfaceType = motorcar::WaylandSurface::SurfaceType::TRANSIENT;
        } else {
            surfaceType = motorcar::WaylandSurface::SurfaceType::NA;
        }

        QtWaylandMotorcarSurface *motorsurface = this->getMotorcarSurface(surface);
        if(motorsurface == NULL) {
            //if it is not present for some weird reason just go ahead and create it for good measure
            std::cout << "Warning: qwaylandsurface was mapped but motorcar surface does not exist yet, creating now" <<std::endl;
//                surfaceCreated(surface);
//                surfaceNode = this->getSurfaceNode(surface);
            motorsurface = new QtWaylandMotorcarSurface(surface, this, motorcar::WaylandSurface::SurfaceType::NA);

            m_surfaceMap.insert(std::pair<QWaylandSurface *, QtWaylandMotorcarSurface *>(surface, motorsurface));

        }
//            if((motorsurface->type() == motorcar::WaylandSurface::SurfaceType::CUBOID ||
//                motorsurface->type() == motorcar::WaylandSurface::SurfaceType::PORTAL)
//                 && surfaceType == motorcar::WaylandSurface::SurfaceType::TOPLEVEL){
//                std::cout << "Warning: ignoring request to remap a 3D surface to a top level surface " <<std::endl;
//            }else{
        this->scene()->windowManager()->mapSurface(motorsurface, surfaceType);
//            }





        //defaultInputDevice()->setKeyboardFocus(surface);

    }




    //m_renderScheduler.start(0);
}
开发者ID:rbarraud,项目名称:motorcar,代码行数:60,代码来源:qtwaylandmotorcarcompositor.cpp

示例3: onSurfaceMappedChanged

void Compositor::onSurfaceMappedChanged()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
    CompositorWindow *window = surfaceWindow(surface);
    if(window && surface) {
        if(surface->hasContent()) {
            qDebug() << __PRETTY_FUNCTION__ << " MAPPED " << window << "appId" << window->appId() << "windowType" << window->windowType();

            // If it was a window created by QtWebProcess, it may be not already in our WindowModel list
            if (!WindowModel::isWindowAlreadyAdded(mWindowModels, window)) {
                qDebug() << Q_FUNC_INFO << "Adding window" << window << "to our models";
                emit windowAdded(QVariant::fromValue(static_cast<QQuickItem*>(window)));
                WindowModel::addWindowForEachModel(mWindowModels, window);
            }
            emit windowShown(QVariant::fromValue(static_cast<QQuickItem*>(window)));
        }
        else {
            qDebug() << __PRETTY_FUNCTION__ << " UNMAPPED " << window << "appId" << window->appId() << "windowType" << window->windowType();

            if (window == mFullscreenWindow)
                setFullscreenWindow(0);

            emit windowHidden(QVariant::fromValue(static_cast<QQuickItem*>(window)));
        }
    }
}
开发者ID:webOS-ports,项目名称:luna-next,代码行数:26,代码来源:compositor.cpp

示例4: surfaceMapped

void LipstickCompositor::surfaceMapped()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
    //Ignore surface if it's not a window surface
    if (!surface->hasShellSurface())
        return;

    QVariantMap properties = surface->windowProperties();
    QString category = properties.value("CATEGORY").toString();

    if (surface->surfaceItem())
        return;

    // The surface was mapped for the first time
    int id = m_nextWindowId++;
    LipstickCompositorWindow *item = new LipstickCompositorWindow(id, category, surface, contentItem());
    item->setSize(surface->size());
    QObject::connect(item, SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed()));
    m_totalWindowCount++;
    m_mappedSurfaces.insert(id, item);

    item->setTouchEventsEnabled(true);

    emit windowCountChanged();
    emit windowAdded(item);

    windowAdded(id);

    emit availableWinIdsChanged();
}
开发者ID:jvihrial,项目名称:lipstick,代码行数:30,代码来源:lipstickcompositor.cpp

示例5: surfaceSizeChanged

void LipstickCompositor::surfaceSizeChanged()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());

    LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());
    if (window)
        window->setSize(surface->size());
}
开发者ID:Morpog,项目名称:lipstick,代码行数:8,代码来源:lipstickcompositor.cpp

示例6: surfaceLowered

void LipstickCompositor::surfaceLowered()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
    LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());

    if (window) {
        emit windowLowered(window);
    }
}
开发者ID:Morpog,项目名称:lipstick,代码行数:9,代码来源:lipstickcompositor.cpp

示例7: surfaceUnmapped

void SystemCompositor::surfaceUnmapped()
{
    // Set to 0 the current surface if it was unmapped
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
    if (surface == m_currentSurface)
        m_currentSurface = 0;

    // Announce this window was destroyed
    QQuickItem *item = surface->surfaceItem();
    emit windowDestroyed(QVariant::fromValue(item));
}
开发者ID:nezticle,项目名称:greenisland,代码行数:11,代码来源:systemcompositor.cpp

示例8: surfaceDestroyed

void SystemCompositor::surfaceDestroyed(QObject *object)
{
    // Set to 0 the current surface if it was destroyed
    QWaylandSurface *surface = static_cast<QWaylandSurface *>(object);
    if (surface == m_currentSurface)
        m_currentSurface = 0;

    // Announce this window was destroyed
    QQuickItem *item = surface->surfaceItem();
    if (item)
        emit windowDestroyed(QVariant::fromValue(item));
}
开发者ID:nezticle,项目名称:greenisland,代码行数:12,代码来源:systemcompositor.cpp

示例9: geo

QWaylandSurface *QWindowCompositor::surfaceAt(const QPointF &point, QPointF *local)
{
    for (int i = m_surfaces.size() - 1; i >= 0; --i) {
        QWaylandSurface *surface = m_surfaces.at(i);
        QRectF geo(surface->pos(), surface->size());
        if (geo.contains(point)) {
            if (local)
                *local = toSurface(surface, point);
            return surface;
        }
    }
    return 0;
}
开发者ID:locusf,项目名称:qtwayland,代码行数:13,代码来源:qwindowcompositor.cpp

示例10: surfaceTitleChanged

void LipstickCompositor::surfaceTitleChanged()
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
    LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());

    if (window) {
        emit window->titleChanged();

        int windowId = window->windowId();

        for (int ii = 0; ii < m_windowModels.count(); ++ii)
            m_windowModels.at(ii)->titleChanged(windowId);
    }
}
开发者ID:Morpog,项目名称:lipstick,代码行数:14,代码来源:lipstickcompositor.cpp

示例11: windowIdForLink

int LipstickCompositor::windowIdForLink(QWaylandSurface *s, uint link) const
{
    for (QHash<int, LipstickCompositorWindow *>::ConstIterator iter = m_mappedSurfaces.begin();
         iter != m_mappedSurfaces.end(); ++iter) {

        QWaylandSurface *windowSurface = iter.value()->surface();

        if (windowSurface && windowSurface->processId() == s->processId() &&
            windowSurface->windowProperties().value("WINID", uint(0)).toUInt() == link)
            return iter.value()->windowId();
    }

    return 0;
}
开发者ID:Morpog,项目名称:lipstick,代码行数:14,代码来源:lipstickcompositor.cpp

示例12: Q_UNUSED

void PlasmaEffects::effects_slide(Resource *resource,
                                  wl_resource *outputResource,
                                  wl_resource *surfaceResource,
                                  uint32_t from,
                                  int32_t x, int32_t y)
{
    Q_UNUSED(resource);

    QWaylandOutput *output = QWaylandOutput::fromResource(outputResource);
    if (!output) {
        qCWarning(PLASMA_EFFECTS_PROTOCOL) << "Couldn't get output from resource";
        return;
    }

    QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource);
    if (!surface) {
        qCWarning(PLASMA_EFFECTS_PROTOCOL) << "Couldn't get surface from resource";
        return;
    }

    QPointF ptFrom;
    QPointF ptTo(x, y);

    switch (from) {
    case location_none:
        ptFrom.setX(output->geometry().width() / 2);
        ptFrom.setY(output->geometry().height() / 2);
        break;
    case location_left:
        ptFrom = QPointF(-surface->size().width(), 0);
        break;
    case location_top:
        ptFrom = QPointF(0, -surface->size().height());
        break;
    case location_right:
        ptFrom = QPointF(output->geometry().width() +
                         surface->size().width(), 0);
        break;
    case location_bottom:
        ptFrom = QPointF(0, output->geometry().height() +
                         surface->size().height());
        break;
    }

    for (const PlasmaSurface *plasmaSurface: m_shell->surfaces()) {
        if (plasmaSurface->surface() == surface)
            Q_EMIT plasmaSurface->window()->moveRequested(ptFrom, ptTo);
    }
}
开发者ID:hbarve1,项目名称:greenisland,代码行数:49,代码来源:plasmaeffects.cpp

示例13: notificationShouldBeShown

bool NotificationPreviewPresenter::notificationShouldBeShown(LipstickNotification *notification)
{
    bool screenOrDeviceLocked = locks->getState(MeeGo::QmLocks::TouchAndKeyboard) == MeeGo::QmLocks::Locked || locks->getState(MeeGo::QmLocks::Device) == MeeGo::QmLocks::Locked;
    bool notificationHidden = notification->hints().value(NotificationManager::HINT_HIDDEN).toBool();
    bool notificationHasPreviewText = !(notification->previewBody().isEmpty() && notification->previewSummary().isEmpty());
    int notificationIsCritical = notification->hints().value(NotificationManager::HINT_URGENCY).toInt() >= 2;

    uint mode = AllNotificationsEnabled;
    QWaylandSurface *surface = LipstickCompositor::instance()->surfaceForId(LipstickCompositor::instance()->topmostWindowId());
    if (surface != 0) {
        mode = surface->windowProperties().value("NOTIFICATION_PREVIEWS_DISABLED", uint(AllNotificationsEnabled)).toUInt();
    }

    return !notificationHidden && notificationHasPreviewText && (!screenOrDeviceLocked || notificationIsCritical) &&
            (mode == AllNotificationsEnabled || (mode == ApplicationNotificationsDisabled && notificationIsCritical) || (mode == SystemNotificationsDisabled && !notificationIsCritical));
}
开发者ID:AOSC-Dev,项目名称:lipstick,代码行数:16,代码来源:notificationpreviewpresenter.cpp

示例14: Q_UNUSED

void ScreenSaver::screensaver_set_surface(Resource *resource,
                                          struct ::wl_resource *output_resource,
                                          struct ::wl_resource *surface_resource)
{
    Q_UNUSED(resource);
    Q_UNUSED(output_resource);

    QWaylandSurface *surface =
            QtWayland::Surface::fromResource(surface_resource)->waylandSurface();
    // TODO: As soon as QtCompositor handles outputs we need to center on output

    QWaylandSurfaceItem *item = surface->surfaceItem();
    if (item)
        item->setZ(100000);

    Q_EMIT m_compositor->fadeIn();
}
开发者ID:hbarve1,项目名称:greenisland,代码行数:17,代码来源:screensaver.cpp

示例15: windowPropertyChanged

void LipstickCompositor::windowPropertyChanged(const QString &property)
{
    QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());

    if (debug())
        qDebug() << "Window properties changed:" << surface << surface->windowProperties();

    if (property == QLatin1String("MOUSE_REGION")) {
        LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());
        if (window)
            window->refreshMouseRegion();
    } else if (property == QLatin1String("GRABBED_KEYS")) {
        LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());
        if (window)
            window->refreshGrabbedKeys();
    }
}
开发者ID:Morpog,项目名称:lipstick,代码行数:17,代码来源:lipstickcompositor.cpp


注:本文中的QWaylandSurface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。