Fixed scaling related bug

This commit is contained in:
OmniaX-Dev 2026-04-27 07:21:23 +02:00
parent 36c9c62e6d
commit a7265febdf
5 changed files with 6 additions and 4 deletions

View file

@ -46,6 +46,7 @@ XML Layout file?
Add Hex Editor widget Add Hex Editor widget
Add Message Boxes Add Message Boxes
FIX: Widget Content extents increasing negatively not showing scrollbars FIX: Widget Content extents increasing negatively not showing scrollbars
FIX: Button state getting hung after showing an openFileDialog

View file

@ -74,7 +74,7 @@ namespace ogfx
h = m_height; h = m_height;
f32 offset_y = 0; f32 offset_y = 0;
if (isStatusBar()) if (isStatusBar())
offset_y = (win.getWindowHeight() / win.getScaleFactor()) - m_height; offset_y = win.getWindowHeight() - m_height;
else if (win.getMenuBar().isVisible()) else if (win.getMenuBar().isVisible())
offset_y += win.getMenuBar().geth(); offset_y += win.getMenuBar().geth();
sety(offset_y); sety(offset_y);

View file

@ -242,7 +242,7 @@ namespace ogfx
f32 s = getScaleFactor(); f32 s = getScaleFactor();
auto state = getWindowState(); auto state = getWindowState();
if (!state.maximized && !state.fullscreen) if (!state.maximized && !state.fullscreen)
setSize(getWindowWidth() * s, getWindowHeight() * s); setSize(getWindowWidth(false) * s, getWindowHeight(false) * s);
SDL_SetRenderScale(m_renderer, s, s); SDL_SetRenderScale(m_renderer, s, s);
} }

View file

@ -127,8 +127,8 @@ namespace ogfx
inline void hide(void) { SDL_HideWindow(m_window); m_visible = false; } inline void hide(void) { SDL_HideWindow(m_window); m_visible = false; }
inline void show(void) { SDL_ShowWindow(m_window); m_visible = true; } inline void show(void) { SDL_ShowWindow(m_window); m_visible = true; }
inline String getTitle(void) const { return m_title; } inline String getTitle(void) const { return m_title; }
inline i32 getWindowWidth(void) const { return m_windowWidth; } inline i32 getWindowWidth(bool scaled = true) const { return scaled ? cast<f32>(m_windowWidth) / getScaleFactor() : m_windowWidth; }
inline i32 getWindowHeight(void) const { return m_windowHeight; } inline i32 getWindowHeight(bool scaled = true) const { return scaled ? cast<f32>(m_windowHeight) / getScaleFactor() : m_windowHeight; }
inline Color getClearColor(void) const { return m_clearColor; } inline Color getClearColor(void) const { return m_clearColor; }
inline void setClearColor(const Color& color) { m_clearColor = color; } inline void setClearColor(const Color& color) { m_clearColor = color; }
inline SDL_Renderer* getSDLRenderer(void) { return m_renderer; } inline SDL_Renderer* getSDLRenderer(void) { return m_renderer; }

View file

@ -273,6 +273,7 @@ class Window : public ogfx::gui::Window
{ {
auto& wrd = cast<ogfx::WindowResizedData&>(signal.userData); auto& wrd = cast<ogfx::WindowResizedData&>(signal.userData);
m_tabs.setSize(cast<f32>(getWindowWidth()), cast<f32>(getWindowHeight() - getMenuBar().geth() - getToolBar().geth() - getStatusBar().geth())); m_tabs.setSize(cast<f32>(getWindowWidth()), cast<f32>(getWindowHeight() - getMenuBar().geth() - getToolBar().geth() - getStatusBar().geth()));
std::cout << m_tabs.getSize() << "\n";
m_tabs.setPosition(0, -1); m_tabs.setPosition(0, -1);
m_tabs.refreshCurrentTab(); m_tabs.refreshCurrentTab();