Commit graph

317 commits

Author SHA1 Message Date
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
phillvancejr 15bce84a4e
Added Topmost (always on top) functionality to Windows (#159)
* Added always on top functionality for Windows

* Added always on top functionality for Windows

* Made topmost method in Window public so that the topmost attribute can be defined either at or after creation time as opposed to just at creation time. This allows the topmost functionality to be toggled during the programs runtime as opposed to only at window creation
2020-08-28 21:14:49 +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
Daniel Collin 55734cc6fb 0.18 and made minifb usage a bit more clear. 2020-08-14 11:56:17 +02:00
Daniel Collin f99ee45552 Test fix for get_keys_released on Wayland 2020-08-13 20:15:16 +02:00
Nelson Chen 291d8a0441
Support topmost functionality in Windows (#201)
Most of this was taken from #159. This does not include the API addition of adding a topmost call on Window.

That should probably be in another PR. And the doc fixes as well.

Used implementation from https://github.com/emoon/rust_minifb/pull/159#discussion_r401374050

Co-authored-by: phillvancejr <phillipvancejr@gmail.com>
Co-authored-by: Daniel Collin <daniel@collin.com>

Co-authored-by: phillvancejr <phillipvancejr@gmail.com>
Co-authored-by: Daniel Collin <daniel@collin.com>
2020-07-27 09:27:13 +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
Daniel Collin f94eef1c7b
Cargo fmt pass (#198) 2020-07-09 11:53:46 +02:00
Daniel Collin cb0ceee910 Use null for PeekMessageW on Windows 2020-07-09 11:48:22 +02:00
LoganDark d0d3ffcf7b
Rename unixes to posix (#197)
* Rename `unix`es to `posix`

* Whoops

* deprecate get_unix_menus in favor of get_posix_menus

* doc fixes
2020-07-09 10:21:18 +02:00
Rob Watson c5ee83af72
Update README.md to include mention of Wayland support (#189) 2020-06-17 06:33:09 +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
Daniel Collin 849a640eb5 Clamp height in Image_Center 2020-05-23 12:37:25 +02:00
Antonino Siena 31d872353c
Use xkbcommon's function to convert a keysym to a unicode point (#184)
* Use xkbcommon's function to convert a keysym to a unicode point

* Simplified code_point check

Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-05-21 09:46:05 +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
Cameron McCormack 2c3fc9526c
comment fix (#178) 2020-05-04 13:19:45 +02:00
Nelson Chen 542da074fe
Delete old menu system sketch code from 4 years ago (#180)
It's commented out and successor menu code is in.
2020-05-04 13:19:15 +02:00
Antonino Siena b4adefd9d9
[WIP] Cursor visibility (#170)
* Cursor visibility

* Implement cursor visiblity for X11 and Wayland

* Implement cursor visibility for Windows

* Implement cursor visibility on Redox

* Implement cursor visiblity for OSX

* Semicolons

* Wrong method

* Missing argument

Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-04-21 15:13:12 +02:00
Christofer Nolander f769fe60ca
Implemented std::error::Error for minifb::Error (#168)
* Implemented std::error::Error for minifb::Error

* Fix rustfmt
2020-04-20 07:11:10 +02:00
Antonino Siena d2fe8c0469
Transparency (#164)
* Add transparency field to WindowOptions

* Add transparency example

* Implement transparency on Wayland

* Improvements

* [WIP] X11 transparency

* Restructure

* Redox implement transparency

* Update src/lib.rs

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

* Rust-2018 changes

* Fixed issue

* cargo fmt

* [WIP] Implement alpha transparency for windows

* Staging Windows code

* Transparency is currently unimplemented on Windows

* Add note

* Dont use assertions

* Correction

Co-authored-by: Antonino Siena <a.siena@gmx.de>
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-04-15 15:11:23 +02:00
Antonino Siena 29a4c5d9df
Implement borderless on X11 (#165)
* 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>

* Implement borderless on X11

Co-authored-by: Antonino Siena <a.siena@gmx.de>
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2020-04-14 16:36:54 +02:00
Antonino Siena f97d90b7a7
[Testing] Implement is_active() on windows and x11 (#163)
* X11 implement is_active()

* winapi implement is_active()

Co-authored-by: Antonino Siena <a.siena@gmx.de>
2020-04-06 08:21:03 +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
phillvancejr 3d5ae73135
Removed NSLog(@"Names %@", [g_library functionNames]); debug call from src/native/macosx/MacMiniFB.m (#156) 2020-03-31 16:24:21 +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
Daniel Collin 1f21794c8c
Lint fix again 2020-03-31 07:40:11 +02:00
Daniel Collin 434ba591f2
Fixed lint error 2020-03-31 07:35:59 +02:00
phillvancejr fbf1d54db6
Added Topmost/Always on Top functionality to MacOS (#154)
* Added a topmost property to WindowOptons and initialized it to false in WindowOption's default method

* Added an mfb_topmost function that sets the window's floating level to NSFloatingWindowLevel so it will be topmost

* Added an extern definition of mfb_topmost and conditionally call it if WindowOptions.topmost is true

* changing mfb_topmost first arg name from win to window to staty consistent with rust extern declaration
2020-03-31 07:28:52 +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
Lev Eniseev 096147f288
Change Error to use custom fmt::Debug messages (#152)
std::error::Error::description is deprecated, so I changed the
fmt::Display implementation to rely on fmt::Debug implementation, which,
in turn, return human-readable messages like description was doing
2020-03-18 18:53:24 +01:00
Alex Melville 8ee5269fa2
add get_keys_released method to Window (#151) 2020-03-17 18:17:04 +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