User can switch between Wait, WaitUntil and Poll modes with key '1', '2' and '3' respectivly.
User can toggle request_redraw calls with the 'R' key.
Helpful for testing all control flow modes and use of request_redraw.
This restores default portable 'C' locale when target locale is unsupported
by X11 backend (Xlib).
When target locale is unsupported by X11, some locale-dependent Xlib
functions like `XSetLocaleModifiers` fail or have no effect triggering
later failures and panics.
When target locale is not valid, `setLocale` should normally leave the
locale unchanged (`setLocale` returns 'C'). However, in some situations,
locale is accepted by `setLocale` (`setLocale` returns the new locale)
but the accepted locale is unsupported by Xlib (`XSupportsLocale` returns
`false`).
Fix#636
* On Wayland, fix coordinates in touch events when scale factor isn't 1
* Explicitly state that Wayland is using LogicalPosition internally
* Fix CHANGELOG
* Remove Wayland theme intermediates
This removes the intermediate struct for passing a Wayland theme to
allow the user direct implementation of the trait.
By passing the trait directly, it is possible for downstream users to
have more freedom with customization without relying on winit to offer
these options as fields.
It should also make maintenance easier, since winit already doesn't
implement all the functions which are offered by the smithay client
toolkit.
* Reimplement SCTK's Theme and ButtonState
* Fix style issues
* Remove public signature
* Format code
* Add change log entry
Co-authored-by: Murarth <murarth@gmail.com>
The current implementation of the event loop runner has some significant
problems. It can't handle multiple events being emitted at once (for
example, when a keyboard event causes a key input, a text input, and a
modifier change.) It's also relatively easy to introduce bugs for the
different possible control flow states.
The new model separates intentionally emitting a NewEvents (poll
completed, wait completed, init) and emitting a normal event, as well as
providing a method for emitting multiple events in a single call.
* Don't discard high-precision cursor position data
Most platforms (X11, wayland, macos, stdweb, ...) provide physical
positions in f64 units, which can contain meaningful fractional
data. For example, this can be empirically observed on modern X11
using a typical laptop touchpad. This is useful for e.g. content
creation tools, where cursor motion might map to brush strokes on a
canvas with higher-than-screen resolution, or positioning of an object
in a vector space.
* Update CHANGELOG.md
Co-Authored-By: Murarth <murarth@gmail.com>
Co-authored-by: Murarth <murarth@gmail.com>
* Fix bug causing RedrawRequested events to only get emitted every other iteration of the event loop.
* Initialize simple_logger in examples.
This PR's primary bug was discovered because a friend of mine reported
that winit was emitting concerning log messages, which I'd never seen
since none of the examples print out the log messages. This addresses
that, to hopefully reduce the chance of bugs going unnoticed in the
future.
* Add changelog entry
* Format
* Update the DPI module docs
* Fix HiDpiFactorChanged doc link
* Incorporate lokathor and icefox feedback
* Adjust documented desktop resolution range
* X11 is one of the reasons I use Windows
* Address DPI generics and float->int rounding
* Revise DPI value statement to better reflect best practices
* Address some of freya's feedback
* phrasing
* Rephrase X11 DPI stuff
* Rename hidpi_factor to scale_factor
* Deprecate WINIT_HIDPI_FACTOR environment variable in favor of WINIT_X11_SCALE_FACTOR
* Rename HiDpiFactorChanged to DpiChanged and update docs
I'm renaming it to DpiChanged instead of ScaleFactorChanged, since I'd
like Winit to expose the raw DPI value at some point in the near future,
and DpiChanged is a more apt name for that purpose.
* Format
* Fix macos and ios again
* Fix bad macos rebase
* fix: use a 'static lifetime for the web backend's `Event` types
* implement hidpi for stdweb (web-sys wip?)
* fix: make all canvas resizes go through backend::set_canvas_size
* update Window docs for web, make `inner/outer_position` return the position in the viewport
* Begin implementing DPI generics
* Fix multithreaded example
* Format
* Fix serde test
* hopefully fix most of the errors
* Fix dpi module errors
* More error fixings
* Format
* fix macos errors
* Another error pass
* Replace bad type signatures
* more fixins