Bug 1971 - Linux: Scriptables screenshot command only grab a small rectangle of window

This commit is contained in:
James Crook 2018-09-05 18:31:04 +01:00
parent f61989e922
commit 1ecff6d5db
2 changed files with 14 additions and 2 deletions

View File

@ -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;

View File

@ -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;