rust-windowing / rust-windowing/winit

Coordinate systems

Open
#3,891 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

B - bug C - needs discussion C - nominated S - api
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

While doing https://github.com/rust-windowing/winit/pull/3890, I reviewed all our instances of [Physical|Logical|]Position, and categorized them relative to their origin point:

Desktop coordinates:

  • MonitorHandle::position
  • WindowEvent::Moved
  • Window::outer_position/Window::set_outer_position

Window coordinates:

Surface coordinates:

  • Window::set_ime_cursor_area
  • Window::show_window_menu

MouseScrollDelta::PixelDelta is a delta, so it has no origin and hence no coordinate system.

I believe that we should make set_cursor_position, WindowEvent::Pointer*.position and WindowEvent::Drag*.position use surface coordinates, since that's the easier coordinate system for users to work with.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the coordinate categories and API references in this issue, then read pull requests 3890, 3876, and 4079 for the related position behavior. Check how set_cursor_position, WindowEvent::Pointer*.position, and WindowEvent::Drag*.position are currently defined. Done means their coordinate origins are decided and documented consistently with the other listed APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.