mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Ignore invisible widgets when hit testing (#4873)
Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
parent
7c8cabaa42
commit
752825793a
|
@ -17,6 +17,7 @@
|
||||||
- Bugfix: Fixed the Quick Switcher (CTRL+K) from sometimes showing up on the wrong window. (#4819)
|
- Bugfix: Fixed the Quick Switcher (CTRL+K) from sometimes showing up on the wrong window. (#4819)
|
||||||
- Bugfix: Fixed too much text being copied when copying chat messages. (#4812, #4830, #4839)
|
- Bugfix: Fixed too much text being copied when copying chat messages. (#4812, #4830, #4839)
|
||||||
- Bugfix: Fixed empty page being added when showing out of bounds dialog. (#4849)
|
- Bugfix: Fixed empty page being added when showing out of bounds dialog. (#4849)
|
||||||
|
- Bugfix: Fixed issue on Windows preventing the title bar from being dragged in the top left corner. (#4873)
|
||||||
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
|
||||||
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
|
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
|
||||||
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
|
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
|
||||||
|
|
|
@ -379,7 +379,7 @@ void BaseWindow::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
||||||
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
||||||
if (widget == nullptr)
|
if (widget == nullptr || widget->isHidden())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -934,19 +934,25 @@ bool BaseWindow::handleNCHITTEST(MSG *msg, long *result)
|
||||||
{
|
{
|
||||||
bool client = false;
|
bool client = false;
|
||||||
|
|
||||||
for (QWidget *widget : this->ui_.buttons)
|
// Check the main layout first, as it's the largest area
|
||||||
{
|
|
||||||
if (widget->geometry().contains(point))
|
|
||||||
{
|
|
||||||
client = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->ui_.layoutBase->geometry().contains(point))
|
if (this->ui_.layoutBase->geometry().contains(point))
|
||||||
{
|
{
|
||||||
client = true;
|
client = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the titlebar buttons
|
||||||
|
if (!client && this->ui_.titlebarBox->geometry().contains(point))
|
||||||
|
{
|
||||||
|
for (QWidget *widget : this->ui_.buttons)
|
||||||
|
{
|
||||||
|
if (widget->isVisible() &&
|
||||||
|
widget->geometry().contains(point))
|
||||||
|
{
|
||||||
|
client = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
{
|
{
|
||||||
*result = HTCLIENT;
|
*result = HTCLIENT;
|
||||||
|
@ -959,16 +965,17 @@ bool BaseWindow::handleNCHITTEST(MSG *msg, long *result)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (this->flags_.has(FramelessDraggable))
|
|
||||||
|
if (this->flags_.has(FramelessDraggable))
|
||||||
{
|
{
|
||||||
*result = 0;
|
*result = 0;
|
||||||
bool client = false;
|
bool client = false;
|
||||||
|
|
||||||
if (auto widget = this->childAt(point))
|
if (auto *widget = this->childAt(point))
|
||||||
{
|
{
|
||||||
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
std::function<bool(QWidget *)> recursiveCheckMouseTracking;
|
||||||
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
recursiveCheckMouseTracking = [&](QWidget *widget) {
|
||||||
if (widget == nullptr)
|
if (widget == nullptr || widget->isHidden())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -998,6 +1005,8 @@ bool BaseWindow::handleNCHITTEST(MSG *msg, long *result)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't handle the message
|
||||||
return false;
|
return false;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue