Skip to content

Conversation

@stuffbucket
Copy link

The Code-Hex/vz library wraps VZVirtualMachineView in an NSScrollView with scrollbars hardcoded to YES (for their zoom feature). This causes ~16px of the VM display to be cut off by scrollbar gutters.

This patch uses Objective-C method swizzling to intercept NSScrollView's setDocumentView: method and disable scrollbars when the document view is a VZVirtualMachineView.

This is a self-contained fix that doesn't require forking the vz library or add any dependencies.

Tested successfully on macOS 26.2 (see screenshot) with Debian 13 (Plasma) and Alpine (serial console).

image 70

The Code-Hex/vz library wraps VZVirtualMachineView in an NSScrollView
with scrollbars hardcoded to YES (for their zoom feature). This causes
~16px of the VM display to be cut off by scrollbar gutters.

This patch uses Objective-C method swizzling to intercept NSScrollView's
setDocumentView: method and disable scrollbars when the document view
is a VZVirtualMachineView.

This is a self-contained fix that doesn't require forking the vz library.

Signed-off-by: stuffbucket <[email protected]>
@stuffbucket
Copy link
Author

Adding images showing the behavior with the scrollbars. In the lower left there is some text that is occluded by the scroll. The scrollbars are not shown relative to the size of the desktop or display, they're hardcoded to be shown all the time. In the console case this seems to not create a problem, but in the desktop case it definitely does.
image 71

image 72 image 73

// a VZVirtualMachineView.
//
// This is a temporary workaround until Code-Hex/vz adds a configuration option
// to disable scrollbars. See: https://github.com/Code-Hex/vz/issues/XXX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link is broken

}

// Constructor attribute ensures this runs before main()
// This patches NSScrollView before Code-Hex/vz creates any windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of monkey patching AppKit, could this be fixed in Code-Hex/vz ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants