Skip to content

Commit

Permalink
Merge pull request #130 from Robxley/master
Browse files Browse the repository at this point in the history
Add utility function void ChangeWindowFullMonitorWorkArea() like void…
  • Loading branch information
pthom authored Dec 10, 2024
2 parents 2913aaa + 4d419d6 commit 13e6bd4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hello_imgui/hello_imgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ std::string GetBackendDescription();
// (useful if you want to change the window size during execution)
void ChangeWindowSize(const ScreenSize &windowSize);


// `UseWindowFullMonitorWorkArea()`: sets the window size to the monitor work area
// (useful if you want to change the window size during execution)
void UseWindowFullMonitorWorkArea();

// @@md


Expand Down
8 changes: 8 additions & 0 deletions src/hello_imgui/impl/hello_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ void ChangeWindowSize(const ScreenSize &windowSize)
gLastRunner->ChangeWindowSize(windowSize);
}


void UseWindowFullMonitorWorkArea()
{

gLastRunner->UseWindowFullMonitorWorkArea();
}


bool ShouldRemoteDisplay()
{
return gLastRunner->ShouldRemoteDisplay();
Expand Down
7 changes: 7 additions & 0 deletions src/hello_imgui/internal/backend_impls/abstract_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ void AbstractRunner::ChangeWindowSize(HelloImGui::ScreenSize windowSize)
mBackendWindowHelper->SetWindowBounds(mWindow, bounds);
}

void AbstractRunner::UseWindowFullMonitorWorkArea()
{
auto screenBounds = mGeometryHelper->GetCurrentMonitorWorkArea(mBackendWindowHelper.get(),mWindow);
this->setWasWindowResizedByCodeDuringThisFrame();
mBackendWindowHelper->SetWindowBounds(mWindow, screenBounds);
}

bool AbstractRunner::ShallSizeWindowRelativeTo96Ppi()
{
bool shallSizeRelativeTo96Ppi;
Expand Down
1 change: 1 addition & 0 deletions src/hello_imgui/internal/backend_impls/abstract_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AbstractRunner
ImageBuffer ScreenshotRgb() { return mRenderingBackendCallbacks->Impl_ScreenshotRgb_3D(); }

void ChangeWindowSize(ScreenSize windowSize);
void UseWindowFullMonitorWorkArea();

void LayoutSettings_SwitchLayout(const std::string& layoutName);
bool ShouldRemoteDisplay();
Expand Down

0 comments on commit 13e6bd4

Please sign in to comment.