Disable dialog position save/restore on wxGTK (#1331)
This is currently broken on Wayland, resulting in dialogs showing up in random locations.
This commit is contained in:
parent
e4a9340409
commit
7f06428df8
|
@ -177,6 +177,14 @@ AccelConfig::AccelConfig(wxWindow* parent,
|
||||||
Bind(wxEVT_BUTTON, &AccelConfig::OnResetAll, this, XRCID("ResetAll"));
|
Bind(wxEVT_BUTTON, &AccelConfig::OnResetAll, this, XRCID("ResetAll"));
|
||||||
Bind(wxEVT_TEXT, &AccelConfig::OnKeyInput, this, key_input_->GetId());
|
Bind(wxEVT_TEXT, &AccelConfig::OnKeyInput, this, key_input_->GetId());
|
||||||
|
|
||||||
|
#if !WX_RESIZE_DIALOGS
|
||||||
|
// On wxGTK, the dialog resizing is broken, so we need to set a fixed size.
|
||||||
|
SetWindowStyle(GetWindowStyle() & ~wxRESIZE_BORDER);
|
||||||
|
const wxSize dialog_size(800, 800);
|
||||||
|
SetMinSize(dialog_size);
|
||||||
|
SetMaxSize(dialog_size);
|
||||||
|
#endif // !WX_RESIZE_DIALOGS
|
||||||
|
|
||||||
// And fit everything nicely.
|
// And fit everything nicely.
|
||||||
Fit();
|
Fit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,15 +38,19 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if WX_RESIZE_DIALOGS
|
||||||
const wxRect dialog_rect = this->Get()->GetRect();
|
const wxRect dialog_rect = this->Get()->GetRect();
|
||||||
this->SaveValue("x", dialog_rect.x);
|
this->SaveValue("x", dialog_rect.x);
|
||||||
this->SaveValue("y", dialog_rect.y);
|
this->SaveValue("y", dialog_rect.y);
|
||||||
this->SaveValue("width", dialog_rect.width);
|
this->SaveValue("width", dialog_rect.width);
|
||||||
this->SaveValue("height", dialog_rect.height);
|
this->SaveValue("height", dialog_rect.height);
|
||||||
|
#endif // WX_RESIZE_DIALOGS
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Restore() override {
|
bool Restore() override {
|
||||||
dialog_shown_ = true;
|
dialog_shown_ = true;
|
||||||
|
|
||||||
|
#if WX_RESIZE_DIALOGS
|
||||||
wxRect dialog_rect(0, 0, 0, 0);
|
wxRect dialog_rect(0, 0, 0, 0);
|
||||||
if (!this->RestoreValue("x", &dialog_rect.x)) {
|
if (!this->RestoreValue("x", &dialog_rect.x)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -62,6 +66,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
this->Get()->SetSize(dialog_rect);
|
this->Get()->SetSize(dialog_rect);
|
||||||
|
#endif // WX_RESIZE_DIALOGS
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
|
|
||||||
#include "core/base/check.h"
|
#include "core/base/check.h"
|
||||||
|
|
||||||
|
#if defined(__WXGTK__)
|
||||||
|
// Moving and resizing dialogs does not work properly on wxGTK.
|
||||||
|
#define WX_RESIZE_DIALOGS 0
|
||||||
|
#else
|
||||||
|
#define WX_RESIZE_DIALOGS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
||||||
class BaseDialog : public wxDialog {
|
class BaseDialog : public wxDialog {
|
||||||
|
|
Loading…
Reference in New Issue