Repository navigation
Add cursor_position getter API
#2648
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
Open
amrbashir
wants to merge
22
commits into
rust-windowing:master
Choose a base branch
from
amrbashir:feat/cursor-position
base: master
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.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7f55366
Add `cursor_position` getter API
amrbashir 04aec3c
Restore examples/window.rs
amrbashir 7495b2f
update docs
amrbashir d2bd7af
fix build
amrbashir 5b34692
Update window.rs
amrbashir 5555119
remove `Window::cursor_position`
amrbashir 71985a8
Merge branch 'feat/cursor-position' of https://github.com/amrbashir/w…
amrbashir e08d28d
Merge branch 'master' into feat/cursor-position
amrbashir 64f7e38
Merge branch 'master' into feat/cursor-position
amrbashir 4d6d78d
fix a few missed imports after merge
amrbashir 86506db
Discard changes to dpi/LICENSE
amrbashir a6a7636
Discard changes to dpi/LICENSE
amrbashir f976f2f
revert license file change
amrbashir 5f811f8
Update unreleased.md
amrbashir e48ec28
try fix build
amrbashir 37dbcc7
Update src/changelog/unreleased.md
amrbashir 9ee1fd6
duplicate import
amrbashir 261a709
fix x11 impl
amrbashir 76ba0b6
unsafe
amrbashir 61db908
Merge branch 'master' into feat/cursor-position
amrbashir 1f9a3df
reference `Window::outer_position`
amrbashir cd6b857
macOS: Fix cursor position calculation
madsmtm 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
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 |
|---|---|---|
|
|
@@ -19,7 +19,8 @@ use std::time::{Duration, Instant}; | |
| use web_time::{Duration, Instant}; | ||
|
|
||
| use crate::application::ApplicationHandler; | ||
| use crate::error::{EventLoopError, OsError}; | ||
| use crate::dpi::PhysicalPosition; | ||
| use crate::error::{EventLoopError, ExternalError, OsError}; | ||
| use crate::window::{CustomCursor, CustomCursorSource, Window, WindowAttributes}; | ||
| use crate::{event::Event, monitor::MonitorHandle, platform_impl}; | ||
|
|
||
|
|
@@ -490,6 +491,18 @@ impl ActiveEventLoop { | |
| platform: self.p.owned_display_handle(), | ||
| } | ||
| } | ||
|
|
||
| /// Returns the current cursor position relative to the top-left hand corner of the desktop. | ||
| /// | ||
| /// See [`Window::outer_position`] for more information about the coordinates. | ||
| /// | ||
|
amrbashir marked this conversation as resolved.
Resolved
|
||
| /// ## Platform-specific | ||
| /// | ||
| /// - **iOS / Android / Wayland / Orbital / Web**: Unsupported. | ||
| #[inline] | ||
| pub fn cursor_position(&self) -> Result<PhysicalPosition<f64>, ExternalError> { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It confused me that the return type of this is not |
||
| self.p.cursor_position() | ||
| } | ||
| } | ||
|
|
||
| #[cfg(feature = "rwh_06")] | ||
|
|
||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.