feat(floating-window): add pixel-based positioning support#2073
Merged
Conversation
Add pixel coordinate management for floating windows in the server/webview frontend while maintaining backward compatibility with character-unit API. Core changes: - Add support-pixel-positioning slot to implementation class - Add lem-if:make-view-with-pixels, lem-if:set-view-pos-pixels, lem-if:set-view-size-pixels generic functions with fallback defaults - Add pixel-x, pixel-y, pixel-width, pixel-height slots to floating-window - Extend make-floating-window with optional pixel parameters Server frontend: - Add pixel fields to view struct with JSON encoding (pixelX, pixelY, etc.) - Implement pixel-aware interface methods - Enable support-pixel-positioning in jsonrpc class High-level API: - floating-window-set-pixel-position: update pixel position - floating-window-set-pixel-size: update pixel dimensions - floating-window-pixel-bounds: get pixel bounds (explicit or calculated) This enables sub-pixel positioning, smooth animations, variable-width font support, and precise GUI element placement for web-based frontends. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
The previous pixel-based positioning implementation wasn't working because: 1. make-view-from-window always used character coordinates even for floating windows with pixel coordinates set 2. JavaScript View constructor didn't apply pixel coordinates for initial positioning Fixes: - Modified make-view-from-window to check if window is floating and use lem-if:make-view-with-pixels when the implementation supports it - Added pixel coordinate positioning in View constructor for floating windows - Added error handling in move/resize methods - Added nodejs_22 to flake.nix devShell for frontend development - Added pixel-demo extension demonstrating smooth animation and mouse following 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
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
Changes
Core Layer (
src/)make-view-with-pixels,set-view-pos-pixels,set-view-size-pixels) with fallback to character-based methodsfloating-window-set-pixel-position,floating-window-set-pixel-size,floating-window-pixel-bounds)make-view-from-windowto use pixel coordinates for floating windows when supportedServer Frontend (
frontends/server/)support-pixel-positioningcapabilityJavaScript Client (
frontends/server/frontend/)Demo Extension (
extensions/pixel-demo/)pixel-demo-animate)pixel-demo-follow-mouse)pixel-demo-debug)pixel-demo-compare)Tests (
tests/)Test Plan
.qlot/bin/rove lem-tests.asd.qlot/bin/rove extensions/pixel-demo/lem-pixel-demo.asdM-x pixel-demo-animate- floating window bounces smoothlyM-x pixel-demo-follow-mouse- window follows mouse cursor at pixel precisionM-x pixel-demo-compare- visual comparison of smooth vs jerky movementGenerated with Claude Code