* Deduplicate Pixel impl for integers using a macro
* Deduplicate [Logical|Physical][Size|Position] From impls using a macro
Co-authored-by: Osspial <osspial@gmail.com>
At the moment, the wayland code uses ahash to perform hashing
in its various hash mas. This was done because ahash was seen as
the best default in the Rust community at the time. However, most
Rust crates (including `hashbrown`) have since moved to using
foldhash instead.
This move is done for two primary reasons:
- This reduces the number of dependencies in the tree for most GUI
projects. As other projects use foldhash now, this removes ahash
(as well as its five dependencies) from the tree.
- In most cases, foldhash is faster than ahash.
Signed-off-by: John Nunley <dev@notgull.net>
The xfixes implementation is not that reliable and rather simple to
replace, so use x11rb to implement the same functionality.
Fixes#4120.
Co-authored-by: avitran0 <holyhades64@gmail.com>
This avoids using JavaScript exceptions to support `EventLoop::run_app`
on the web, which is a huge hack, and doesn't work with the Exception
Handling Proposal for WebAssembly:
https://github.com/WebAssembly/exception-handling
This needs the application handler passed to `run_app` to be `'static`,
but that works better on iOS too anyhow (since you can't accidentally
forget to pass in state that then wouldn't be dropped when terminating).
Unify the values of `MouseButton` and thus remove `Other` variant in
limit possible buttons to 32, which was picked based on platform
capabilities, where 32 is the highest.
For the reference, SDL has identical limit.
When pressing Ctrl+Space, KeyEvent::text_with_all_modifiers would return
\0. That would get included in the text-input text. When an input method
gets activated, the invalid string returning \0 would get sent as
surrounding text, resulting in a Wayland protocol error and crashing the
application.
This can be tested with the `application` example, looking at the events
shown for mouse wheel movement.
`wl_pointer::axis_discrete` isn't sent in version 8 or higher of
`wl_pointer`. And `sctk` doesn't convert the `value120` events, so
on compositors advertising version 8, only pixel scroll events were
being sent.
This sends `MouseScrollDelta::LineDelta` with a fractional value,
without doing any accumulation. Given `LineDelta` contains `f32` values,
this presumably is expected?
Though it might be good to change the definition of `MouseScrollDelta`
to include both discrete and pixel values, when the compositor sends
both. I'm not familiar with how this works on non-Wayland backends
though.
The API is integrated into the `WindowEvent::Pointer*` API and is
present in form of `TabletTool` variant on corresponding data entries.
For now implemented for Web, Windows, and with limitations for Wayland.
Fixes#99.
Co-authored-by: daxpedda <daxpedda@gmail.com>
For earlier Windows 10 builds (pre-22000), a workaround was necessary
to fix dragging window onto a monitor with different DPI. This commit makes
the old DPI workaround to only apply conditionally on affected Windows versions.
Fixes#4041.