Prevent window resizes on DPI change.

This commit is contained in:
Bartosz Taudul 2024-03-16 01:13:09 +01:00
parent 4fbef01729
commit c673056dd4
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -220,7 +220,13 @@ static void RecomputeScale()
{ {
if( out.second->entered && out.second->scale > max ) max = out.second->scale; if( out.second->entered && out.second->scale > max ) max = out.second->scale;
} }
if( s_maxScale != max ) tracy::s_wasActive = true; if( s_maxScale != max )
{
tracy::s_wasActive = true;
s_w = s_w / s_maxScale * max;
s_h = s_h / s_maxScale * max;
wl_egl_window_resize( s_eglWin, s_w, s_h, 0, 0 );
}
s_maxScale = max; s_maxScale = max;
} }
@ -645,7 +651,13 @@ static void SurfaceLeave( void*, struct wl_surface* surface, struct wl_output* o
static void SurfacePreferredBufferScale( void*, struct wl_surface* surface, int32_t scale ) static void SurfacePreferredBufferScale( void*, struct wl_surface* surface, int32_t scale )
{ {
if( s_maxScale != scale ) tracy::s_wasActive = true; if( s_maxScale != scale )
{
tracy::s_wasActive = true;
s_w = s_w / s_maxScale * scale;
s_h = s_h / s_maxScale * scale;
wl_egl_window_resize( s_eglWin, s_w, s_h, 0, 0 );
}
s_maxScale = scale; s_maxScale = scale;
} }
@ -851,8 +863,8 @@ void Backend::NewFrame( int& w, int& h )
m_winPos.maximize = s_maximized; m_winPos.maximize = s_maximized;
if( !s_maximized ) if( !s_maximized )
{ {
m_winPos.w = s_w; m_winPos.w = s_w / s_maxScale;
m_winPos.h = s_h; m_winPos.h = s_h / s_maxScale;
} }
w = s_w; w = s_w;