Describe the bug
When using wxPreferencesEditor under Wayland, the height of the window is mis-calculated causing it to be too short. It appears to be too short by the height of the title bar + the bottom space which includes the Close button. I'm a 4k monitor which may be influencing the bug.
Expected vs observed behaviour
The window to be sized correctly on Wayland. Observed, the heigh is only calculated correctly on X.
Patch or snippet allowing to reproduce the problem
I believe just running the Preferences Sample application will show the issue.
Platform and version information
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Doing some more testing, it works on Wayland under Ubuntu 21.10, but not on Fedora 35, so there may be a bit more to this.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Doing some more testing, it works on Wayland under Ubuntu 21.10, but not on Fedora 35, so there may be a bit more to this.
Client-side decorations vs not?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
So I'm doing some more debugging and here's what I found; if I launch my program from within VSCode (as a child process using gdb) the prefs window lays out as expected. If I launch it standalone it doesn't layout correctly. Furthermore, if I run the sample prefs app standalone, it works just fine. The only thing I can come up with is for my program we're using the vcpkg version of wxWidgets while for the sample app I built wx directly. Do you know of any build flags that may cause this behavior?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
The other option is the bug was fixed post 3.1.5.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
OK, I have found a reproducible case. If replace the MyFrame() code in the Preferences example with the sizer example code (https://docs.wxwidgets.org/3.0/overview_sizer.html), then show the Preferences window, the preferences window will be crushed. As crazy as it sounds, it seems like sizers inside of sizers in another frame is triggering the issue.
MyFrame() : wxFrame(NULL, wxID_ANY, "Preferences sample")
{
wxMenu *fileMenu = new wxMenu;
fileMenu->Append(wxID_PREFERENCES);
fileMenu->Append(wxID_EXIT);
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, "&File");
SetMenuBar(menuBar);
Bind(wxEVT_MENU, &MyFrame::OnPref, this, wxID_PREFERENCES);
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
Bind(wxEVT_CLOSE_WINDOW, &MyFrame::OnClose, this);
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
// create text ctrl with minimal size 100x60
topsizer->Add(
new wxTextCtrl(this, -1, "My text.", wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE),
1, // make vertically stretchable
wxEXPAND | // make horizontally stretchable
wxALL, // and make border all around
10 ); // set border width to 10
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add(
new wxButton(this, wxID_OK, "OK" ),
0, // make horizontally unstretchable
wxALL, // make border all around (implicit top alignment)
10 ); // set border width to 10
button_sizer->Add(
new wxButton(this, wxID_CANCEL, "Cancel" ),
0, // make horizontally unstretchable
wxALL, // make border all around (implicit top alignment)
10 ); // set border width to 10
topsizer->Add(
button_sizer,
0, // make vertically unstretchable
wxALIGN_CENTER ); // no border and centre horizontally
SetSizerAndFit(topsizer); // use the sizer for layout and size window
// accordingly and prevent it from being resized
// to smaller size
// Show the initial values.
// UpdateSettings();
}
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
The end result looks like this:
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
I should note, I also removed the second page in the preferences example for testing.
//m_prefEditor->AddPage(new PrefsPageTopics());
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Test case as a diff against the preferences sample.
diff --git a/samples/preferences/preferences.cpp b/samples/preferences/preferences.cpp index 4b231fd5d2..a1b05ebdb7 100644 --- a/samples/preferences/preferences.cpp +++ b/samples/preferences/preferences.cpp @@ -24,6 +24,8 @@ #include "wx/sizer.h" #include "wx/artprov.h" #include "wx/frame.h" +#include "wx/textctrl.h" +#include "wx/button.h" // This struct combines the settings edited in the preferences dialog. struct MySettings @@ -81,6 +83,7 @@ public: Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT); Bind(wxEVT_CLOSE_WINDOW, &MyFrame::OnClose, this); +#if 0 wxPanel* const panel = new wxPanel(this); m_textMarkdownSyntax = new wxStaticText(panel, wxID_ANY, ""); m_textSpellcheck = new wxStaticText(panel, wxID_ANY, ""); @@ -95,6 +98,17 @@ public: sizer->Add(m_textSpellcheck, wxSizerFlags().Center()); panel->SetSizer(sizer); +#endif + wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); + topsizer->Add( + new wxTextCtrl(this, -1, "My text.", wxDefaultPosition, wxSize(100,60), wxTE_MULTILINE), + 1, wxEXPAND | wxALL, 10); + wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); + button_sizer->Add(new wxButton(this, wxID_OK, "OK"), 0, wxALL, 10); + button_sizer->Add(new wxButton(this, wxID_CANCEL, "Cancel"), 0, wxALL, 10); + topsizer->Add(button_sizer, 0, wxALIGN_CENTER); + + SetSizerAndFit(topsizer); // Show the initial values. UpdateSettings(); @@ -102,6 +116,7 @@ public: void UpdateSettings() { + return; // Here we should update the settings we use. As we don't actually do // anything in this sample, just update their values shown on screen. const MySettings& settings = wxGetApp().GetSettings(); @@ -298,7 +313,6 @@ void MyApp::ShowPreferencesEditor(wxWindow* parent) { m_prefEditor.reset(new wxPreferencesEditor); m_prefEditor->AddPage(new PrefsPageGeneral()); - m_prefEditor->AddPage(new PrefsPageTopics()); } m_prefEditor->Show(parent);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Should be fixed by 1b129ef and 8f47d9a
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Closed #22155.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()