mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-16 00:27:42 +02:00
Bug 2040 - Linux: Assert on recording or generating when main Window minimised
This commit is contained in:
parent
90ea354002
commit
5a87d5ea67
@ -962,6 +962,7 @@ BEGIN_EVENT_TABLE(AudacityProject, wxFrame)
|
|||||||
EVT_CLOSE(AudacityProject::OnCloseWindow)
|
EVT_CLOSE(AudacityProject::OnCloseWindow)
|
||||||
EVT_SIZE(AudacityProject::OnSize)
|
EVT_SIZE(AudacityProject::OnSize)
|
||||||
EVT_SHOW(AudacityProject::OnShow)
|
EVT_SHOW(AudacityProject::OnShow)
|
||||||
|
EVT_ICONIZE(AudacityProject::OnIconize)
|
||||||
EVT_MOVE(AudacityProject::OnMove)
|
EVT_MOVE(AudacityProject::OnMove)
|
||||||
EVT_ACTIVATE(AudacityProject::OnActivate)
|
EVT_ACTIVATE(AudacityProject::OnActivate)
|
||||||
EVT_COMMAND_SCROLL_LINEUP(HSBarID, AudacityProject::OnScrollLeftButton)
|
EVT_COMMAND_SCROLL_LINEUP(HSBarID, AudacityProject::OnScrollLeftButton)
|
||||||
@ -2202,14 +2203,25 @@ void AudacityProject::OnIconize(wxIconizeEvent &event)
|
|||||||
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
// VisibileProjectCount seems to be just a counter for debugging.
|
||||||
|
// It's not used outside this function.
|
||||||
for(i=0;i<gAudacityProjects.size();i++){
|
for(i=0;i<gAudacityProjects.size();i++){
|
||||||
if(gAudacityProjects[i]){
|
if(gAudacityProjects[i]){
|
||||||
if( !gAudacityProjects[i]->mIconized )
|
if( !gAudacityProjects[i]->mIconized )
|
||||||
VisibleProjectCount++;
|
VisibleProjectCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
|
// This step is to fix part of Bug 2040, where the BackingPanel
|
||||||
|
// size was not restored after we leave Iconized state.
|
||||||
|
|
||||||
|
// Queue up a resize event using OnShow so that we
|
||||||
|
// refresh the track panel. But skip this, if we're iconized.
|
||||||
|
if( mIconized )
|
||||||
|
return;
|
||||||
|
wxShowEvent Evt;
|
||||||
|
OnShow( Evt );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudacityProject::OnMove(wxMoveEvent & event)
|
void AudacityProject::OnMove(wxMoveEvent & event)
|
||||||
|
@ -47,13 +47,13 @@ wxDC &BackedPanel::GetBackingDCForRepaint()
|
|||||||
|
|
||||||
void BackedPanel::ResizeBacking()
|
void BackedPanel::ResizeBacking()
|
||||||
{
|
{
|
||||||
// Delete the backing bitmap
|
|
||||||
if (mBacking)
|
if (mBacking)
|
||||||
mBackingDC.SelectObject(wxNullBitmap);
|
mBackingDC.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
wxSize sz = GetClientSize();
|
wxSize sz = GetClientSize();
|
||||||
mBacking = std::make_unique<wxBitmap>();
|
mBacking = std::make_unique<wxBitmap>();
|
||||||
mBacking->Create(sz.x, sz.y,24); //, *dc);
|
// Bug 2040 - Avoid 0 x 0 bitmap when minimized.
|
||||||
|
mBacking->Create(std::max(sz.x,1), std::max(sz.y,1),24); //, *dc);
|
||||||
mBackingDC.SelectObject(*mBacking);
|
mBackingDC.SelectObject(*mBacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,14 +64,15 @@ void BackedPanel::RepairBitmap(wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wx
|
|||||||
|
|
||||||
void BackedPanel::DisplayBitmap(wxDC &dc)
|
void BackedPanel::DisplayBitmap(wxDC &dc)
|
||||||
{
|
{
|
||||||
|
if( mBacking )
|
||||||
RepairBitmap(dc, 0, 0, mBacking->GetWidth(), mBacking->GetHeight());
|
RepairBitmap(dc, 0, 0, mBacking->GetWidth(), mBacking->GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackedPanel::OnSize(wxSizeEvent & /* event */)
|
void BackedPanel::OnSize(wxSizeEvent & event)
|
||||||
{
|
{
|
||||||
// Tell OnPaint() to recreate the backing bitmap
|
// Tell OnPaint() to recreate the backing bitmap
|
||||||
mResizeBacking = true;
|
mResizeBacking = true;
|
||||||
|
event.Skip();
|
||||||
// Refresh the entire area. Really only need to refresh when
|
// Refresh the entire area. Really only need to refresh when
|
||||||
// expanding...is it worth the trouble?
|
// expanding...is it worth the trouble?
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/// \brief BackedPanel is for a panel that consists of a bitmap with something drawn
|
/// \brief BackedPanel is for a panel that consists of a bitmap with something drawn
|
||||||
/// obver it. It supports efficient repainting when the overlays change and
|
/// over it. It supports efficient repainting when the overlays change and
|
||||||
/// recreation of the bitmap when the panel size is changed.
|
/// recreation of the bitmap when the panel size is changed.
|
||||||
class AUDACITY_DLL_API BackedPanel /* not final */ : public wxPanelWrapper {
|
class AUDACITY_DLL_API BackedPanel /* not final */ : public wxPanelWrapper {
|
||||||
public:
|
public:
|
||||||
@ -27,15 +27,10 @@ public:
|
|||||||
~BackedPanel();
|
~BackedPanel();
|
||||||
|
|
||||||
wxDC &GetBackingDC();
|
wxDC &GetBackingDC();
|
||||||
|
|
||||||
wxDC &GetBackingDCForRepaint();
|
wxDC &GetBackingDCForRepaint();
|
||||||
|
|
||||||
void ResizeBacking();
|
void ResizeBacking();
|
||||||
|
|
||||||
void RepairBitmap(wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
void RepairBitmap(wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||||
|
|
||||||
void DisplayBitmap(wxDC &dc);
|
void DisplayBitmap(wxDC &dc);
|
||||||
|
|
||||||
void OnSize(wxSizeEvent & event);
|
void OnSize(wxSizeEvent & event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user