Skip to content

Expose mouse pos #348

Closed
Closed

Description

@stuartnelson3

I'm currently in the process of un-forking glutin in servo. The last issue preventing this is that WindowEvent::MouseInput and WindowEvent::MouseWheel do not provide the mouse's current position.

Since mouse moved events are only received when the window is focused, this makes it possible for a the window to lose focus, the user can move the mouse, and then the window regains focus with its last known mouse position being incorrect. For an application that depends on knowing the mouse position to handle mouse events in different ways, this results in incorrect behavior.

I have two ideas on how to fix this:

  1. Expose the mouse position information on WindowEvent::{MouseInput, MouseWheel}, or
  2. Expose the mouse position information on WindowEvent::Focus (I'll admit this option feels a bit weird, but it could also work).

Do either of these sound like potential options? I would be happy to implement this.

Activity

  1. elinorbgr commented on Nov 12, 2017

    @elinorbgr
    Contributor

    A third option would be to ensure that whenever the window gains pointer focus, a MouseMoved event would be sent after the MouseEntered or Focus event.

  2. stuartnelson3 commented on Nov 12, 2017

    @stuartnelson3
    ContributorAuthor

    That sounds like the simplest solution -- no need to modify the exposed api

  3. stuartnelson3 commented on Nov 14, 2017

    @stuartnelson3
    ContributorAuthor

    Opened a PR, perhaps it's a solution

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions