Skip to content
Browse files

lightdm: Ensure we set the primary screen's widget as active when the…

…re more screens
  • Loading branch information...
1 parent d7f30e9 commit c3d6d79d21070c8aec5dce84d199af4c8e2ab46e @pvanek pvanek committed
View
12 razorqt-lightdm-greeter/main.cpp
@@ -27,14 +27,26 @@
#include <QtGui/QDesktopWidget>
#include "mainwindow.h"
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+ MainWindow *focusWindow = 0;
for (int i = 0; i < QApplication::desktop()->screenCount(); ++i)
{
MainWindow *w = new MainWindow(i);
w->show();
+ if (w->isMain())
+ focusWindow = w;
+ }
+
+ // Ensure we set the primary screen's widget as active when there
+ // are more screens
+ if (focusWindow)
+ {
+ focusWindow->setFocus(Qt::OtherFocusReason);
+ focusWindow->activateWindow();
}
return a.exec();
View
5 razorqt-lightdm-greeter/mainwindow.cpp
@@ -33,6 +33,8 @@
MainWindow::MainWindow(int screen, QWidget *parent)
: QWidget(parent)
{
+ setObjectName(QString("MainWindow_%1").arg(screen));
+
QRect screenRect = QApplication::desktop()->screenGeometry(screen);
setGeometry(screenRect);
QImage image(QString(SHARE_DIR) + "/themes/light/simple_blue_widescreen.png");
@@ -42,7 +44,8 @@ MainWindow::MainWindow(int screen, QWidget *parent)
this->setPalette(palette);
// display login dialog only in the main screen
- if (screen == QApplication::desktop()->primaryScreen())
+ m_main = screen == QApplication::desktop()->primaryScreen();
+ if (m_main)
{
LoginForm *loginForm = new LoginForm(this);
int offsetX = 2*screenRect.width()/5 - loginForm->width()/2;
View
4 razorqt-lightdm-greeter/mainwindow.h
@@ -41,8 +41,10 @@ class MainWindow : public QWidget
explicit MainWindow(int screen, QWidget *parent = 0);
~MainWindow();
+ bool isMain() { return m_main; };
-
+private:
+ bool m_main;
};
#endif // MAINWINDOW_H

0 comments on commit c3d6d79

Please sign in to comment.
Something went wrong with that request. Please try again.