示例#1
0
文件: window.cpp 项目: KDE/kwin
ShellClient *Window::shellClient()
{
    if (!m_shellClient) {
        waylandServer()->dispatch();
        m_shellClient = waylandServer()->findClient(window());
    }
    return m_shellClient;
}
示例#2
0
ScreenLockerWatcher::ScreenLockerWatcher(QObject *parent)
    : QObject(parent)
    , m_interface(NULL)
    , m_serviceWatcher(new QDBusServiceWatcher(this))
    , m_locked(false)
{
    if (waylandServer() && waylandServer()->hasScreenLockerIntegration()) {
        connect(waylandServer(), &WaylandServer::initialized, this, &ScreenLockerWatcher::initialize);
    } else {
        initialize();
    }
}
示例#3
0
文件: window.cpp 项目: KDE/kwin
void Window::unmap()
{
    if (m_shellClient) {
        m_shellClient->setInternalFramebufferObject(QSharedPointer<QOpenGLFramebufferObject>());
    }
    if (m_surface) {
        m_surface->attachBuffer(KWayland::Client::Buffer::Ptr());
        m_surface->commit(KWayland::Client::Surface::CommitFlag::None);
    }
    if (waylandServer()->internalClientConection()) {
        waylandServer()->internalClientConection()->flush();
    }
}
示例#4
0
void X11WindowedBackend::updateWindowTitle()
{
    const QString grab = m_keyboardGrabbed ? i18n("Press right control to ungrab input") : i18n("Press right control key to grab input");
    const QString title = QStringLiteral("%1 (%2) - %3").arg(i18n("KDE Wayland Compositor"))
                                                        .arg(waylandServer()->display()->socketName())
                                                        .arg(grab);
    for (auto it = m_windows.constBegin(); it != m_windows.constEnd(); ++it) {
        (*it).winInfo->setName(title.toUtf8().constData());
    }
}
示例#5
0
文件: window.cpp 项目: KDE/kwin
Window::Window(QWindow *window, KWayland::Client::Surface *surface, KWayland::Client::ShellSurface *shellSurface, const Integration *integration)
    : QPlatformWindow(window)
    , m_surface(surface)
    , m_shellSurface(shellSurface)
    , m_windowId(++s_windowId)
    , m_integration(integration)
{
    QObject::connect(m_surface, &QObject::destroyed, window, [this] { m_surface = nullptr;});
    QObject::connect(m_shellSurface, &QObject::destroyed, window, [this] { m_shellSurface = nullptr;});
    waylandServer()->internalClientConection()->flush();
}
示例#6
0
void X11WindowedBackend::init()
{
    int screen = 0;
    xcb_connection_t *c = nullptr;
    Display *xDisplay = XOpenDisplay(deviceIdentifier().constData());
    if (xDisplay) {
        c = XGetXCBConnection(xDisplay);
        XSetEventQueueOwner(xDisplay, XCBOwnsEventQueue);
        screen = XDefaultScreen(xDisplay);
    }
    if (c && !xcb_connection_has_error(c)) {
        m_connection = c;
        m_screenNumber = screen;
        m_display = xDisplay;
        for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(m_connection));
            it.rem;
            --screen, xcb_screen_next(&it)) {
            if (screen == m_screenNumber) {
                m_screen = it.data;
            }
        }
        XRenderUtils::init(m_connection, m_screen->root);
        createWindow();
        startEventReading();
        connect(this, &X11WindowedBackend::cursorChanged, this,
            [this] {
                createCursor(softwareCursor(), softwareCursorHotspot());
            }
        );
        setReady(true);
        waylandServer()->seat()->setHasPointer(true);
        waylandServer()->seat()->setHasKeyboard(true);
        emit screensQueried();
    } else {
        emit initFailed();
    }
}
示例#7
0
void AbstractEglBackend::initWayland()
{
#if HAVE_WAYLAND
    if (!WaylandServer::self()) {
        return;
    }
    if (hasGLExtension(QByteArrayLiteral("EGL_WL_bind_wayland_display"))) {
        eglBindWaylandDisplayWL = (eglBindWaylandDisplayWL_func)eglGetProcAddress("eglBindWaylandDisplayWL");
        eglUnbindWaylandDisplayWL = (eglUnbindWaylandDisplayWL_func)eglGetProcAddress("eglUnbindWaylandDisplayWL");
        eglQueryWaylandBufferWL = (eglQueryWaylandBufferWL_func)eglGetProcAddress("eglQueryWaylandBufferWL");
        if (!eglBindWaylandDisplayWL(eglDisplay(), *(WaylandServer::self()->display()))) {
            eglUnbindWaylandDisplayWL = nullptr;
            eglQueryWaylandBufferWL = nullptr;
        } else {
            waylandServer()->display()->setEglDisplay(eglDisplay());
        }
    }
#endif
}