Fix Klipper popup opening on default screen instead of at cursor position
ClosedPublic

Authored by romangeints on Oct 1 2018, 7:45 PM.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Lint Skipped
Unit
Unit Tests Skipped
romangeints created this revision.Oct 1 2018, 7:45 PM
Restricted Application added a project: Plasma. · View Herald TranscriptOct 1 2018, 7:45 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
romangeints requested review of this revision.Oct 1 2018, 7:45 PM

Renamed a variable, removed extra parentheses

Code in system tray is quite good:

if (QScreen *screen = appletInterface->window()->screen()) {
    const QRect geo = screen->availableGeometry();

    pos = QPoint(qBound(geo.left(), (int)pos.x(), geo.right() - desktopMenu->width()),
                    qBound(geo.top(), (int)pos.y(), geo.bottom() - desktopMenu->height()));
}

it binds it to the availableGeometry so it always appears outside of struts (panels)

it binds it to the availableGeometry so it always appears outside of struts (panels)

I dont think this is valid under wayland. QScreen::availableGeometry() returns only the QScreen::geometry() under wayland.
The method I think plasma introduced to know the available screen space through qml is:
AppletInterface::availableScreenRect or availableScreenRegion

and for c++ side:

Plasma::Corona::availableScreenRect
Plasma::Corona::availableScreenRegion

Sure, but on wayland menu->popup(QPoint) isn't goint work anyway.

So, should I rewrite this in terms of qBound & availableGeometry?

I would, then we'll at least be consistent across plasma code.

romangeints updated this revision to Diff 42988.Oct 6 2018, 9:12 PM

I've figured extra adjustments are not necessary at all, QMenu::popup does enough already.

Screencast: https://streamable.com/jonoj

davidedmundson accepted this revision.Oct 6 2018, 10:08 PM
This revision is now accepted and ready to land.Oct 6 2018, 10:08 PM

Am I right thinking no further action is expected from me?

What's your email address? (for the commit log)

romanrzn@gmail.com

This revision was automatically updated to reflect the committed changes.