Repository navigation
Ship the Dock a full-size icon on the first launch after an update - #167
Merged
Merged
Conversation
The first-launch refresh from 2.5.1 sets NSApp.applicationIconImage to the Icon Services image for the bundle. Icon Services returns app icons at a nominal 32×32 points, and AppKit rasterises the application icon at the image’s nominal size, so the Dock received a 64×64 pixel bitmap. The ⌘Tab switcher draws tiles at about 128 points and showed it stretched until the next launch, when the refresh is skipped and the bundle icon is used at full size again. OakDockIconImageForBundleAtPath() raises the image’s size to its largest representation before it is handed over, so the bitmap is 2048 pixels. Measured with a drawing-handler probe: nominal 32, 128 and 1024 points rasterise at 64, 256 and 2048 pixels.
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.
Summary
After an in-app update (seen going 2.6.0 → 2.6.1), the TextMate tile in the ⌘Tab app switcher is pixelated until the app is launched a second time.
The first-launch refresh added in 2.5.1 (#121, now
RefreshDockIconIfUpdatedinAppController.mm) setsNSApp.applicationIconImageto[NSWorkspace iconForFile:bundlePath]so the Dock drops its stale tile. Two facts combine badly:applicationIconImageat the image's nominal size. A probe whose drawing handler reports the device rect it is asked to fill gives 64, 256 and 2048 pixels for nominal sizes of 32, 128 and 1024 points.So the refresh hands the Dock a 64×64 pixel bitmap, and the switcher's ~128 point tiles stretch it four times. The next launch skips the refresh (same version) and the bundle icon is used at full size, which is why a restart "fixes" it.
Change
OakDockIconImageForBundleAtPath()in SoftwareUpdate, beside the version-changed check it serves: the Icon Services image with its size raised to the largest representation.RefreshDockIconIfUpdateduses it.Frameworks/SoftwareUpdate/tests/t_dock_icon.mm: the helper's image has a representation of at least 512 points and the image size equals the largest one. It failed to build before the helper existed; the suite passes 35 of 35.Verification
Debug build of this branch, with
defaults write com.macromates.TextMate lastLaunchedVersion 0.0so the refresh fires on launch: the ⌘Tab tile is sharp. The same recipe on a build of main reproduces the pixelated tile.Changelog
Software Update: The Dock and ⌘Tab icon is no longer blurry on the first launch after an update.