Exemplo n.º 1
0
QHaikuWindow::QHaikuWindow(QWindow *wnd)
    : QPlatformWindow(wnd)
    , m_positionIncludesFrame(false)
    , m_visible(false)
    , m_pendingGeometryChangeOnShow(true)
{	
	qDebug() << "window()->surfaceType() " << window()->surfaceType() << window()->type();
	
	m_window = new QtHaikuWindow(this, BRect(wnd->geometry().left(),
    				wnd->geometry().top(),
    				wnd->geometry().right(),
    				wnd->geometry().bottom()),
    				wnd->title().toUtf8(),
    				B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0);
    
    setWindowFlags(wnd->flags());
    setWindowState(wnd->windowState());
    handleContentOrientationChange(wnd->contentOrientation());	 	
    setGeometry(wnd->geometry());

    QWindowSystemInterface::flushWindowSystemEvents();
    
    m_winId = (WId)this;
}
Exemplo n.º 2
0
QWaylandWindow::QWaylandWindow(QWindow *window)
    : QObject()
    , QPlatformWindow(window)
    , mScreen(QWaylandScreen::waylandScreenFromWindow(window))
    , mDisplay(mScreen->display())
    , mShellSurface(0)
    , mSubSurfaceWindow(0)
    , mWindowDecoration(0)
    , mMouseEventsInContentArea(false)
    , mMousePressedInContentArea(Qt::NoButton)
    , m_cursorShape(Qt::ArrowCursor)
    , mBuffer(0)
    , mWaitingForFrameSync(false)
    , mFrameCallback(0)
    , mRequestResizeSent(false)
    , mCanResize(true)
    , mResizeDirty(false)
    , mResizeAfterSwap(qEnvironmentVariableIsSet("QT_WAYLAND_RESIZE_AFTER_SWAP"))
    , mSentInitialResize(false)
    , mMouseDevice(0)
    , mMouseSerial(0)
    , mState(Qt::WindowNoState)
    , mBackingStore(Q_NULLPTR)
{
    init(mDisplay->createSurface(static_cast<QtWayland::wl_surface *>(this)));

    static WId id = 1;
    mWindowId = id++;

    if (mDisplay->subSurfaceExtension())
        mSubSurfaceWindow = new QWaylandSubSurface(this, mDisplay->subSurfaceExtension()->get_sub_surface_aware_surface(object()));

    if (!(window->flags() & Qt::BypassWindowManagerHint)) {
        mShellSurface = mDisplay->createShellSurface(this);
    }

    if (mShellSurface) {
        // Set initial surface title
        mShellSurface->setTitle(window->title());

        // Set surface class to the .desktop file name (obtained from executable name)
        QFileInfo exeFileInfo(qApp->applicationFilePath());
        QString className = exeFileInfo.baseName() + QLatin1String(".desktop");
        mShellSurface->setAppId(className);
    }

    if (QPlatformWindow::parent() && mSubSurfaceWindow) {
        mSubSurfaceWindow->setParent(static_cast<const QWaylandWindow *>(QPlatformWindow::parent()));
    } else if (window->transientParent() && mShellSurface) {
        if (window->type() != Qt::Popup) {
            mShellSurface->updateTransientParent(window->transientParent());
        }
    } else if (mShellSurface) {
        mShellSurface->setTopLevel();
    }

    setOrientationMask(window->screen()->orientationUpdateMask());
    setWindowFlags(window->flags());
    setGeometry_helper(window->geometry());
    setWindowStateInternal(window->windowState());
    handleContentOrientationChange(window->contentOrientation());
}