Commit graph

378 commits

Author SHA1 Message Date
Daniel Collin 9df8b59940 Updated version and changelog 2023-02-18 13:10:27 +01:00
Daniel Collin 1b58e0e7cc Call XInitThreads on X11
This allows using minifb on multiple threads under x11

Closes #309
2023-02-18 13:07:35 +01:00
Daniel Collin 5afc416681 Updated example 2023-02-18 12:58:08 +01:00
Daniel Collin b48e531e8d Fix for not being able to use F10 key
Closes #310
2023-02-18 12:56:43 +01:00
Heiko Behrens f92e38a181
fix compilation of minifb's X11 binding for 32-bit (#308) 2023-01-29 09:36:26 +01:00
nils måsén c042d26ffd
fix: set byposition flag when removing menus (#304) 2022-12-27 10:53:41 +01:00
Daniel Collin e4881e77f9 Better window title 2022-10-31 21:11:06 +01:00
Daniel Collin b1c94f28e9 Fixed warning 2022-10-31 21:09:51 +01:00
Daniel Collin e3b05aa0e7 fmt 2022-10-31 21:08:02 +01:00
Daniel Collin 16e0886770 Added plasma + text example 2022-10-31 21:07:19 +01:00
smb123w64gb ad331de5c2
ARM and AARCH64 Windows Support (#300)
* ARM and AARCH64 Windows Support
2022-10-11 19:12:00 +02:00
Andreas Neukoetter 193726cd6d
Fix get_window_position for multiscreen setups on macOS. (#299) 2022-07-26 19:00:56 +02:00
Edgar Onghena 3da7b7b22e
Fix X11 window names not supporting UTF-8 (#295) 2022-05-06 15:16:42 +02:00
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