Commit graph

60 commits

Author SHA1 Message Date
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
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
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
Marcel Märtens 3e59f17131
update wayland to 0.28 and small cleanup (#241) 2021-03-10 16:35:03 +01:00
sinclairzx81 ffa4a55487
Fix: winuser | DestroyWindow (#230)
* winuser | DestroyWindow

* rustfmt pass
2020-12-09 13:18:04 +01: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
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
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
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
Alex Melville 8ee5269fa2
add get_keys_released method to Window (#151) 2020-03-17 18:17:04 +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 8de9567541 rustfmt pass 2019-11-27 08:03:33 +01:00
Daniel Collin 38fa50a4ef rustfmt 2019-11-27 07:59:15 +01:00
mishazawa 8d8c8a56db Add example Julia set (#106) 2019-11-27 07:57:32 +01:00
Daniel Collin 29721b0eeb Set back width to 640 2019-07-21 10:36:33 +02:00
Chris West 2b8094cc6c x11 and examples: resize (#72)
* warnings / clippy

* x11: remove deprecated, ignored position hints

* x11: only non-resizable windows have fixed size

* x11: handle resizes of ximage
2019-04-01 10:19:23 +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
Daniel Collin a8a969afee Fixed broken menu example 2018-11-13 21:38:55 +01:00
Daniel Collin 900deba9a7 Implemented bounds checking for update_with_buffer 2017-08-11 12:41:24 +02:00
Daniel Collin a8e5215f55 Fixed incorrect title
Closes #32
2017-01-06 15:33:47 +01:00
Daniel Collin 4087f3c4c3 Added get_unscaled_mouse_pos 2016-08-02 18:01:25 +02:00
Aleksey Kladov 0f6b312e5c Fix typos 2016-07-26 14:43:45 +03:00
Daniel Collin 948dd54595 Implementd char callback on Linux 2016-07-08 13:29:49 +02:00
Daniel Collin 495f7c4cca Added set_title and set_cursor_style 2016-06-24 13:08:01 +02:00
Daniel Collin b5f3cf1ca3 Merge menu-api-rework -> master
Rewrote Menu API
2016-05-12 20:08:37 +02:00
Daniel Collin 8f687c58db Some more cleanup 2016-05-08 13:37:20 +02:00
Daniel Collin df60ca8ecd Cleanup 2016-05-08 13:34:38 +02:00
Daniel Collin 0ffa3bf196 Support for removing menus 2016-05-08 13:27:55 +02:00
Daniel Collin c6f61804e6 Restored f-keys so the work again 2016-05-08 11:01:49 +02:00
Daniel Collin ab924a4b0d Submenu support 2016-05-08 10:24:37 +02:00
Daniel Collin 6f47d190b6 Cleanup + shortcut work 2016-05-08 09:42:21 +02:00
Daniel Collin 835837286f Made it possible to add menu items using builder 2016-05-08 09:28:43 +02:00
Daniel Collin 25ed203497 Fixed shortcuts on Mac 2016-05-08 08:55:22 +02:00
Daniel Collin 42ce3b9286 WIP on new menu stuff 2016-05-08 00:25:31 +02:00
Daniel Collin 4a3eabe8e6 WIP on new Menu system 2016-05-07 12:51:14 +02:00
Daniel Collin 3565e1cb3f Fixed F-keys not working correctly on Mac 2016-04-29 08:57:55 +02:00
Daniel Collin 5d9ca9e585 Merge work from menu branch 2016-03-04 17:36:28 +01:00
Daniel Collin 73813b63f4 Merged window-opts to master
commit 53e9cd45567a1308fdbd2e46763e15b2a3fa3d4c
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:31:38 2016 +0100

    Correct header for v0.4.0

commit fcf64d5dfad0796fee16ce8985e66d1b3e82c5a4
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:30:12 2016 +0100

    More cleanup

commit b7f4b187569a753656f19a74b78d8ada3fd95b70
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:29:23 2016 +0100

    Minor cleanup

commit 7392cd4a5aaad7f0d8332082c75d6cbc41d50ca6
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:28:06 2016 +0100

    Updated example added Changelog link

commit 236a82883a68e576ceb1e38a54b0a18fdc2e4465
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:24:58 2016 +0100

    Updated readme

commit e6bc68721513ca66c5566a19e6bfad33875b3280
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:20:42 2016 +0100

    Doc fixes

commit edfd688f045764b66c944d4aa616c6d48246816d
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 18:20:35 2016 +0100

    Updated with 0.4.0 release info

commit 784628fa9a1de93280592e634b522fd916a7588a
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 15:45:37 2016 +0100

    Fixed bad comment

commit 2c6d8730b566193b573afb5dc95a82987d1c4ce4
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 15:37:52 2016 +0100

    Linux support for WindowOptions

commit cbf7c17c3a92d676f5707095781071016e8b90e1
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 15:05:10 2016 +0100

    Updated Windows version with WindowOptions

commit ed1254245384e3e64c082a8368cbbe4a9f679efa
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 14:32:04 2016 +0100

    Added get_window_handle

commit e4a15f98c70facda7e7b2f30ba95a42091fa078c
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 14:30:34 2016 +0100

    Cleanup + links

commit 7dadb090d1037eade525093e2a541c99940e6a3a
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 14:25:41 2016 +0100

    And again

commit 70bdb0f88812e12bf9ca9adc55c1e52cc36c3ef9
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 14:24:44 2016 +0100

    Try link again

commit b4b7b3c4cda1d958e8f9cf6a2418db68ac32bcc5
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 14:21:54 2016 +0100

    Some cleanup

commit fb9845bae37f6ce9ba309b8a57128ce8c426fbca
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 13:16:23 2016 +0100

    Renamed resizeable to resize

commit 89c5af826612dbd887855dca3937e99856c9fcf2
Author: Daniel Collin <daniel@collin.com>
Date:   Sun Jan 31 12:59:57 2016 +0100

    Working on making Windows a bit more generic

    * Added WindowOptions that can configure how the Window should look and behave better (resize, title, borderless)
    * Renamed update -> update_with_buffer
    * Added update which doesn't take a buffer (used to updated the window without buffers)
2016-01-31 18:34:05 +01:00
Daniel Collin 8bdbc850d5 Merge from mouse-support 2016-01-29 20:16:00 +01:00
Daniel Collin 001bca8f74 Implemented set_position for Mac 2016-01-09 20:49:14 +01:00
Daniel Collin b576ab3139 Started to add set_position 2016-01-09 20:06:07 +01:00
Daniel Collin 49eba1bc05 Heap allocate drawing buffer
On some system it seems that the stack is quite small so now we heap
allocate the buffer instead. Also updated the docs and examples using
that instead of being on the stack. Bumped version to 0.2.4

Closes #8
2016-01-05 21:29:52 +01:00
Daniel Collin 4b87f68125 Moved stuff around + documentation 2016-01-02 21:26:13 +01:00
Daniel Collin 66c36fb6c6 Proper error handling if window create fail 2016-01-02 19:40:41 +01:00
Daniel Collin 8e9f8d33a1 Add support for scaling 2016-01-02 15:49:53 +01:00