本文整理汇总了C++中QWaylandSurface::size方法的典型用法代码示例。如果您正苦于以下问题:C++ QWaylandSurface::size方法的具体用法?C++ QWaylandSurface::size怎么用?C++ QWaylandSurface::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWaylandSurface
的用法示例。
在下文中一共展示了QWaylandSurface::size方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: effects_slide
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);
}
}
示例2: paintChildren
void QWindowCompositor::paintChildren(QWaylandSurface *surface, QWaylandSurface *window, const QSize &windowSize) {
if (surface->subSurfaces().size() == 0)
return;
QLinkedListIterator<QWaylandSurface *> i(surface->subSurfaces());
while (i.hasNext()) {
QWaylandSurface *subSurface = i.next();
QPointF p = subSurface->mapTo(window,QPointF(0,0));
QSize subSize = subSurface->size();
subSurface->advanceBufferQueue();
if (subSize.isValid()) {
GLuint texture = 0;
if (subSurface->type() == QWaylandSurface::Texture) {
texture = subSurface->texture(QOpenGLContext::currentContext());
} else if (surface->type() == QWaylandSurface::Shm ) {
texture = m_textureCache->bindTexture(QOpenGLContext::currentContext(),surface->image());
}
QRect geo(p.toPoint(),subSize);
if (texture > 0)
m_textureBlitter->drawTexture(texture,geo,windowSize,0,window->isYInverted(),subSurface->isYInverted());
if (surface->type() == QWaylandSurface::Shm)
glDeleteTextures(1, &texture);
}
paintChildren(subSurface,window,windowSize);
}
}
示例3: 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();
}
示例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();
}
示例5: surfaceSizeChanged
void LipstickCompositor::surfaceSizeChanged()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
LipstickCompositorWindow *window = static_cast<LipstickCompositorWindow *>(surface->surfaceItem());
if (window)
window->setSize(surface->size());
}
示例6: 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;
}
示例7: paintChildren
void QtwaylandSurfaceNode::paintChildren(QWaylandSurface *surface, QWaylandSurface *window, OpenGLData *glData) {
if (surface->subSurfaces().size() == 0)
return;
QLinkedListIterator<QWaylandSurface *> i(surface->subSurfaces());
while (i.hasNext()) {
QWaylandSurface *subSurface = i.next();
QPointF p = subSurface->mapTo(window,QPointF(0,0));
if (subSurface->size().isValid()) {
GLuint texture = 0;
if (subSurface->type() == QWaylandSurface::Texture) {
texture = subSurface->texture(QOpenGLContext::currentContext());
} else if (surface->type() == QWaylandSurface::Shm ) {
texture = glData->m_textureCache->bindTexture(QOpenGLContext::currentContext(),surface->image());
}
QRect geo(p.toPoint(),subSurface->size());
glData->m_textureBlitter->drawTexture(texture,geo,window->size(),0,window->isYInverted(),subSurface->isYInverted());
}
paintChildren(subSurface,window, glData);
}
}
示例8: surfaceMapped
void QWindowCompositor::surfaceMapped()
{
QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender());
QPoint pos;
if (!m_surfaces.contains(surface)) {
uint px = 0;
uint py = 0;
if (!QCoreApplication::arguments().contains(QLatin1String("-stickytopleft"))) {
px = 1 + (qrand() % (m_window->width() - surface->size().width() - 2));
py = 1 + (qrand() % (m_window->height() - surface->size().height() - 2));
}
pos = QPoint(px, py);
surface->setPos(pos);
} else {
m_surfaces.removeOne(surface);
}
//Sometimes surfaces dont have shell_surfaces, so don't render them
if (surface->hasShellSurface()) {
m_surfaces.append(surface);
defaultInputDevice()->setKeyboardFocus(surface);
}
m_renderScheduler.start(0);
}