Repository navigation
feat(window): Window.titlebar gives the bar's strip to the image - #2377
Open
isabellaherman wants to merge 1 commit into
Open
isabellaherman wants to merge 1 commit into
isabellaherman wants to merge 1 commit into
Conversation
A window made by `Window.open` always has the system's title bar above its
image. A program that draws its own top strip (a sidebar that runs to the
top edge, tabs where the bar was) has no way to take it.
This adds one effect, in the style of `Window.grab` and `Window.scale`:
def Window.titlebar(window: Window, on: Bool) -> IO(Window)
Off, the bar draws nothing but its close, minimize and zoom buttons, and
the image takes the whole window, under them. On, as `Window.open` makes
it. Nothing changes for a program that never calls it.
- macOS: the window takes NSWindowStyleMaskFullSizeContentView, a
transparent bar and a hidden title. The frame then shrinks to the image's
points from its top left corner, so the image keeps its size and its place
on screen and the window gets shorter by the bar (32 points on macOS 26).
- The strip the bar took still drags the window, and its presses still
reach the program. After a drag from the strip the program also gets the
Press pair, and the release's position is not reliable (seen once at the
press's point, once offset by the drag).
- Fullscreen: a fullscreen window has no bar to change, so the call only
updates the style it will leave with (`full_style`); `fullDone` then sizes
the frame to the image again, from the same top left corner.
- X11 leaves the bar to the window manager, so the call does nothing there.
The JS lane returns the window (it opens none).
Tested: `tests/gfx/window_titlebar.bend` (two foreign probes read the
frame's height over the content view's, and the frame's top edge) prints
True/True natively on macOS 26, interpreted, and under bun on the path where
`Window.open` answers ENOTSUP. A manual probe on a 480x320 window went
off -> fullscreen -> back, fullscreen -> off inside -> back, and
fullscreen -> on inside -> back: the bar read 0 or 32 as asked, the content
320 points and the top edge the same each time. With a real pointer, drags
from y=11 and y=24 moved the window, a drag from y=45 did not, and all
three printed their presses. The close button closes.
Not tested: X11, the mini cluster gate, ASan, `gates/repo.ts` (no ttok
here; the new files match the allow list and no touched file has a cap),
the minimize and zoom buttons, more than one display.
The other window tests do not name the effect, so its code is compiled out
of them.
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.
A window made by
Window.openalways has the system's title bar above itsimage. A program that draws its own top strip (a sidebar that runs to the
top edge, tabs where the bar was) has no way to take it.
This adds one effect, in the style of
Window.grabandWindow.scale:Off, the bar draws nothing but its close, minimize and zoom buttons, and
the image takes the whole window, under them. On, as
Window.openmakesit. Nothing changes for a program that never calls it.
transparent bar and a hidden title. The frame then shrinks to the image's
points from its top left corner, so the image keeps its size and its place
on screen and the window gets shorter by the bar (32 points on macOS 26).
reach the program. After a drag from the strip the program also gets the
Press pair, and the release's position is not reliable (seen once at the
press's point, once offset by the drag).
updates the style it will leave with (
full_style);fullDonethen sizesthe frame to the image again, from the same top left corner.
The JS lane returns the window (it opens none).
Tested:
tests/gfx/window_titlebar.bend(two foreign probes read theframe's height over the content view's, and the frame's top edge) prints
True/True natively on macOS 26, interpreted, and under bun on the path where
Window.openanswers ENOTSUP. A manual probe on a 480x320 window wentoff -> fullscreen -> back, fullscreen -> off inside -> back, and
fullscreen -> on inside -> back: the bar read 0 or 32 as asked, the content
320 points and the top edge the same each time. With a real pointer, drags
from y=11 and y=24 moved the window, a drag from y=45 did not, and all
three printed their presses. The close button closes.
Not tested: X11, the mini cluster gate, ASan,
gates/repo.ts(no ttokhere; the new files match the allow list and no touched file has a cap),
the minimize and zoom buttons, more than one display.
The other window tests do not name the effect, so its code is compiled out
of them.