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 · 2 comments
Labels
bug Something isn't working upstream kde

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 kde 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
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 kde
Projects
Status: No status
Development

No branches or pull requests

1 participant