Skip to content

Commit 989bf1c

Browse files
committed
fix ci
1 parent 54ffbd0 commit 989bf1c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

kitgui/src/impl/win32/contextImpl.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ bool ContextImpl::GetSize(uint32_t& widthOut, uint32_t& heightOut) const {
233233
heightOut = rect.bottom - rect.top;
234234
return true;
235235
}
236+
bool ContextImpl::GetSizeInPixels(uint32_t& widthOut, uint32_t& heightOut) const {
237+
RECT rect;
238+
::GetWindowRect(mWindow, &rect);
239+
widthOut = rect.right - rect.left;
240+
heightOut = rect.bottom - rect.top;
241+
return true;
242+
}
236243
bool ContextImpl::SetSizeDirectly(uint32_t width, uint32_t height, bool resizable) {
237244
// TODO: resizable
238245
return ::SetWindowPos(mWindow, nullptr, 0, 0, width, height,
@@ -339,7 +346,7 @@ void ContextImpl::RunSingleFrame() {
339346

340347
// draw
341348
uint32_t width = 0, height = 0;
342-
instance->GetSize(width, height);
349+
instance->GetSizeInPixels(width, height);
343350
GL::defaultFramebuffer.setViewport({{}, {static_cast<int>(width), static_cast<int>(height)}});
344351
GL::defaultFramebuffer.clearColor(instance->mClearColor);
345352
GL::defaultFramebuffer.clear(GL::FramebufferClear::Color | GL::FramebufferClear::Depth);
@@ -431,4 +438,4 @@ void ContextImpl::DestroyWglContext() {
431438
mWglContext = nullptr;
432439
mDeviceContext = nullptr;
433440
}
434-
} // namespace kitgui::win32
441+
} // namespace kitgui::win32

kitgui/src/impl/win32/contextImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ContextImpl {
4545
bool SetUIScale(double scale);
4646
double GetUIScale() const;
4747
bool GetSize(uint32_t& widthOut, uint32_t& heightOut) const;
48+
bool GetSizeInPixels(uint32_t& widthOut, uint32_t& heightOut) const;
4849
bool SetSizeDirectly(uint32_t width, uint32_t height, bool resizable);
4950
bool SetParent(const kitgui::WindowRef& handle);
5051
bool SetTransient(const kitgui::WindowRef& handle);
@@ -94,4 +95,4 @@ class ContextImpl {
9495
static ContextImpl* FindContextImplForWindow(HWND wnd);
9596
};
9697

97-
} // namespace kitgui::win32
98+
} // namespace kitgui::win32

0 commit comments

Comments
 (0)