This change removes dependency on the `xkb` and `xkbcommon-sys` crates
(and this indirectly, `bindgen` and everything below it) by using our
own ffi wrapper, based on sctk's.
A new feature `dlopen`, enabled by default, is added that causes
xkbcommon to be loaded at runtime instead of linked at build-time.
- Make the character callback use the key converted through the keymap,
instead of trying to perform a direct conversion.
- Store a persistent keymap_state, instead of creating a new one every
time. This makes sure that modifiers such as shift/capslock/ctrl are
taken into account.
Closes#288.
* WIP on wasm support
Fix canvas not showing by actually placing it in the document
Also set the initial title
Use the js! macro to draw pixels
Draw to the canvas using ImageData
It doesn't work because an animation frame needs to be requested somehow
* Complete WASM work into a usable state.
This works on the previous commits and makes it usable.
There is a multi platform example about how to use it here:
https://github.com/dc740/minifb-async-examples
Co-authored-by: Thomas Versteeg <thomasversteeg@gmx.com>
On Windows when moving the cursor out of the window while holding a
mouse button down it would still be set to
true when entering the window
even if the button had been released
outside of the window.
Closes#280
wlroots based compositors reuse the same FD for keymap, so after a first
read is done, the file is seeked to the end and the next read fails,
causing the following error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }'
The Wayland documentation says the FD "can be memory-mapped to provide
a keyboard mapping description" and then "From version 7 onwards, the
fd must be mapped with MAP_PRIVATE by the recipient, as MAP_SHARED may
fail."
Although it is not very clear, it probably means that the FD must be
memory-mapped.
* + Add getter for window position (macos, windows).
+ Add getter STUB for window position (posix x11/wayland).
* Implement getter for window position (posix x11).
* Remove todo from getter for window position and return 0,0 (posix wayland).
* Add set_icon() for Windows
* Start x11 icon method
* Add set_icon() for X11
* Add unimplemented message
* Add Icon class for abstraction
* Adjust example in docs
* Remove CStrings from X11 because of heap allocations
* Fix rustfmt
* Revert accidental changes to image.rs
* Fix doc error
Add a callback for key events. This includes all events such as
Shift, not just text events.
An empty default handler is provided for backwards compatibility.
Signed-off-by: Sean Cross <sean@xobs.io>
* key_handler: add a callback for key events
Add a callback for key events. This includes complete events such as
Shift, not just text events.
A default handler is provided for backwards compatibility.
Signed-off-by: Sean Cross <sean@xobs.io>
* fix: EventQueue::dispatch blocks until some events are available (#265)
use non blocking alternative as documented in EventQueue
Co-authored-by: vemoo <berublan@gmail.com>
* Added not-yet-working draft implementation of proper X11 support for reading correct typed characters
* Made shift work for capital letters with X11, but compose key is still broken
* Compose key and numpad now work correctly in X11
* XIM and XIC are now freed when a window destructor runs
* Ran cargo fmt on x11.rs
* Removed commented-out empty-string
Closes#200