Commit graph

118 commits

Author SHA1 Message Date
Daniel Collin
84242d62b7 rustfmt pass 2019-12-16 08:41:06 +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
01e0ead2ad fixed typo 2019-12-03 15:36:55 +01:00
Daniel Collin
daa57e9fa9 Set arrow as default cursor on Windows 2019-12-03 15:31:45 +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
Daniel Collin
8de9567541 rustfmt pass 2019-11-27 08:03:33 +01:00
Gary Guo
bf4eb2d092 Handle missing Alt keys in X11 (#99) 2019-11-04 08:15:19 +01:00
Gary Guo
e2acdad0c2 Fix window close handling (#98)
Currently we interned WM_DELETE_WINDOW but does not call
XSetWMProtocols to listen to it, causing a fatal error when
closing the window by clicking "X". This patch fixes the issue.
2019-11-02 09:03:49 +01:00
Venceslas
5234be4283 fix 'attempt to subtract with overflow' bug (#96)
* fix 'attempt to subtract with overflow' bug

* Little mistake
2019-10-29 09:30:18 +01:00
Johannes Stölp
e20257db79 unix: replaced scale functions with macro and added missing invocations (#79) 2019-08-23 07:26:14 +02:00
Daniel Collin
b62382bf0c Fixed some compiler warnings 2019-07-21 10:37:47 +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
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
Chris West
ac624f5a26 raise shared_data update (#68)
This helps the check_buffer_size run against the actual
window size, which stops us from segfaulting if the
window size has changed unexpectedly, e.g. because a
window manager is evil.
2019-03-14 16:29:59 +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
tdaffin
3aaf613edd Added Window.is_key_released (#62)
* Added Window.is_key_released

* Add is_key_released for the other platforms
2018-12-18 11:20:32 +01:00
Daniel Collin
3d70a5c7dc Added x16 and x32 scale to X11 2018-05-18 21:59:19 +02:00
Nagy Tibor
5e16895b7d Update orbclient to 0.3.14 on Redox (#55) 2018-05-16 07:12:32 +01:00
Daniel Collin
26e6eca208 Fixed auto scaling and added X8 on Linux
Closes #51
Closes #52
2018-05-05 15:14:57 +02:00
Nagy Tibor
3ffa7ad684 Fix Redox build (#41) 2017-08-15 19:28:44 +02:00
Daniel Collin
5d70e6fc5c Another linux fix 2017-08-11 12:51:04 +02:00
Daniel Collin
eaa0440e8c Another linux fix 2017-08-11 12:49:06 +02:00
Daniel Collin
ca264a7b9a Linux fix 2017-08-11 12:46:34 +02:00
Daniel Collin
900deba9a7 Implemented bounds checking for update_with_buffer 2017-08-11 12:41:24 +02:00
Krzysztof Kondrak
600749fd8a Support period key on *nix. (#37) 2017-07-08 13:57:34 +02:00
xTibor
f4bd8b7704 Redox support (#35) 2017-04-24 09:09:05 +02:00
FlyingGaz
933d7662fb Use to_vec in windows/update_with_buffer (#33) 2017-01-15 17:46:02 +01:00
Daniel Collin
76d9351dc2 Fixed warning 2016-08-02 18:20:19 +02:00
Daniel Collin
4087f3c4c3 Added get_unscaled_mouse_pos 2016-08-02 18:01:25 +02:00
Daniel Collin
99c9bbdfac Swapped incorrect order of resize cursors 2016-07-08 14:27:51 +02:00
Daniel Collin
2a8d09fb28 Char input support on Windows 2016-07-08 14:27:25 +02:00
Daniel Collin
1ca62fa111 Fixed Backspace on Linux 2016-07-08 13:56:41 +02: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
57906b26b8 Removed old menu code 2016-05-09 16:42:24 +02:00
Daniel Collin
06c7c6b05b Added code for menu destroy
But it doesn't work for some reason
2016-05-09 16:41:01 +02:00
Daniel Collin
462effd03c Added accel keys
Fn keys doesn't seem to work yet though
2016-05-09 16:05:53 +02:00
Daniel Collin
37292a70cf Inital menus for Windows implemented 2016-05-09 15:49:26 +02:00
Daniel Collin
0ffa3bf196 Support for removing menus 2016-05-08 13:27:55 +02:00
Daniel Collin
d3fcfd4bf0 Fixed f-keys 2016-05-08 11:00:50 +02:00
Daniel Collin
3c2451c2ec Rustfmt 2016-05-08 10:33:27 +02:00
Daniel Collin
10de5cd84e Cleanup 2016-05-08 10:31:58 +02:00
Daniel Collin
ab924a4b0d Submenu support 2016-05-08 10:24:37 +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
6de1909445 Added missing InputCallback 2016-05-01 16:06:33 +02:00