-
-
Notifications
You must be signed in to change notification settings - Fork 799
Draft: Liquid Glass Adaptation on UIScrollView #4275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
johnzhou721
wants to merge
8
commits into
beeware:main
Choose a base branch
from
johnzhou721:solarium
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4d381f2
Initial commit for Liquid Glass Adaptation
johnzhou721 e463331
Example fix; driveby for Cocoa
johnzhou721 3b676a4
Basic detection support for Liquid Glass
johnzhou721 51c66e3
Remove mysteriously appearing file
johnzhou721 5124458
Adapt to iOS 18.
johnzhou721 8a76532
Strip branches, add a wordy changenote.
johnzhou721 547d941
Comment out scroll_horizontal property
johnzhou721 a8f27ee
Update scrollcontainer.py
johnzhou721 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| On iOS 18-, system effects are applied to the title bar when a ScrollContainer is the content of the window and reaches the titlebar area; on iOS 26+, system effects are consistently applied to the title bar when a ScrollContainer simply reaches the top of the window container layout. |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from ctypes import c_bool, c_char_p, c_uint32, c_void_p, cdll, util | ||
|
|
||
| cf = cdll.LoadLibrary(util.find_library("CoreFoundation")) | ||
|
|
||
| kCFStringEncodingUTF8 = 134217984 | ||
|
|
||
| CFBundleRef = c_void_p | ||
| CFURLRef = c_void_p | ||
| CFStringRef = c_void_p | ||
|
|
||
|
|
||
| cf.CFBundleGetMainBundle.restype = CFBundleRef | ||
| cf.CFBundleGetMainBundle.argtypes = [] | ||
|
|
||
| cf.CFBundleCopyBundleURL.restype = CFURLRef | ||
| cf.CFBundleCopyBundleURL.argtypes = [CFBundleRef] | ||
|
|
||
| cf.CFBundleCopyInfoDictionaryForURL.restype = c_void_p | ||
| cf.CFBundleCopyInfoDictionaryForURL.argtypes = [CFURLRef] | ||
|
|
||
| cf.CFDictionaryGetValue.restype = c_void_p | ||
| cf.CFDictionaryGetValue.argtypes = [c_void_p, c_void_p] | ||
|
|
||
| cf.CFStringCreateWithCString.restype = CFStringRef | ||
| cf.CFStringCreateWithCString.argtypes = [c_void_p, c_char_p, c_uint32] | ||
|
|
||
| cf.CFBooleanGetValue.restype = c_bool | ||
| cf.CFBooleanGetValue.argtypes = [c_void_p] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| from platform import ios_ver | ||
|
|
||
| from .core_foundation import cf, kCFStringEncodingUTF8 | ||
| from .sdk_version import get_sdk_version | ||
|
|
||
| bundle = cf.CFBundleGetMainBundle() | ||
| url = cf.CFBundleCopyBundleURL(bundle) | ||
| info_dict = cf.CFBundleCopyInfoDictionaryForURL(url) | ||
| key_cf = cf.CFStringCreateWithCString( | ||
| None, b"UIDesignRequiresCompatibility", kCFStringEncodingUTF8 | ||
| ) | ||
| value_cf = cf.CFDictionaryGetValue(info_dict, key_cf) | ||
| if value_cf is None: | ||
| value_py = None | ||
| else: | ||
| value_py = bool(cf.CFBooleanGetValue(value_cf)) | ||
| supports_liquid_glass = False | ||
| if value_py is True: | ||
| supports_liquid_glass = False | ||
| elif value_py is False: | ||
| supports_liquid_glass = True | ||
| else: | ||
| supports_liquid_glass = int(get_sdk_version().split(".")[0]) >= 26 | ||
|
|
||
| supports_liquid_glass = ( | ||
| supports_liquid_glass and int(ios_ver().release.split(".")[0]) >= 26 | ||
| ) | ||
|
|
||
| __all__ = ["supports_liquid_glass"] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import ctypes | ||
|
|
||
| MH_MAGIC = 0xFEEDFACE | ||
| MH_MAGIC_64 = 0xFEEDFACF | ||
|
|
||
| LC_BUILD_VERSION = 0x32 | ||
|
|
||
|
|
||
| class MachHeader32(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("magic", ctypes.c_uint32), | ||
| ("cputype", ctypes.c_uint32), | ||
| ("cpusubtype", ctypes.c_uint32), | ||
| ("filetype", ctypes.c_uint32), | ||
| ("ncmds", ctypes.c_uint32), | ||
| ("sizeofcmds", ctypes.c_uint32), | ||
| ("flags", ctypes.c_uint32), | ||
| ] | ||
|
|
||
|
|
||
| class MachHeader64(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("magic", ctypes.c_uint32), | ||
| ("cputype", ctypes.c_uint32), | ||
| ("cpusubtype", ctypes.c_uint32), | ||
| ("filetype", ctypes.c_uint32), | ||
| ("ncmds", ctypes.c_uint32), | ||
| ("sizeofcmds", ctypes.c_uint32), | ||
| ("flags", ctypes.c_uint32), | ||
| ("reserved", ctypes.c_uint32), | ||
| ] | ||
|
|
||
|
|
||
| class LoadCommand(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("cmd", ctypes.c_uint32), | ||
| ("cmdsize", ctypes.c_uint32), | ||
| ] | ||
|
|
||
|
|
||
| class BuildVersionCommand(ctypes.Structure): | ||
| _fields_ = [ | ||
| ("cmd", ctypes.c_uint32), | ||
| ("cmdsize", ctypes.c_uint32), | ||
| ("platform", ctypes.c_uint32), | ||
| ("minos", ctypes.c_uint32), | ||
| ("sdk", ctypes.c_uint32), | ||
| ("ntools", ctypes.c_uint32), | ||
| ] | ||
|
|
||
|
|
||
| libc = ctypes.CDLL(None) | ||
| _dyld_get_image_header = libc._dyld_get_image_header | ||
| _dyld_get_image_header.restype = ctypes.c_void_p | ||
| _dyld_get_image_header.argtypes = [ctypes.c_uint32] | ||
|
|
||
|
|
||
| def decode_version(v): | ||
| return f"{v >> 16}.{(v >> 8) & 0xFF}.{v & 0xFF}" | ||
|
|
||
|
|
||
| def get_sdk_version(): | ||
| mh_ptr = _dyld_get_image_header(0) | ||
| magic = ctypes.c_uint32.from_address(mh_ptr).value | ||
|
|
||
| if magic == MH_MAGIC_64: | ||
| header = MachHeader64.from_address(mh_ptr) | ||
| cmd_ptr = mh_ptr + ctypes.sizeof(MachHeader64) | ||
| elif magic == MH_MAGIC: | ||
| header = MachHeader32.from_address(mh_ptr) | ||
| cmd_ptr = mh_ptr + ctypes.sizeof(MachHeader32) | ||
| else: | ||
| return None | ||
|
|
||
| for _ in range(header.ncmds): | ||
| lc = LoadCommand.from_address(cmd_ptr) | ||
|
|
||
| if lc.cmd == LC_BUILD_VERSION: | ||
| cmd = BuildVersionCommand.from_address(cmd_ptr) | ||
| return decode_version(cmd.sdk) | ||
|
|
||
| cmd_ptr += lc.cmdsize | ||
|
|
||
| return None | ||
|
|
||
|
|
||
| __all__ = ["get_sdk_version"] |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by fix.