mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't treat window controls as continuous
This commit is contained in:
parent
ec407d57a5
commit
3e6ea8109c
3 changed files with 9 additions and 6 deletions
|
@ -198,7 +198,9 @@ void Panel::initWindow() {
|
||||||
return Flag::None | Flag(0);
|
return Flag::None | Flag(0);
|
||||||
}
|
}
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
if (_controls->controls.geometry().contains(widgetPoint)) {
|
using Result = Ui::Platform::HitTestResult;
|
||||||
|
const auto windowPoint = widget()->mapTo(window(), widgetPoint);
|
||||||
|
if (_controls->controls.hitTest(windowPoint) != Result::None) {
|
||||||
return Flag::None | Flag(0);
|
return Flag::None | Flag(0);
|
||||||
}
|
}
|
||||||
#endif // !Q_OS_MAC
|
#endif // !Q_OS_MAC
|
||||||
|
|
|
@ -659,11 +659,11 @@ OverlayWidget::OverlayWidget()
|
||||||
});
|
});
|
||||||
_helper->mouseEvents(
|
_helper->mouseEvents(
|
||||||
) | rpl::start_with_next([=](not_null<QMouseEvent*> e) {
|
) | rpl::start_with_next([=](not_null<QMouseEvent*> e) {
|
||||||
const auto type = e->type();
|
if (_helper->skipTitleHitTest(e->windowPos().toPoint())) {
|
||||||
const auto position = e->pos();
|
|
||||||
if (_helper->skipTitleHitTest(position)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const auto type = e->type();
|
||||||
|
const auto position = e->pos();
|
||||||
if (type == QEvent::MouseButtonPress) {
|
if (type == QEvent::MouseButtonPress) {
|
||||||
handleMousePress(position, e->button());
|
handleMousePress(position, e->button());
|
||||||
} else if (type == QEvent::MouseButtonRelease) {
|
} else if (type == QEvent::MouseButtonRelease) {
|
||||||
|
@ -804,7 +804,7 @@ void OverlayWidget::setupWindow() {
|
||||||
using Flag = Ui::WindowTitleHitTestFlag;
|
using Flag = Ui::WindowTitleHitTestFlag;
|
||||||
Ui::WindowTitleHitTestFlags result;
|
Ui::WindowTitleHitTestFlags result;
|
||||||
if (!_widget->rect().contains(widgetPoint)
|
if (!_widget->rect().contains(widgetPoint)
|
||||||
|| _helper->skipTitleHitTest(widgetPoint)) {
|
|| _helper->skipTitleHitTest(_widget->mapTo(_window, widgetPoint))) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (widgetPoint.y() <= st::mediaviewTitleButton.height) {
|
if (widgetPoint.y() <= st::mediaviewTitleButton.height) {
|
||||||
|
|
|
@ -215,7 +215,8 @@ void DefaultOverlayWidgetHelper::orderWidgets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultOverlayWidgetHelper::skipTitleHitTest(QPoint position) {
|
bool DefaultOverlayWidgetHelper::skipTitleHitTest(QPoint position) {
|
||||||
return _controls->controls.geometry().contains(position);
|
using namespace Ui::Platform;
|
||||||
|
return _controls->controls.hitTest(position) != HitTestResult::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> DefaultOverlayWidgetHelper::controlsActivations() {
|
rpl::producer<> DefaultOverlayWidgetHelper::controlsActivations() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue