fix: make popup windows have a parent per default (#3836)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
- Bugfix: Fixed viewer list not closing after pressing escape key. (#3734)
|
- Bugfix: Fixed viewer list not closing after pressing escape key. (#3734)
|
||||||
- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720)
|
- Bugfix: Fixed links with no thumbnail having previous link's thumbnail. (#3720)
|
||||||
- Bugfix: Add icon in the CMake macOS bundle. (#3832)
|
- Bugfix: Add icon in the CMake macOS bundle. (#3832)
|
||||||
|
- Bugfix: Adopt popup windows in order to force floating behavior on some window managers. (#3836)
|
||||||
- Dev: Rewrite LimitedQueue (#3798)
|
- Dev: Rewrite LimitedQueue (#3798)
|
||||||
- Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801)
|
- Dev: Overhaul highlight system by moving all checks into a Controller allowing for easier tests. (#3399, #3801)
|
||||||
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
- Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662)
|
||||||
|
|||||||
@@ -244,11 +244,31 @@ Window &WindowManager::getSelectedWindow()
|
|||||||
return *this->selectedWindow_;
|
return *this->selectedWindow_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window &WindowManager::createWindow(WindowType type, bool show)
|
Window &WindowManager::createWindow(WindowType type, bool show, QWidget *parent)
|
||||||
{
|
{
|
||||||
assertInGuiThread();
|
assertInGuiThread();
|
||||||
|
|
||||||
auto *window = new Window(type);
|
auto *const realParent = [this, type, parent]() -> QWidget * {
|
||||||
|
if (parent)
|
||||||
|
{
|
||||||
|
// If a parent is explicitly specified, we use that immediately.
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == WindowType::Popup)
|
||||||
|
{
|
||||||
|
// On some window managers, popup windows require a parent to behave correctly. See
|
||||||
|
// https://github.com/Chatterino/chatterino2/pull/1843 for additional context.
|
||||||
|
return &(this->getMainWindow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no parent is set and something other than a popup window is being created, we fall
|
||||||
|
// back to the default behavior of no parent.
|
||||||
|
return nullptr;
|
||||||
|
}();
|
||||||
|
|
||||||
|
auto *window = new Window(type, realParent);
|
||||||
|
|
||||||
this->windows_.push_back(window);
|
this->windows_.push_back(window);
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ public:
|
|||||||
|
|
||||||
Window &getMainWindow();
|
Window &getMainWindow();
|
||||||
Window &getSelectedWindow();
|
Window &getSelectedWindow();
|
||||||
Window &createWindow(WindowType type, bool show = true);
|
Window &createWindow(WindowType type, bool show = true,
|
||||||
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
void select(Split *split);
|
void select(Split *split);
|
||||||
void select(SplitContainer *container);
|
void select(SplitContainer *container);
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
Window::Window(WindowType type)
|
Window::Window(WindowType type, QWidget *parent)
|
||||||
: BaseWindow(BaseWindow::EnableCustomFrame)
|
: BaseWindow(BaseWindow::EnableCustomFrame, parent)
|
||||||
, type_(type)
|
, type_(type)
|
||||||
, notebook_(new SplitNotebook(this))
|
, notebook_(new SplitNotebook(this))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class Window : public BaseWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Window(WindowType type);
|
explicit Window(WindowType type, QWidget *parent);
|
||||||
|
|
||||||
WindowType getType();
|
WindowType getType();
|
||||||
SplitNotebook &getNotebook();
|
SplitNotebook &getNotebook();
|
||||||
|
|||||||
Reference in New Issue
Block a user