Skip to content

Fix unchecked popup-only setting

Noah Davis requested to merge work/ndavis/fix-transientOnly into master

Looking back at the code from before the rewrite, the code for handling this setting wasn't any better before. Someday, we should refactor this. For now, let's make sure it's not broken.

This was the pre-rewrite code:

void KSWidget::newScreenshotClicked()
{
    int lDelay = mCaptureOnClick->isChecked() ? -1 : (mDelayMsec->value() * 1000);
    auto lMode = mCaptureArea->currentCaptureMode();
    if (mTransientWithParentAvailable && lMode == Spectacle::CaptureMode::WindowUnderCursor && !(mCaptureTransientOnly->isChecked())) {
        lMode = Spectacle::CaptureMode::TransientWithParent;
    }
    setButtonState(State::Cancel);
    Q_EMIT newScreenshotRequest(lMode, lDelay, mMousePointer->isChecked(), mWindowDecorations->isChecked());
}

How to test:

  1. Open an X11 Plasma session.
  2. Open Spectacle in viewer mode (anything but rectangle capture).
  3. Uncheck the checkbox labeled "Capture the current pop-up only".
  4. Set a delay for 5 seconds.
  5. Open a Qt Widgets app that has a menu bar, menu button or context menu somewhere in it.
  6. In the Spectacle instance you opened before, do a Window Under Cursor capture.
  7. Before the timer runs out, open a menu in the Qt Widget app you opened and have your mouse over the menu until the screen is captured.

You should see a screenshot that contains both the menu and the parent window.

Edited by Noah Davis

Merge request reports