Skip to content

Conversation

@cxxxr
Copy link
Member

@cxxxr cxxxr commented Jan 2, 2026

Summary

  • Adds pixel-based coordinate system for floating windows in the server/webview frontend
  • Enables smooth sub-character positioning for animations, mouse following, and GUI element placement
  • Maintains backward compatibility with existing character-based positioning API

Changes

Core Layer (src/)

  • interface.lisp: Added generic functions for pixel-aware view creation (make-view-with-pixels, set-view-pos-pixels, set-view-size-pixels) with fallback to character-based methods
  • floating-window.lisp: Extended floating-window class with pixel coordinate slots and convenience functions (floating-window-set-pixel-position, floating-window-set-pixel-size, floating-window-pixel-bounds)
  • window.lisp: Updated make-view-from-window to use pixel coordinates for floating windows when supported
  • internal-packages.lisp: Exported new pixel-related symbols

Server Frontend (frontends/server/)

  • view.lisp: Extended view struct with pixel coordinate fields, JSON encoding support
  • main.lisp: Implemented pixel-aware interface methods, enabled support-pixel-positioning capability

JavaScript Client (frontends/server/frontend/)

  • editor.js: Added pixel positioning in View constructor for floating windows, error handling in move/resize methods

Demo Extension (extensions/pixel-demo/)

  • Bouncing window animation demo (pixel-demo-animate)
  • Mouse-following window demo (pixel-demo-follow-mouse)
  • Coordinate debug display (pixel-demo-debug)
  • Side-by-side pixel vs character mode comparison (pixel-demo-compare)

Tests (tests/)

  • window.lisp: Added comprehensive tests for pixel positioning API

Test Plan

  • Unit tests pass: .qlot/bin/rove lem-tests.asd
  • Pixel demo tests pass: .qlot/bin/rove extensions/pixel-demo/lem-pixel-demo.asd
  • Run M-x pixel-demo-animate - floating window bounces smoothly
  • Run M-x pixel-demo-follow-mouse - window follows mouse cursor at pixel precision
  • Run M-x pixel-demo-compare - visual comparison of smooth vs jerky movement
  • Existing floating windows (completions, hover, etc.) continue to work

Generated with Claude Code

cxxxr and others added 2 commits January 2, 2026 18:25
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Copy link
Contributor

@code-contractor-app code-contractor-app bot left a comment

Choose a reason for hiding this comment

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

Code Contractor validation failed ❌ — see the sticky comment for full results.

@lem-project lem-project deleted a comment from code-contractor-app bot Jan 2, 2026
@cxxxr cxxxr merged commit 250d3f4 into main Jan 2, 2026
9 checks passed
@cxxxr cxxxr deleted the feature/floating-window-pixel-positioning branch January 2, 2026 13:36
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