Making applications track modifier keys results in unnecessary work for
consumers, it's error prone, and it turns out to have unavoidable bugs.
For example, alt-tabbing with x11 results in the alt modifier state
getting stuck.
To resolve these problems, this patch adds a Mods value to the keyboard
input event.
Based on this patch: d287fa96e3
the NSApplication is in focus.
This NSEvent produces an undocumented NSEventType value `21` that has no
associated variant within the cocoa-rs crate's `NSEventType` enum, thus
causing a segfault when attemptingt to match on the value.
This commit adds a check for `21` to avoid the segfault.
This fixes#104.
Fix issue where key window would lose all mouse events once mouse left
that window.
Make sure that only window under mouse receives mouse scroll wheel
events.
invariants
This also removes the need for "box"ing the callback in favour of
storing a raw `*mut` pointer. We can do this by ensuring that we never
store the pointer for longer than the lifetime of the user callback,
which is the duration of a call to `poll_events` or `run_forever`.
Also removes old commented out event code from the window module.
This is a follow up to the new API introduced in #20.
This also fixes the issue where window resize events would not be
emitted until the end of the resize. This PR fixese #39 by ensuring that
the user callback given to either `EventsLoop::poll_events` or
`EventsLoop::run_forever` can be called by each window delegate's resize
callback directly.
This tracks resizes separately, and synthesizes them for the event iterators as needed, so that OS X apps don't generate a whole set of resize events after each resize.
These events are batched, and delievered en masse at the end of the resize. This isn't a great developer experience (and it should probably be called out in the docs), but it makes it possible for winit client applications to detect and respond to resizes without special-casing Mac OS targets.
See #39. This is only a partial fix, and does not provide on-the-fly resize events.
This fixes propagation of Event::Awakend from wakeup_event_loop() when
using poll_event() on macOS.
Currently wait_event() translates all unknown events into
Event::Awakened so doesn't need the explicit translation.