Repository navigation
all: move the compositor into internal packages - #20
Merged
Merged
Conversation
The scaling methods become a bg.Scale enum, and -bgscale parses it with flag.TextVar. The unused scaleTile is dropped. CI now runs the tests and builds the extracted packages without cgo so that wlr stays out of them.
-out now parses into output.Config, whose Transform is its own enum that kawa maps to wlr.OutputTransform when it configures an output.
cmd/kawa now holds the flags and fills in Server's exported fields, and Server.Run does what Main did after flag parsing. release and shutdown are unexported, so Run is Server's only exported method. Run accepts a context but does not use it. Errors are logged with the same text as before.
Placement and exclusive zone math now works on an anchor.State that layers.go builds from the layer surface's current state. anchor.Edges has the same bits as the protocol's anchors and wlr_edges, which a test in internal/kawa checks.
draw.Text returns the *image.NRGBA that CreateTextTexture used to upload, so the package no longer needs wlr. kawa uploads it with a small textTexture helper.
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.
Why
kawa was a single
mainpackage at the repository root, so background scaling,-outparsing, layer surface placement, and text drawing could only be exercised through a running compositor. This moves the compositor intointernal/kawabehind a smallcmd/kawaand pulls those four pieces into packages that build without cgo and have their own tests. Runtime behavior does not change.Scope
cmd/kawaparses the flags, starts thePPROF_ADDRserver, callswlr.InitLog, and runs akawa.Server.internal/kawais the oldmainpackage.Serverhas exportedTerms,OutputConfigs,Background, andBackgroundScalefields and one exported method,Run(ctx), which does not use its context.ReleaseandShutdownare nowreleaseandshutdown.internal/bgreplacesscaleFuncandparseScalewithbg.Scale, which implementsencoding.TextMarshalerandTextUnmarshalerforflag.TextVar. The unusedscaleTileis gone.internal/outputreplacesOutputConfig,parseOutputConfigs, andparseTransformwithoutput.Config,output.Transform, andoutput.Parse. kawa mapsoutput.Transformtowlr.OutputTransformwith a table.internal/anchorreplacesplaceLayerSurface,placeSpan, andexcludeZonewithanchor.Placeandanchor.Exclude, which take ananchor.Statethatlayers.gobuilds from the layer surface.drawmoves tointernal/draw, andCreateTextTexturebecomesText, which returns an*image.NRGBAthat kawa uploads../...and runsgo test ./..., plus the extracted packages' tests withCGO_ENABLED=0. The README,launch.sh, and the verify-kawa docs use the new paths.Existing bugs stay as they are. A small image under
-bgscale fitstill sits at the corner, a malformed-outentry still panics, and an unknown transform still meansnormal.Blast Radius
The install path changes from
deedles.dev/kawatodeedles.dev/kawa/cmd/kawa. Nothing outside this module imports the moved code, and the old and new binaries behave the same in every check below.Verification
go fix -diffreports the same two suggestions as on master.-outstrings, 1,000,000 layer placements and exclusions, and 6,045 rendered strings all matched. The-outstrings that panic before also panic now.-houtput is byte-identical.stretch,center,fit, andfillparse the same, and ten invalid-bgscalevalues fail with the same message and exit status 2.-bgand-bgscalecombinations plus a missing file, and fifteen-outvalues. All 39 screenshots are pixel-identical, and the kawa logs match apart from Xwayland event ordering.