mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Try to react to move events in media viewer, again
This time with a weaker geometry check
This commit is contained in:
@@ -359,6 +359,7 @@ OverlayWidget::OverlayWidget()
|
|||||||
DEBUG_LOG(("Viewer Pos: Moved to %1, %2")
|
DEBUG_LOG(("Viewer Pos: Moved to %1, %2")
|
||||||
.arg(position.x())
|
.arg(position.x())
|
||||||
.arg(position.y()));
|
.arg(position.y()));
|
||||||
|
moveToScreen(true);
|
||||||
} else if (type == QEvent::Resize) {
|
} else if (type == QEvent::Resize) {
|
||||||
const auto size = static_cast<QResizeEvent*>(e.get())->size();
|
const auto size = static_cast<QResizeEvent*>(e.get())->size();
|
||||||
DEBUG_LOG(("Viewer Pos: Resized to %1, %2")
|
DEBUG_LOG(("Viewer Pos: Resized to %1, %2")
|
||||||
@@ -478,7 +479,7 @@ void OverlayWidget::refreshLang() {
|
|||||||
InvokeQueued(_widget, [=] { updateThemePreviewGeometry(); });
|
InvokeQueued(_widget, [=] { updateThemePreviewGeometry(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::moveToScreen() {
|
void OverlayWidget::moveToScreen(bool inMove) {
|
||||||
const auto widgetScreen = [&](auto &&widget) -> QScreen* {
|
const auto widgetScreen = [&](auto &&widget) -> QScreen* {
|
||||||
if (auto handle = widget ? widget->windowHandle() : nullptr) {
|
if (auto handle = widget ? widget->windowHandle() : nullptr) {
|
||||||
return handle->screen();
|
return handle->screen();
|
||||||
@@ -499,10 +500,10 @@ void OverlayWidget::moveToScreen() {
|
|||||||
DEBUG_LOG(("Viewer Pos: New actual screen: %1")
|
DEBUG_LOG(("Viewer Pos: New actual screen: %1")
|
||||||
.arg(screenList.indexOf(window()->screen())));
|
.arg(screenList.indexOf(window()->screen())));
|
||||||
}
|
}
|
||||||
updateGeometry();
|
updateGeometry(inMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::updateGeometry() {
|
void OverlayWidget::updateGeometry(bool inMove) {
|
||||||
if (Platform::IsWayland()) {
|
if (Platform::IsWayland()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -523,6 +524,9 @@ void OverlayWidget::updateGeometry() {
|
|||||||
const auto mask = useSizeHack
|
const auto mask = useSizeHack
|
||||||
? QRegion(QRect(QPoint(), available.size()))
|
? QRegion(QRect(QPoint(), available.size()))
|
||||||
: QRegion();
|
: QRegion();
|
||||||
|
if (inMove && use.contains(_widget->geometry())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((_widget->geometry() == use)
|
if ((_widget->geometry() == use)
|
||||||
&& (!useSizeHack || window()->mask() == mask)) {
|
&& (!useSizeHack || window()->mask() == mask)) {
|
||||||
return;
|
return;
|
||||||
|
@@ -223,8 +223,8 @@ private:
|
|||||||
void assignMediaPointer(not_null<PhotoData*> photo);
|
void assignMediaPointer(not_null<PhotoData*> photo);
|
||||||
|
|
||||||
void updateOver(QPoint mpos);
|
void updateOver(QPoint mpos);
|
||||||
void moveToScreen();
|
void moveToScreen(bool inMove = false);
|
||||||
void updateGeometry();
|
void updateGeometry(bool inMove = false);
|
||||||
bool moveToNext(int delta);
|
bool moveToNext(int delta);
|
||||||
void preloadData(int delta);
|
void preloadData(int delta);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user