Commit graph

354 commits

Author SHA1 Message Date
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
Max von Forell c1ff776260
change default pointer visibility to true on wayland (#225) 2020-11-12 11:52:24 +01:00
Santeri Salmijärvi 5e29a18ff4
Windows: Fix mouse positions not honoring MouseMode (#223) 2020-11-05 18:44:41 +01:00
Ondřej Hruška a3852bab8a
Fix Key::RightBracket not working on POSIX (#222)
There was a typo in the mappings, right bracket didn't work.
2020-10-24 06:58:37 +02:00
Rupansh efbe6a1c71
WindowOptions: Support none flag (#219)
* WindowOptions: add none flag

* windows: support none flag

Signed-off-by: rupansh <rupanshsekar@hotmail.com>

* os: implement none flags for other operating systems

redox, posix
not applicable on OSX

* WindowOptions: document none option

Signed-off-by: rupansh-arch <rupanshsekar@hotmail.com>
2020-10-01 13:06:48 +02:00
Daniel Collin a56e79ca50 Bump to 0.19.1 2020-09-22 21:00:36 +02:00
Daniel Collin ee3b185098 Removed dummy logging 2020-09-22 20:59:07 +02:00
Daniel Collin fb7d4b0d08 Fixed typo 2020-09-16 08:49:47 +02:00
Daniel Collin 7e040c240a Bump to 0.19 2020-09-16 08:47:42 +02:00
Daniel Collin 8de1d5718d Rustfmt 2020-09-16 08:40:27 +02:00
Daniel Collin 2646964b9e Add char_callback example 2020-09-16 08:34:02 +02:00
derpeter 65e5be1dcf
change pointer type to plattform specific type as the cast is otherwi… (#212)
* change pointer type to plattform specific type as the cast is otherwise broken on ARM (and maybe other) platform.

* shrink the line changed in previous commit to make linter happy

Co-authored-by: Peter Hasse <peter.hasse@fokus.fraunhofer.de>
2020-09-03 18:16:07 +02:00