Skip to content

Commit

Permalink
Add utility function void ChangeWindowFullMonitorWorkArea() like void…
Browse files Browse the repository at this point in the history
… ChangeWindowSize(...) but using the monitor work area to resize the window.
  • Loading branch information
Robxley committed Dec 10, 2024
1 parent 2913aaa commit 4465a6c
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);


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

// @@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 ChangeWindowFullMonitorWorkArea()
{

gLastRunner->ChangeWindowFullMonitorWorkArea();
}


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::ChangeWindowFullMonitorWorkArea()
{
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 ChangeWindowFullMonitorWorkArea();

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

0 comments on commit 4465a6c

Please sign in to comment.