Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix the vnc view not change mode if mobile has changed show mode #566

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/lib/cooperation/core/gui/phone/screenmirroringwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,33 @@ void ScreenMirroringWindow::handleSizeChange(const QSize &size)
initShow = true;
}

this->resize(w, h);
// only the size is biger current size can be resized.
if (w > this->width() || h > this->height()) {
m_expectSize = QSize(0, 0); // has been resize, reset.
this->resize(w, h);
} else {
m_expectSize = size; // record expected size which is not resized
}
}

void ScreenMirroringWindow::changeEvent(QEvent *event)
{
if (event->type() == QEvent::WindowStateChange) {
if (isMaximized() || isMinimized()) {
m_previousSize = size();
} else {
if (m_vncViewer) {
if (m_expectSize.width() > 0) {
// back to previous size and then do expected changed.
resize(m_previousSize);
handleSizeChange(m_expectSize);
return;
}
}
}
}

QWidget::changeEvent(event);
}

LockScreenWidget::LockScreenWidget(QWidget *parent)
Expand Down
5 changes: 5 additions & 0 deletions src/lib/cooperation/core/gui/phone/screenmirroringwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,15 @@ class ScreenMirroringWindow : public CooperationMainWindow
public slots:
void handleSizeChange(const QSize &size);

protected:
void changeEvent(QEvent *event);

private:
QStackedLayout *stackedLayout { nullptr };
QWidget *bottomWidget { nullptr };
QWidget *workWidget { nullptr };
QSize m_expectSize; // record the size that vnc view expected
QSize m_previousSize; // record the normal window size

QPoint lastPos;
bool isDragging = false;
Expand Down
Loading