Skip to content

Fix SeparatePanel fullscreen origin on Windows - #342

Closed
anriltine wants to merge 2 commits into
desktop-app:masterfrom
HyperlinksSpace:fix-separate-panel-fullscreen-origin
Closed

Fix SeparatePanel fullscreen origin on Windows#342
anriltine wants to merge 2 commits into
desktop-app:masterfrom
HyperlinksSpace:fix-separate-panel-fullscreen-origin

Conversation

@anriltine

Copy link
Copy Markdown

Summary

  • After showFullScreen(), explicitly move/resize the frameless SeparatePanel to the current screen geometry.
  • Fixes Mini Apps that were resized for fullscreen but stayed anchored at the pre-fullscreen panel position on Windows (often with multiple monitors).

Context

Reported in telegramdesktop/tdesktop#30963 (also referenced by #31041 / #31114).

Root cause matches QTBUG-39537 / QTBUG-86899 for frameless windows: QWidget::showFullScreen() applies the fullscreen size but drops the move to the screen origin. Media viewer already works around this by setting screen geometry explicitly; Mini Apps use SeparatePanel, which previously only called plain showFullScreen().

Test plan

  • Windows, single monitor: open a Mini App, enter fullscreen via UI or web_app_request_fullscreen — panel should cover the full screen from the monitor origin.
  • Windows, two monitors: main Telegram window mid-primary; open Mini App fullscreen — panel should cover the primary screen, not remain centered over the main window and overflow.
  • Exit fullscreen — panel returns to the normal anchored size/position.
  • Linux/macOS smoke: Mini App fullscreen still enters/exits correctly.

Made with Cursor

…ows.

Frameless showFullScreen() can resize without moving to the screen origin
(QTBUG-39537), leaving Mini Apps unusable mid-screen. Force the panel onto
the current screen geometry after entering fullscreen.

Fixes telegramdesktop/tdesktop#30963.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant

CLAassistant commented Aug 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread ui/widgets/separate_panel.cpp Outdated
if (fullscreen) {
showFullScreen();
// On Windows, frameless showFullScreen() may resize without moving to
// the screen origin (QTBUG-39537). Mini apps then stay anchored at the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're referencing a fixed Qt bug

@ilya-fedin

Copy link
Copy Markdown
Contributor

Root cause matches QTBUG-39537 / QTBUG-86899 for frameless windows

QTBUG-39357 is fixed long time ago while QTBUG-86899 seem to be completely unrelated (it claims maximized windows behave like fullscreen ones on non-primary monitors and hide taskbar which doesn't seem to be the problem here)?

@ilya-fedin

ilya-fedin commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The root cause could be not a Qt bug at all but our bug: Qt positions windows automatically only unless setGeometry() or move() are called, RpWidget initializes with zero geometry. The Linux transient parent code path already works around that by setting WA_Moved attribute to false, maybe the same should be done before showFullscreen().

RpWidget's zero setGeometry sets WA_Moved, so Qt treats the panel as
explicitly positioned and showFullScreen() only resizes. Clear that
attribute first, matching the Linux transient-parent workaround, instead
of forcing geometry after the fact.

Fixes telegramdesktop/tdesktop#30963.

Co-authored-by: Cursor <cursoragent@cursor.com>
@anriltine

Copy link
Copy Markdown
Author

Thanks, that matches what the Qt sources do.

QTBUG-39537 / QTBUG-86899 was the wrong diagnosis: current Qt already moves a fullscreen window to the monitor rect in QWindowsWindow::setWindowState_sys(). The remaining failure is on our side. RpWidget starts with setGeometry(0, 0, 0, 0), which sets WA_Moved, so QWidgetPrivate::create / QWidget::show() pass that position into the QWindow (setGeometry) instead of resize-only placement at the screen origin.

The previous patch also fought Qt: SetGeometryAndScreen() after showFullScreen() goes through setGeometry_sys(), which clears Qt::WindowFullScreen when not inside setWindowState().

Updated to the same workaround as the Linux transient-parent path in initGeometry(): setAttribute(Qt::WA_Moved, false) before showFullScreen().

@anriltine

Copy link
Copy Markdown
Author

@ilya-fedin thanks again for the review. #342 was the wrong approach (QTBUG citations + SetGeometryAndScreen() after showFullScreen()).

Opened a clean PR with the WA_Moved fix you suggested, based on current master: #343

@anriltine

Copy link
Copy Markdown
Author

Superseded by #343.

@anriltine anriltine closed this Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants