Commit graph

365 commits

Author SHA1 Message Date
Daniel Collin aea92d0f6e Correct version 2022-04-19 19:39:21 +02:00
Daniel Collin 0ed3156941 Update to 0.23 2022-04-19 19:38:52 +02:00
Mara Huldra e96380375c
Reduce wayland dependencies (#293)
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.
2022-04-19 09:47:39 +02:00
Matt Thompson 7019ba41ea
Use coercion on types failing compilation on 64 bit raspbian bullseye (#292)
Awesome! Thanks

Closes #291
2022-04-16 18:27:35 +02:00
Mara Huldra a4f7958fab
wayland: Fix key character callback (#290)
- 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.
2022-04-16 06:47:25 +02:00
Emilio Moretti f42f516339
Wasm websys wip (#239)
* 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>
2022-04-02 17:00:48 +02:00
Daniel Collin 2bf4c248bf Bump version to 0.22 2022-03-27 10:09:45 +02:00
Daniel Collin 80e8d4885a Updated docs for updates 2022-03-27 10:08:10 +02:00
Daniel Collin e1e8a1bd36 Updated to 0.21 2022-03-27 09:58:31 +02:00
Daniel Collin fee9805dff Update to 0.21 2022-03-27 09:58:16 +02:00
Daniel Collin bd2ce1a84f Updated changelog 2022-03-27 09:56:01 +02:00
Daniel Collin 48a41a9f6e Updated docs for update calles 2022-03-27 09:55:46 +02:00
Daniel Collin abbe3db980 Use XkbSetDetectableAutoRepeat on x11
Fixes #284
2022-03-26 20:45:00 +01:00
Arnab Animesh Das 1e5dbad4b8
Add fileapi feature gate of winapi (#281)
When building some apps, it throws an error at  winapi::um::fileapi::GetFullPathNameW as "could not find `fileapi` in `um`". This PR fixes the error.
2022-03-15 08:48:45 +01:00
Daniel Collin 9dcbac0285 Rustfmt 2022-03-14 16:05:25 +01:00
Daniel Collin ad9648769d Fixed button hold on window exit
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
2022-03-14 15:28:55 +01:00
abonnaudet-ledger bedec9b59d
Fix typo in lib.rs (#279) 2022-03-03 11:01:23 +01:00
Greg Depoire--Ferrer 344a1997c7
Memory-map the keymap FD on Wayland to fix EOF error (#278)
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.
2022-02-18 14:35:00 +01:00
Rémi Lauzier 4962afd3f5
small fixes and update (#277) 2022-02-18 09:32:00 +01:00
Andreas Neukoetter 032d616bbe
Add getter for window position. (#276)
* + 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).
2022-02-03 10:01:00 +01:00
Kevin K c25b5d114a
Fix clippy lints under windows (#275) 2022-02-01 22:44:32 +01:00
Kevin K 9a435460b0
Add set_icon() method to set a window icon at runtime (#274)
* 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
2022-01-30 18:29:12 +01:00
Sean Cross ccb2ab474e
inputcallback: add a callback for key events (#271)
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>
2022-01-26 08:36:54 +01:00
Sean Cross 8b9445eea4
key_handler: add a callback for key events (#243)
* 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>
2022-01-26 08:23:38 +01:00
KaDiWa 8927b29a69
macOS: Fix segmentation fault when resizing window (#269) 2021-12-12 23:06:17 +01:00
vemoo 49aad5c586
Revert bump of xkbcommon-sys (#268)
`xkb` still depends on the previous version
and there are some issues in the new version
https://github.com/meh/rust-xkbcommon-sys/issues/7
2021-12-07 07:24:30 +01:00
vemoo 0f7d175621
address clippy lints (#267) 2021-12-06 16:34:01 +01:00
vemoo a4ba00b209
Bump versions (#266)
* bump wayland deps

* bump xkbcommon-sys

* bump raw-window-handle

* bump png
2021-12-06 14:17:01 +01:00
vemoo e0992261c9
fix: EventQueue::dispatch blocks until some events are available (#265)
use non blocking alternative as documented in EventQueue
2021-12-06 12:11:50 +01:00
Daniel Collin 08dcf752af Correct version 2021-11-28 18:50:09 +01:00
Daniel Collin 7c10c2fa78 Bump to 0.20 2021-11-28 18:49:41 +01:00
Daniel Collin 64f2afde3d Fixed typo 2021-11-28 18:08:38 +01:00
Daniel Collin 883679e96b Fix for stuck scrollwheel on macOS 2021-11-28 18:03:01 +01:00
john01dav 2b2540067c
Support typed keys on x11
* 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
2021-11-15 08:45:44 +01:00
Daniel Collin 05cb97aeb0 Rust fmt 2021-10-23 11:40:04 +02:00
Elijah Hartvigsen deb235507f
Changing return types of get_keys from Option<Vec<Key>> to Vec<Key> (#260)
* KeyHandler: Updated return type to Vec on get_keys

* Window: Updated Window structs get_keys return type across all currently supported OS's

* Updated return type of get_keys of Window, and updated the docs for all related functions

* Docs: Corrected incorrect variable ident in docs post update

* Resolved error resulting from get_keys return type change

* Formatting: Ran cargo fmt

Co-authored-by: Zij-IT <elijah.reed@hartvigsen.xyz>
2021-10-23 11:39:18 +02:00
Thomas L. Martin 67fe3a6f29
Minor update to error.rs (#258)
to fix copy/paste issue
2021-09-13 10:04:28 +02:00
dependabot-preview[bot] 1a12653fc2
Upgrade to GitHub-native Dependabot (#247)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-29 05:00:17 +02:00
swismer 75a25ce898
Fix size calculation of non-decorated windows (#245) (#246) 2021-04-03 08:08:51 +02:00
Daniel Collin 0df7c35058 Wrong version 2021-03-23 07:45:38 +01:00
Daniel Collin 0afa9c13f3 Bump to 0.19.3 2021-03-23 07:43:12 +01:00
Quentin Hibon afa0b2ffe5
Add missing words in description (#242) 2021-03-11 06:56:14 +01:00
Marcel Märtens 3e59f17131
update wayland to 0.28 and small cleanup (#241) 2021-03-10 16:35:03 +01:00
Emilio Moretti 241c01219f
Fix wayland missing cursor. (#238)
This fixes the problem with the window automatically closing itself when
the mouse goes over it.
2021-02-21 07:57:29 +01:00
Sean Cross e5b5cc50d5
windows: use c_void from winapi (#235)
The `SelectObject()` call accepts a `HGDIOBJ` which is typecast to a
`std::os::raw::c_void` when building using libstd, and is its own thing
when building with std disabled:

winapi/0.3.9/src/winapi/lib.rs.html:
    #[cfg(feature = "std")]
    pub use std::os::raw::c_void;
    #[cfg(not(feature = "std"))]
    pub enum c_void {}

This patch uses `HGDIOBJ` as the typecast as necessary.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-10 09:04:47 +01:00
Daniel Collin 655e437346 xkbcommon-sys to 0.7.5 2021-01-26 08:53:49 +01:00
Daniel Collin 3a649361ad Bump to 0.19.2 2021-01-19 20:33:13 +01:00
Daniel Jordan ae5172b8a1
Update xkb_keymap reference (#233)
The xkbcommon_sys crate seems to have been updated today, and now the minifb project won't compile. 

We can fix this by updating XKB_KEYMAP_FORMAT_TEXT_v1 to XKB_KEYMAP_FORMAT_TEXT_V1.
2021-01-09 21:12:23 +01:00
CoffmanLevi b39df21ba8
Made the debug text for Error include any sub-errors (#232) 2020-12-30 08:27:32 +01:00
sinclairzx81 ffa4a55487
Fix: winuser | DestroyWindow (#230)
* winuser | DestroyWindow

* rustfmt pass
2020-12-09 13:18:04 +01:00