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

Popup/dialogs spawn at incorrect position if 'Native panel background' is disabled in Plasma 6.2 Beta #80

Open
luisbocanegra opened this issue Oct 4, 2024 · 6 comments
Labels
bug Something isn't working upstream

Comments

@luisbocanegra
Copy link
Owner

image

@luisbocanegra luisbocanegra added the bug Something isn't working label Oct 4, 2024
@luisbocanegra luisbocanegra added this to the v1.0.0 milestone Oct 4, 2024
@luisbocanegra
Copy link
Owner Author

luisbocanegra commented Oct 5, 2024

Well turns out popups now align with the panel mask https://invent.kde.org/plasma/libplasma/-/merge_requests/1148.

Setting PlasmaCore.Types.NoBackground to the panel containmentItem https://github.com/luisbocanegra/plasma-panel-colorizer/blob/b284edbb89a335476418cf631d1a72d408c07c19/package/contents/ui/code/utils.js#L84C1-L88C2

function toggleTransparency(containmentItem, nativePanelBackgroundEnabled) {
  containmentItem.Plasmoid.backgroundHints = !nativePanelBackgroundEnabled
    ? PlasmaCore.Types.NoBackground
    : PlasmaCore.Types.DefaultBackground
}

results in the panel creating an empty mask https://github.com/KDE/plasma-workspace/blob/c809de7c72dcc7e94eeed5a0b09cb81f5512c2e0/shell/panelview.cpp#L1363C1-L1366C28

void PanelView::updateMask()
{
...
    if (m_backgroundHints == Plasma::Types::NoBackground) {
        KWindowEffects::enableBlurBehind(this, false);
        KWindowEffects::enableBackgroundContrast(this, false);
        setMask(QRegion()); // <- this line

Which successfully removes the blur and contrast (allowing the panel to be fully transparent) but breaks the positioning of popups.

If I don't set PlasmaCore.Types.NoBackground and instead try to create an empty mask from my PanelColorizer::updatePanelMask, the panel detects it's empty and creates its own from the panel QRect instead:

    } else {
        QRegion mask;
        QQuickItem *rootObject = this->rootObject();
        QRect screenPanelRect = geometry();
        screenPanelRect.moveTo(mapFromGlobal(screenPanelRect.topLeft()));
        if (rootObject) {
            QVariant maskProperty = rootObject->property("panelMask");
            if (static_cast<QMetaType::Type>(maskProperty.typeId()) == QMetaType::QRegion) {
                mask = get<QRegion>(std::move(maskProperty));
                const QPoint floatingTranslucentItemOffset = rootObject->property("floatingTranslucentItemOffset").toPoint();
                mask.translate(floatingTranslucentItemOffset);
            }
        }
        if (mask.isEmpty()) {
            mask = QRegion(QRect(screenPanelRect));
        }

Creating a 1x1 mask and setting the correct position fixes the popups but now there is a bright dot on the screen and it will require compiling the C++ plugin.

region = QRegion();
translateX = abs(offset.x());
translateY = abs(offset.y() + rect.height() - 1);
Screencast_20241004_223204.webm

@luisbocanegra luisbocanegra added help wanted Extra attention is needed upstream labels Oct 5, 2024
@luisbocanegra
Copy link
Owner Author

Upstream Bugreport https://bugs.kde.org/show_bug.cgi?id=494193
Submitted a fix at https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4797 waiting for it to be reviewed

@luisbocanegra luisbocanegra removed the help wanted Extra attention is needed label Oct 6, 2024
@luisbocanegra luisbocanegra removed this from the v1.0.0 milestone Oct 6, 2024
@luisbocanegra luisbocanegra pinned this issue Oct 11, 2024
@luisbocanegra
Copy link
Owner Author

Fix has been merged 🎉 Will be available in Plasma 6.2.2 (Tue 2024-10-22)

@nikoraasu
Copy link

Has this actually been fixed? I still face this issue with the dialogs being offset. I can temporarily fix it by enabling native panel background and disabling it, but this resets when I restart my system.
image

Using Plasma 6.2.3
Running widget version 1.2.0-1 from Aur

@mill413
Copy link

mill413 commented Nov 21, 2024

Has this actually been fixed? I still face this issue with the dialogs being offset. I can temporarily fix it by enabling native panel background and disabling it, but this resets when I restart my system. image

Using Plasma 6.2.3 Running widget version 1.2.0-1 from Aur

Same. Plasma 6.2.3(Wayland), widget version 1.2.0-1 from AUR

@luisbocanegra
Copy link
Owner Author

luisbocanegra commented Nov 21, 2024

With Blur custom background disabled on the panel, popups are spawned at the edge of the original blur mask (provided by the Plasma style SVG) and without Native panel background popups spawn at the edge of the panel "window" which seems to be bigger than the panel probably to reserve space for the SVG shadows and dodge windows features

That is why by enabling Blur custom background "fixes" the problem.

Also might be related to #100, the fix workaround for that was turn the mask on and off again when the panel size changes, just like what @nikoraasu describes.

Something needs to be done to ensure the the mask is always the correct one, most likely requires another upstream patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
Status: Done
Development

No branches or pull requests

3 participants