Skip to content

Commit

Permalink
Update TLW size before showing on Wayland when decoration size become…
Browse files Browse the repository at this point in the history
…s known

Fixes initial TLW size being larger than requested
See #23041

(cherry picked from commit 997d20e)
  • Loading branch information
paulcor committed Jan 31, 2023
1 parent 0a8a624 commit 3619d34
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gtk/toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,16 @@ void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)

if (HasClientDecor(m_widget))
{
if (m_decorSize.top == 0 && !gtk_widget_get_realized(m_widget) && m_deferShowAllowed)
{
// shrink m_widget by decoration size before initial show,
// so that overall size remains correct
const int w = wxMax(m_width - decorSize.left - decorSize.right, m_minWidth);
const int h = wxMax(m_height - decorSize.top - decorSize.bottom, m_minHeight);
gtk_window_resize(GTK_WINDOW(m_widget), w, h);
if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);
}
m_decorSize = decorSize;
return;
}
Expand Down

0 comments on commit 3619d34

Please sign in to comment.