Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring the greeter on primary screen to the front #1726

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

liangjs
Copy link

@liangjs liangjs commented Jun 3, 2023

When there are multiple monitors connected, sddm-greeter creates new views for each screen, and activates the primary one to focus on its password field. However, if the monitors are initially setup to display the same content, different views will overlap with each other. The views created by non-primary screens may be placed on top of the primary view. In such cases, the primary view will be focused but not visible to the user.

This is fixed by calling view->raise for the primary screen. The primary view should be raised whenever a new screen is added, in order to avoid being covered by the newly created view.

Fixes: #612 #514

When there are multiple monitors connected, sddm-greeter creates new views for each screen, and activates the primary one to focus on its password field. However, if the monitors are initially setup to display the same content, different views will overlap with each other. The views created by non-primary screens may be placed on top of the primary view. In such cases, the primary view will be focused but not visible to the user.

This is fixed by calling `view->raise` for the primary screen. The primary view should be raised whenever a new screen is added, in order to avoid being covered by the newly created view.
@arrowd
Copy link
Contributor

arrowd commented Aug 1, 2023

How does one configure X server to reproduce this problem?

@liangjs
Copy link
Author

liangjs commented Aug 2, 2023

How does one configure X server to reproduce this problem?

It can be reproduced by connecting two monitors (for example, one builtin and one external) and then start sddm.

@arrowd
Copy link
Contributor

arrowd commented Aug 2, 2023

I wonder if it is SDDM's own responsibility to start X server either in duplicated or Xinerama mode? Or maybe even a theme may request that from the daemon?

Some themes might be prepared for the Xinerama scenario, for example by drawring only the background on the second screen.

@liangjs
Copy link
Author

liangjs commented Aug 4, 2023

I wonder if it is SDDM's own responsibility to start X server either in duplicated or Xinerama mode? Or maybe even a theme may request that from the daemon?

Some themes might be prepared for the Xinerama scenario, for example by drawring only the background on the second screen.

The SDDM greeter creates views for each screen, and then each view is managed by the theme separately.

// Create views
const QList<QScreen *> screens = qGuiApp->primaryScreen()->virtualSiblings();
for (QScreen *screen : screens)
addViewForScreen(screen);
// Handle screens
connect(qGuiApp, &QGuiApplication::screenAdded, this, &GreeterApp::addViewForScreen);

I don't know much about Xinerama. If it configures X server in a way that only one screen will be detected by SDDM, a single view will be created.

@Vogtinator
Copy link
Contributor

The primary view should be raised whenever a new screen is added, in order to avoid being covered by the newly created view.

Not sure I agree with this - effectively this means whenever a screen is plugged in, the primary screen (essentially random) gets focus. Ideally focus shouldn't change, unless the new screen is the primary one, which is what the code does.

However, if the monitors are initially setup to display the same content, different views will overlap with each other. The views created by non-primary screens may be placed on top of the primary view.

This sounds like the root cause. What about detecting whether a view overlaps anonther one (completely) and then ignoring it?
Can we assume that after a view appears, its position will not change?

@lianghwe
Copy link

Why do we create multiple views when two monitors showing the same content? I think that is the problem.

@Vogtinator
Copy link
Contributor

Why do we create multiple views when two monitors showing the same content? I think that is the problem.

In the case that all monitors have the same geometry, sharing would be possible, but in any other case it's not. To make it consistent, it's never shared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Focus is not on password field
5 participants