Fix size of un-resizeable TLW with Wayland

GTK3 does not add the decoration size when using gtk_widget_set_size_request().
See #22155
This commit is contained in:
Paul Cornett
2022-03-16 21:35:18 -07:00
parent 1b129ef9a8
commit 8f47d9ad48

View File

@@ -841,11 +841,12 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
}
m_decorSize = GetCachedDecorSize();
int w, h;
GTKDoGetSize(&w, &h);
int w = m_width;
int h = m_height;
if (style & wxRESIZE_BORDER)
{
GTKDoGetSize(&w, &h);
gtk_window_set_default_size(GTK_WINDOW(m_widget), w, h);
#ifndef __WXGTK3__
gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
@@ -857,6 +858,8 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
// gtk_window_set_default_size() does not work for un-resizable windows,
// unless you set the size hints, but that causes Ubuntu's WM to make
// the window resizable even though GDK_FUNC_RESIZE is not set.
if (!HasClientDecor(m_widget))
GTKDoGetSize(&w, &h);
gtk_widget_set_size_request(m_widget, w, h);
}
@@ -1289,11 +1292,19 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
m_pendingFittingClientSizeFlags &= ~wxSIZE_SET_CURRENT;
#endif // __WXGTK3__
int w, h;
GTKDoGetSize(&w, &h);
gtk_window_resize(GTK_WINDOW(m_widget), w, h);
if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
int w = m_width;
int h = m_height;
if (gtk_window_get_resizable(GTK_WINDOW(m_widget)))
{
GTKDoGetSize(&w, &h);
gtk_window_resize(GTK_WINDOW(m_widget), w, h);
}
else
{
if (!HasClientDecor(m_widget))
GTKDoGetSize(&w, &h);
gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);
}
DoGetClientSize(&m_clientWidth, &m_clientHeight);
wxSizeEvent event(GetSize(), GetId());