diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index 7fbaf8e29..8efe32b89 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -143,6 +143,16 @@ wxTopLevelWindow *ScreenshotCommand::GetFrontWindow(AudacityProject *project) wxWindow *front = NULL; wxWindow *proj = wxGetTopLevelParent(project); + + // JKC: The code below is no longer such a good idea. + // We now have options to directly capture toolbars, effects, preferences. + // We now also may have more than one dialog open, so who is to say + // which one we want to capture? Additionally, as currently written, + // it may capture the screenshot dialog itself (on Linux) + // IF we still keep this code in future, it needs a rethink. + // Possibly as well as the kWindow options, we should offer kDialog options, + // which attempt to do what this once did. +#if 0 // This is kind of an odd hack. There's no method to enumerate all // possible windows, so we search the whole screen for any windows // that are not this one and not the given Audacity project and @@ -156,13 +166,14 @@ wxTopLevelWindow *ScreenshotCommand::GetFrontWindow(AudacityProject *project) wxWindow *win = wxFindWindowAtPoint(wxPoint(x, y)); if (win) { win = wxGetTopLevelParent(win); - if (win != mIgnore && win != proj) { + if (win != mIgnore && win != proj && win->IsShown()) { front = win; break; } } } } +#endif if (!front || !front->IsTopLevel()) { return (wxTopLevelWindow *)proj; diff --git a/src/commands/ScreenshotCommand.h b/src/commands/ScreenshotCommand.h index a70913d92..e295a73be 100644 --- a/src/commands/ScreenshotCommand.h +++ b/src/commands/ScreenshotCommand.h @@ -78,7 +78,7 @@ public: nCaptureWhats }; - ScreenshotCommand(){ mbBringToTop=true;}; + ScreenshotCommand(){ mbBringToTop=true;mIgnore=NULL;}; // CommandDefinitionInterface overrides IdentInterfaceSymbol GetSymbol() override {return SCREENSHOT_PLUGIN_SYMBOL;}; wxString GetDescription() override {return _("Takes screenshots.");}; @@ -103,6 +103,7 @@ public: private: // May need to ignore the screenshot dialog + // Appears not to be used anymore. wxWindow *mIgnore; bool mBackground;