Commit graph

105 commits

Author SHA1 Message Date
Alex Janka a8d6d94726 raw window handle 0.5.0 2023-03-06 12:08:09 +11:00
Daniel Collin 9df8b59940 Updated version and changelog 2023-02-18 13:10:27 +01: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
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 fee9805dff Update to 0.21 2022-03-27 09:58:16 +02: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
Rémi Lauzier 4962afd3f5
small fixes and update (#277) 2022-02-18 09:32:00 +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 a4ba00b209
Bump versions (#266)
* bump wayland deps

* bump xkbcommon-sys

* bump raw-window-handle

* bump png
2021-12-06 14:17:01 +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
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 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
Marcel Märtens 3e59f17131
update wayland to 0.28 and small cleanup (#241) 2021-03-10 16:35:03 +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 Collin a56e79ca50 Bump to 0.19.1 2020-09-22 21:00:36 +02:00
Daniel Collin 7e040c240a Bump to 0.19 2020-09-16 08:47:42 +02:00
Evgeniy Reizner de32daf2c1
Remove xkbcommon-sys from x11 dependencies. (#209) 2020-08-23 14:26:06 +02:00
Evgeniy Reizner 8efa8064c7
Remove the 'cast' dependency. (#208) 2020-08-23 14:22:49 +02:00
Daniel Collin e504f1a3e2 Bump to 0.18 2020-08-14 11:56:29 +02:00
Antonino Siena 49004f4380
Update wayland deps (#199)
Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-07-09 21:21:16 +02:00
Daniel Collin d33084f860 Updated to 0.17 2020-07-09 13:50:16 +02:00
Antonino Siena ad5ab6eb69
Forgot xkb deps for x11 (#187)
Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-05-28 10:29:52 +02:00
Arif Roktim adffe0814f
Remove usage of the time crate (#183)
Replace calls to time::precise_time_s with std::time::Instant.

Also replaced the type of a time variable with std::time::Duration
because it played nicely with using Instant
2020-05-21 09:42:43 +02:00
Daniel Collin ed24e436f0 Bump to 0.16.0 2020-04-05 07:34:50 +02:00
Antonino Siena d77e559b0f
Wayland support (#141)
* Wayland implementation restructuration

* Moved previous X11 code into own module

* Moved some data into a common struct between wayland and x11

* Added glue

* Moved common unix functions into module

* Revert commits

* Update x11.rs

* Update x11.rs

* Cargo fmt

* Cargo fmt

* Initial Wayland struct and constructors

* Create Wayland window first

* Window::new constructor and removed error type

* Complete window creation

* More docs

* Fixed window creation

* Proper window creation

* Added byteorder

* Disallow resize and set_title

* Implement is_open() and get_window_handle()

* Fixed get_size() and implemented set_position()

* Wayland set_position was missing

* Added WIP update methods

* Improved update methods

* Added more prototype functions

* Get Keyboard and Mouse device

* outsource input device creation

* get proper mouse positions

* Properly get scroll wheel

* Implement HasRawWindowHandle for Wayland Window

* Implemented updaterate methods

* is active method

* More key handler methods

* Retrieve all events from keyboard and mouse

* Added more DisplayInfo methods

* Improvements for event handling

* Partial support for scaling

* Properly update buffer

* More imports

* Styling, etc.

* Merge

* More code to update the framebuffer

* Added scaling again

* Readded better event handling

* Properly render all colors as non-transparent ones

* Clear all events after being read

* update_with_buffer_stride is not WIP anymore

* Assume a connected keyboard and pointer device

* Moved keyboard and pointer from DisplayInfo into Window

* Support resizing and checking if the window is still open

* Rendering performance improvement

* Less warnings and some comments

* Byteorder now required anymore

* Not anymore resizing the ShmPool below its previous size and remove WlBuffers when told to

* Removed more magic numbers and added comments

* Proper size check of the buffer size

* Less conversions

* save the previous framebuffer size in DisplayInfo instead of seeking the fd

* Set the pixelformat statically depending on whether alpha channel is allowed or not

* Set the fd length only again when the size really changes

* Save resizability so that the size of the window doesnt get changed.

* Fix rerendering issue

* Fix rerendering issue

* Using unstable protocol to support server-side decorations

* Outsource buffer creation code

* Small improvements and comments

* Replaced usage of atomic types

* Cleanup

* Outsource Input handling into own struct

* Use mspc channels instead of Vec for input handling

* Implemented set_cursor_style()

* Proper cursorstyle into string decoding

* Implemented mouse buttons

* Scroll wheel fix

* Handle scroll events

* Updated code for new version of the wayland crate

* Reset scroll after each update

* Starting on keymap support with xkb

* Revert 19a590a

* Add missing bracket

* added missing minimum version for surface.damage_buffer()

* Fix for corrupted pointer images

* Implement scaling

* Remove comments

* Acknowledge only the last configure event when redrawing

* Assign the closure to the toplevel only once

* Own function for buffer filtering

* Dont truncate the fd anymore

* Proper damage surface

* Preventg display from getting dropped first

* custom BufferPool implementation

* Unneccessary printlns

* ack configure before committing

* set active field when keyboard focus enters/leaves the surface

* save modifiers each time they are changed

* Requires xkbcommon-sys to retrieve the keymap - will later be removed

* Prototype function to convert a key

* simplify keymap creation

* handle key event

* simplify button state evaluation

* Create wl_seat earlier so events are not getting missed

* Added key conversions and key offset

* Cargo fmt

* Update keyhandler

* Renaming

* Update xkb keys

* Input callback

* Numpad corrections

* Remove publicity from functions

* Retrieve input devices as early as possible

* TODO

* Small cleanup

* Proper key modifiers update

* Scale::FitScreen cant be implemented for now

* finish menu functions(copied from x11)

* Clean up some stuff

* unused variables

* Less warnings

* Comments and Variable naming improvements

* retrieve toplevel info now with an own method

* Constants

* Remove unused function

* Unused field

* Unused let binding

* Improve code readability

* Change note

* Comments

* Opinionated cleanup

* Comment out unused variables

Might be used later on

* Mouse buttons with boolean state

* Prototype UnixMenu functions

* Renaming

* unimplemented functions

* actually unimplemented

* Minor formatting change

* Remove unused fields

Even if they will be used later on, this would be a breaking change.
It's unnecessary to keep these around no matter what the future may
hold.

* Less unwraping now

* Feature gate x11 and wayland, both enabled by default

* Feature gate dependencies

* Menu is now is a new file for both x11 and wayland

* Feature gate everything

* Cargo fmt

* Simplify conditions

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>

* Missing paranthesis

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>

* Cargo fmt

* Proper debug message

* wayland deps

* xkb dev lib

* Update Cargo.toml

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>

* Update .github/workflows/ci.yml

Co-Authored-By: Cole Helbling <cole.e.helbling@outlook.com>

Co-authored-by: Antonino Siena <a.siena@gmx.de>
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-04-05 06:49:25 +02:00
dependabot-preview[bot] 880e8db6df
Update wayland-protocols requirement from 0.24 to 0.25 (#142)
Updates the requirements on [wayland-protocols](https://github.com/smithay/wayland-rs) to permit the latest version.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-31 09:05:19 +02:00
dependabot-preview[bot] e6514ba553
Update wayland-client requirement from 0.24 to 0.25 (#143)
Updates the requirements on [wayland-client](https://github.com/smithay/wayland-rs) to permit the latest version.
- [Release notes](https://github.com/smithay/wayland-rs/releases)
- [Changelog](https://github.com/Smithay/wayland-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smithay/wayland-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-20 14:01:44 +01:00
MikaelUrankar 9dcde0c913
Add support for armv6, armv7 and aarch64 on FreeBSD (#149) 2020-03-20 13:56:42 +01:00
dependabot-preview[bot] 9d5529422c
Update png requirement from 0.15 to 0.16 (#146)
Updates the requirements on [png](https://github.com/image-rs/image-png) to permit the latest version.
- [Release notes](https://github.com/image-rs/image-png/releases)
- [Changelog](https://github.com/image-rs/image-png/blob/master/CHANGES.md)
- [Commits](https://github.com/image-rs/image-png/compare/v0.15.0...v0.16.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-02 08:54:20 +01:00
Daniel Collin 882e7bc7ad Bump to 0.15.3 2020-01-21 22:13:19 +01:00
Daniel Collin b310fd372c Bump to 0.15.2 2020-01-21 21:35:53 +01:00
Antonino Siena 0a72653310 Restructure Unix implementation in preparation for Wayland support
* Wayland implementation restructuration

* Moved previous X11 code into own module

* Moved some data into a common struct between wayland and x11

* Added glue

* Moved common unix functions into module

* Revert commits

* Update x11.rs

* Update x11.rs

* Cargo fmt

* Cargo fmt
2020-01-18 09:15:15 +01:00
Antonino Siena 51bdfcc5ca Moved codebase to edition 2018 (#127)
* Moved to Rust edition 2018

* Changed redox code as well

* Undo typo

* Another correction
2019-12-30 19:34:27 +01:00
Daniel Collin 5cf1708938 Bump to 0.15.1 2019-12-27 13:28:49 +01:00
Daniel Collin 8b3c2e9b37
Merge dev -> master (#119)
* Deprecated update_with_buffer and added a temporary (update_with_buffer_size) for now. This will later be removed and the update_with_buffer is requiring the size to bu suplied

* Reparation for 0.14 release

* Missed one case

* Minor cleanup

* Switch to C scalar for Unix + rename

Reason is so we can always use optimized scalar even in debug.
Also removed _size so only update_with_buffer(..) takes width, height of the input buffer

* Implemented AspectRatio aware scale on nix

* Implemented image center

* Added UpperLeft center mode for unix

* Moving macOS over to sized update

* Fixed resize not working on macOS

* WIP on macOS

* More WIP on macOS version

* Bunch of macOS updates and fixes

* Fixed broken bg color on macOS

* Windows fixes WIP

* Remove some spamming

* More windows fixes

* Windows fixes for cursor and warnings

* Some cleanup

* rustfmt pass

* Fixed typo

* Added support for limiting update rate

* Added update rate to Windows

* Added update rate to macOS

* Misc fixes

* Fixed resources and maintance badge

* Updated readme

* Updated changelog

* Added rate limit
2019-12-16 08:24:48 +01:00
Daniel Collin 5772cc5380
Merge dev -> master (#111)
* Deprecated update_with_buffer and added a temporary (update_with_buffer_size) for now. This will later be removed and the update_with_buffer is requiring the size to bu suplied

* Reparation for 0.14 release

* Missed one case
2019-12-03 15:24:03 +01:00
Daniel Collin a2633f78ad
Raw window handle (#110)
* Added support for raw-window-handle

Ref #104

* Fixed some typos

* Fixed more typos

* windows fix

* Another windows fix

* Another typo

* More typos

* More windwos fixes

* Yet anonther Windows fix
2019-12-02 15:51:46 +01:00
Florian Blasius 9c86b47ec5 Add support for raspberry pi. (#108) 2019-11-29 19:54:52 +01:00
Daniel Collin b8d4ad098f Bump to 0.13 2019-08-30 17:43:42 +02:00
Daniel Collin 36dbf92a3a Bump version again 2019-07-21 11:09:09 +02:00
Daniel Collin c3c9591788 Bump to 0.12 2019-07-21 11:06:04 +02:00
Chris West d6271e513d Rewrite linux backend in rust (#70)
* x11-rs : don't build libminifb_native.a

* x11-rs : commented out all calls to the mfb_xxx functions.

* x11-rs : added handle field to Window, type is xlib::Window.

Also implemented the get_window_handle() method.

* x11-rs : created a DisplayInfo struct with a setup() method.

* x11-rs : fleshed out DisplayInfo::setup() method some more.

* x11-rs : updated Cargo.toml to require x11_dl "2.16".

That is because we need the XContext type, which seems to be
unavailable in the 2.14 version.

* x11-rs : code to call the XCreateWindow() function.

* x11-rs : call XMapRaise() and XFlush() on our window.

* x11-rs : more work on Window::new() -- ported more stuff from mfb_open().

* x11-rs : create the 'ximage' field in Window::new().

* x11-rs : removed SharedData struct, moved fields into Window.

* x11-rs : ported the set_window_title() method.

* x11-rs : ported creating a "draw_buffer" and the 1:1 scaling code.

* x11-rs : ported the scale_2x() function.

* x11-rs : ported the scale_4x() function.

* x11-rs : ported the set_position() method.

* x11-rs : ported the mfb_close() code, i.e. Drop trait on a Window.

* x11-rs : tidied up code computing "scale" value for a new window.

* x11-rs : implemented Drop trait for DisplayInfo.

* x11-rs : updated the get_scroll_wheel() method.

* x11-rs : tidy up update_with_buffer() and check buffer size.

* x11-rs : ported the check_formats() code.

* x11-rs : ported the init_cursors() code.

* x11-rs : ported the set_cursor_style() code.

* x11-rs : ported the raw_get_mouse_pos() code.

* x11-rs : moved the code implementing Drop trait for Window.

* x11-rs : ported the basic event loop (i.e. raw_process_events).

* x11-rs : ported code handling the WM_DELETE_WINDOW client message.

* x11-rs : added code file "src/os/unix/key_mapping.rs"

This file contains code to map an X keysym to a Unicode char,
which is done via a binary search on a large table.  I ported
the code to Rust and rewrote the binary search as a recursive
function.

* x11-rs : ported the XkbQueryExtension() code.

* x11-rs : fleshed out the process_key() code.

* x11-rs : added test code for keysym_to_unicode(), fixed a table entry.

* x11-rs : another test value for the key_mapping test code.

* x11-rs : ported the update_key_state() code.

* x11-rs : ported the char_callback() code.

* x11-rs : ported the mouse button handling code.

* x11-rs : ported code handling the XConfigureNotify event.

* x11-rs : code tidying, silence most compiler warnings.

* x11-rs : removed the native C code: X11MiniFB.c

* x11-rs : fixed bug in the button handling code.

* x11-rs : made the scale_2x() and scale_4x() code faster.

* merge error

* whitespace

* fix cursors: bad string handling

* upgrade x11-dl

* merge scaling implementations

* multi-window example
2019-03-30 08:18:42 +01:00
Richard Hozák 6c4cba9895 Update winapi (#69)
* Remove duplicate windows dependencies in favor of cfg attribute

* Replace user32 with winuser from winapi

* More replacements from winapi-rs

* Fix remaining type imports

* Remove user32, kernel32 and gdi32 sys crates

Everything comes from winapi-rs now.

* Specify only the features of winapi-rs we need

* Remove star glob imports
2019-03-21 09:55:06 +01:00
Nagy Tibor ceadd15e6c Bump orbclient to 0.3.20 on Redox, remove alpha handling hacks (#67) 2019-01-15 06:10:05 +01:00