Skip to content

Commit

Permalink
Reduce magic number usage and improve macOS blank window hack (#19921)
Browse files Browse the repository at this point in the history
  • Loading branch information
markcmiller86 authored Oct 19, 2024
1 parent e041cf7 commit da91e8c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
8 changes: 6 additions & 2 deletions src/databases/Xdmf/avtXdmfFileFormat.C
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,12 @@ void avtXdmfFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md, int ti

if (mt == AVT_UNKNOWN_MESH) {
// This is really a faux mesh object for an associated curve object
mt = AVT_RECTILINEAR_MESH;
avtMeshMetaData *mmd = new avtMeshMetaData(grid->GetName(), 1, 0, 0, 0, 2, 1, mt);
int const nblocks = 1, blockOrigin = 0, cellOrigin = 0, groupOrigin = 0;
int const spatial_dim = 2, topo_dim = 1;
avtMeshType const meshType = AVT_RECTILINEAR_MESH;
mt = meshType;
avtMeshMetaData *mmd = new avtMeshMetaData(grid->GetName(), nblocks,
blockOrigin, cellOrigin, groupOrigin, spatial_dim, topo_dim, meshType);
mmd->hideFromGUI = true;
md->Add(mmd);
}
Expand Down
35 changes: 17 additions & 18 deletions src/viewer/core/ViewerWindowManager.C
Original file line number Diff line number Diff line change
Expand Up @@ -4501,25 +4501,24 @@ ViewerWindowManager::UpdateColorTable(const std::string &ctName)
void
ViewerWindowManager::SetWindowLayout(const int windowLayout)
{

// Stop gap to avert blank viewer windows (#18090)
// There is associated logic in rpc/ViewerMethods::DrawPlots which will
// trigger this logic twice upon **FIRST** draw. This causes window to
// repaint and not be blank. Attempts to use SetWindowSize() also fixed
// the blank window issue but due to internal inconsistency in what
// VisIt thinks the window size actually is failed to return the window
// to its original size.
// Stop gap to avert blank viewer windows (#18090). There is associated
// logic in rpc/ViewerMethods::DrawPlots which will trigger this logic upon
// **FIRST** draw. The goal is to cause all windows to repaint and not be
// blank.
#if defined(__APPLE__)
static size_t count = 0;
if (windowLayout == -5 && count < 2)
{
static int origlo = layout;
static int tmplo = layout==2?1:2;
if (count == 0)
SetWindowLayout(tmplo);
else if (count == 1)
SetWindowLayout(origlo);
count++;
int const DiddleSizeToFixBlankStartup = -5;
if (windowLayout == DiddleSizeToFixBlankStartup)
{
for (int iWindow = 0; iWindow < maxWindows; iWindow++)
{
if (windows[iWindow] == 0)
continue;

int origWidth, origHeight;
windows[iWindow]->GetWindowSize(origWidth, origHeight);
windows[iWindow]->SetSize(origWidth-1, origHeight);
windows[iWindow]->SetSize(origWidth, origHeight);
}
return;
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/viewer/rpc/ViewerMethods.C
Original file line number Diff line number Diff line change
Expand Up @@ -2376,14 +2376,14 @@ ViewerMethods::DrawPlots(bool drawAllPlots)

// Stop gap to avert blank viewer windows (#18090)
// There is associated logic in core/ViewerWindowManager::SetWindowLayout
// which responds to these two successive calls
// which responds to this call.
#if defined(__APPLE__)
static bool first = true;
if (first)
{
int const DiddleSizeToFixBlankStartup = -5;
first = false;
SetWindowLayout(-5); // -5 is magic number to trigger special logic
SetWindowLayout(-5); // -5 is magic number to trigger special logic
SetWindowLayout(DiddleSizeToFixBlankStartup);
}
#endif
}
Expand Down

0 comments on commit da91e8c

Please sign in to comment.