Important: Please read the Qt Code of Conduct -

Choosing startup screen in Weston + Wayland

  • Hello everyone!
    Does anyone have issues with the Wayland compositor? Here I have a Linux + Weston + Wayland machine with a small integrated LCD display (800x480) and an external HDMI monitor (1920x1080).
    My goal is to programmatically select the screen on which showing a QFrame, but no matter what I do it appears on the main display. Here's an example of my attempts:

    //Start application on selected screen
    bool Manager::StartOnScreen(int screenIdx)
        _desktopWidget = QApplication::desktop();
        //Check if requested screen is available
        if(screenIdx >= _desktopWidget->screenCount())
            qDebug() << "Screen index out of range";
            return false;
        QWidget* screen = _desktopWidget->screen(screenIdx);
        QFrame* mainFrame = new QFrame();
        //Set frame color
        if(screenIdx == 0)
            mainFrame->setStyleSheet("background-color:rgb(0, 0, 254);");
            mainFrame->setStyleSheet("background-color:rgb(254, 0, 0);");
        int width = screen->geometry().width();
        int height = screen->geometry().height();
        int x = screen->geometry().x();
        int y = screen->geometry().y();
        qDebug() << "Screen config #" + QString::number(screenIdx) + ": position=" + QString::number(x) + "x" + QString::number(y) + " size=" +QString::number(width) + "x" + QString::number(height);
        //Set frame screen and geometry
        //Show the frame (windowed)
        //Show the frame (fullscreen)
        //Try to move the frame with setScreen
        return true;

Log in to reply