Conversation
meh7an
marked this pull request as draft
September 10, 2026 19:43
meh7an
force-pushed
the
feature/pip-navigation-buttons
branch
from
September 10, 2026 23:05
3fe2c9b to
bafb166
Compare
meh7an
marked this pull request as ready for review
September 10, 2026 23:08
meh7an
force-pushed
the
feature/pip-navigation-buttons
branch
3 times, most recently
from
September 16, 2026 15:10
2d21f99 to
fdcf6f9
Compare
meh7an
marked this pull request as draft
September 16, 2026 15:12
Keep the album alive while the viewer hands a video over, so the window can walk it, and return to the window when a later jump lands back on a video. While hidden the viewer only follows its place in the album. A request for the same message does not toggle it closed, and the album is released once the window is dismissed for good.
meh7an
force-pushed
the
feature/pip-navigation-buttons
branch
from
September 16, 2026 15:57
fdcf6f9 to
77142a9
Compare
meh7an
marked this pull request as ready for review
September 16, 2026 16:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Picture-in-Picture window has no way to move between items in an album. Keyboard navigation does not reach it either, since it has no focus handling, so once a video opens there the only ways onward are closing the window or pressing Enlarge.
This adds Previous and Next buttons to the Pip window.
Changes
OverStatevalues and twoButtons, centred on the left and right edges, reusing the existing Pip button style and hover fade. They are painted and hit-tested only when a neighbour exists, so no dead arrow appears at either end of an album.Pip::DelegategainspipCanNavigate(int)andpipNavigate(int), implemented byOverlayWidget, which owns the shared media slice andmoveToNext().clearBeforeHide()takes akeepMediaContextflag. Handing a video to a Pip window previously cleared_messageand the shared media, user photos and collage slices, so the album the video came from was gone and navigation was impossible. Streaming and UI resources are still released as before. A viewer hidden this way only follows its place in the album: shared media and user photo updates refresh the navigation state and return, andchangingMsgId()leaves it alone.show()runs its same-message toggle only while the viewer is shown; on a hidden one it askedclose()for nothing and the request was swallowed.pipDismissed()replaces the plain_pip = nullptrwhere the window goes away for good (its close button, the message deleted, a passcode lock, an account change): if the viewer is hidden it releases the retained context the wayhide()did before. Handovers, where the viewer or a new window takes over the stream, keep the plain reset.pipNavigate()defers to the existing_showAsPippath.displayDocument()already moves a streaming video into a fresh Pip window while that flag is set, so the jump between two videos is handled there; a_pipGenerationcounter distinguishes that from the case where nothing happened, and only the latter falls back to the viewer. A pointer comparison would not be safe here, since the previousPipWrapis destroyed and its address may be reused. The fallback shows the viewer through the samebeforeShow()andmoveToScreen()steps asdisplayFinished().displayFinished()does not raise the viewer while a jump is in flight. A neighbour that had to be downloaded first re-displays in the background once it can be streamed, anddisplayDocument()moves it into the window at that moment, as it does for any playable video while_showAsPipis set._showAsPipstays set as before, so a jump that lands on a photo hands over to the viewer, since Pip cannot display one, and the next video, whether reached with the viewer's arrows, re-displayed after a download or opened from a chat, goes back into the window. Only Enlarge ends that, as on dev.Piptakes over the hover state from the cursor position before its first paint, through the samehandleMouseMove()a real hover uses, then finishes the controls fade at once. A window created under a cursor that is not moving receives no mouse move event, so its controls stayed hidden, faded back in and showed the default cursor until the mouse moved. Every jump builds a new window under the cursor, so a jump now looks like the same window changing its video.kControlsCountgoes from 7 to 9 in the OpenGL and RHI Pip renderers, with the two icons appended to their atlases at indices 7 and 8. The software renderer needs no atlas change.Pipholds its document through a const pointer, so continuing in the window means building a newPiprather than re-pointing the existing one. The request arrives from inside the Pip mouse handler, so the teardown is deferred until that handler has returned.Testing
Built Debug on macOS against this base. Exercised by hand on both the OpenGL and the RHI renderer: video to video staying in the window, video to photo handing off to the viewer, returning to the window on a later video, and the controls remaining visible across a jump. The software renderer was not exercised, though it needs no atlas change.
After the review: open a video, Pip, close the window with its button, click the same video again. It reopens, as a Pip window, which is how dev reopens it as well since
_showAsPipstays set (99501d8). Previous and Next between videos, onto a photo and back onto a video re-checked. The deleted-message and passcode paths sharepipDismissed()and were not exercised by hand. Also: Pip, arrow onto a photo, close the viewer, open a video from a chat: it opens as a Pip; from that photo the viewer's own arrow onto a video returns to the window; after Enlarge the next video opens in the viewer.Screenshot