Commit graph

36 commits

Author SHA1 Message Date
Osspial 9602716ed2
Event Loop 2.0 API and Windows implementation (#638)
* Rename EventsLoop and associated types to EventLoop

* Rename WindowEvent::Refresh to WindowEvent::Redraw

* Remove second thread from win32 backend

* Update run_forever to hijack thread

* Replace windows Mutex with parking_lot Mutex

* Implement new ControlFlow and associated events

* Add StartCause::Init support, timer example

* Add ability to send custom user events

* Fully invert windows control flow so win32 calls into winit's callback

* Add request_redraw

* Rename platform to platform_impl

* Rename os to platform, add Ext trait postfixes

* Add platform::desktop module with EventLoopExt::run_return

* Re-organize into module structure

* Improve documentation

* Small changes to examples

* Improve docs for run and run_return

* Change instances of "events_loop" to "event_loop"

* Rename MonitorId to MonitorHandle

* Add CHANGELOG entry

* Improve WaitUntil timer precision

* When SendEvent is called during event closure, buffer events

* Fix resize lag when waiting in some situations

* Update send test and errors that broke some examples/APIs

* Improve clarity/fix typos in docs

* Fix unreachable panic after setting ControlFlow to Poll during some RedrawRequested events.

* Fix crash when running in release mode

* Remove crossbeam dependency and make drop events work again

* Remove serde implementations from ControlFlow

* Fix 1.24.1 build

* Fix freeze when setting decorations

* Replace &EventLoop in callback with &EventLoopWindowTarget

* Document and implement Debug for EventLoopWindowTarget

* Fix some deadlocks that could occur when changing window state

* Fix thread executor not executing closure when called from non-loop thread

* Fix buffered events not getting dispatched

* Fix crash with runner refcell not getting dropped

* Address review feedback

* Fix CHANGELOG typo

* Catch panics in user callback
2019-02-05 10:30:33 -05:00
Francesca Frangipane eadd9a19b2
Replace Closed event with CloseRequested and Destroyed (#476)
* Replace Closed event with CloseRequested and Destroyed

Implements #434

The existing Closed event had ambiguous meaning, both in name and in
cross-platform behavior. Closed is now split into two more precise events:

* CloseRequested - the window has been requested to close, most commonly by
having clicked the window's close button. Whether or not you respond by
closing the window is up to you.

* Destroyed - the window has been destroyed, and can no longer be safely
used.

Most notably, now you can reliably implement classic patterns like
prompting the user to save their work before closing, and have the
opportunity to perform any necessary cleanup.

Migrating to the new API is straightforward. In most cases, you can simply
replace all existing usages of Closed with CloseRequested. For more
information, see the example programs, particularly handling_close and
multiwindow.

iOS applications must replace all usages of Closed with Destroyed, and
require no other changes.
2018-04-24 16:20:40 -04:00
Victor Berger 61d25be3e0
wayland: upgrade wayland-window (#339)
* wayland: upgrade wayland-window

This new version of wayland window considerably simplifies the
window handling for winit, meaning much of the previous juggling
is no longer needed, and the windows will appear even if nothing is
drawn.

* wayland: cleanup unused stuff
2017-11-03 17:35:29 +01:00
Victor Berger c86cf416d5 wayland: add a warning in the examples in case no window is displayed. 2017-07-19 18:53:49 +02:00
mitchmindtree 04ccad1dbc Rename ControlFlow variant from Complete to Break 2017-06-20 21:25:53 +10:00
mitchmindtree db9e80bdb6 Update examples and tests to addition of ControlFlow 2017-06-08 00:12:41 +10:00
Pierre Krieger 7da96121a2 Fix examples 2017-01-28 15:45:01 +01:00
Pierre Krieger 289bb7bc9f Remove android_main! call 2016-11-23 19:33:44 +01:00
Pierre Krieger 007ad0f911 Fix the test and the examples 2016-03-26 18:10:19 +01:00
Pierre Krieger 2b35a6c9d1 Fix the examples 2015-10-04 18:39:17 +02:00
Josh Matthews 77b3743117 Warning fixes for OS X. 2015-09-28 12:19:36 -04:00
Pierre Krieger 9261408cc8 Use modern GL code for the examples 2015-08-05 22:31:34 +02:00
Pierre Krieger 39128dd7e1 Remove the is_closed function 2015-06-16 14:03:58 +02:00
Felix Kaaman a8fef35dbf Make legacy functions crash on osx core contexts 2015-06-16 09:00:02 +02:00
Pierre Krieger c68fdf3af2 Fix examples so that travis passes again 2015-04-17 15:23:13 +02:00
Steven Sheldon 9c21758bb7 Removed unused features from build and examples. 2015-04-03 02:31:15 -07:00
Pierre Krieger d33c138164 Rustup 2015-04-02 22:41:35 +02:00
Pierre Krieger cedc85c550 Rustup 2015-03-25 20:27:18 +01:00
Pierre Krieger 8fcd676714 Iterators returned by wait_events and poll_events are now persistent 2015-01-19 13:11:33 +01:00
Brendan Zabarauskas f5fb030c36 Squash some warnings 2015-01-18 20:11:33 +11:00
Pierre Krieger 469d0eafd1 Update for rust alpha 1.0 2015-01-10 08:23:20 +01:00
Pierre Krieger dbdb43f077 Update for Rustc 2015-01-08 09:28:22 +01:00
Pierre Krieger dbb82968ba Update for rustc 2014-12-23 17:12:29 +01:00
Michael Powell 6e9969ccc0 Add semicolons after macro invocations, as required by the latest nightly. 2014-12-19 21:34:20 -08:00
Pierre Krieger 19d120b8b1 Update for Rustc for win32 2014-12-15 14:06:32 +01:00
Jakob Fries 12d5d5beea Avoid warning; if_let and tuple_indexing now part of language. 2014-12-08 21:12:03 +01:00
Tomaka17 e565bfeb13 Implement headless rendering 2014-10-09 15:55:42 +02:00
Tomaka17 02ba9d33d7 Rename crate to glutin 2014-09-21 11:34:41 +02:00
Tomaka17 3cad622ee8 Examples now using a support module to draw 2014-09-12 08:53:31 +02:00
Tomaka17 0bb82e8467 Add basic support for Android 2014-09-11 18:28:07 +02:00
Tomaka17 ca83db39c7 Rename gl-init-rs to gl_init
Fix #20
2014-08-13 13:42:59 +02:00
Tomaka17 87d62e5b6f get_proc_address now returns a libc::c_void 2014-08-11 10:32:33 +02:00
Pierre Krieger da5e372719 Multiwindow example now creates a third window 2014-08-07 18:15:09 +02:00
Tomaka17 2fdcc1840b Examples now call glViewport 2014-08-07 09:32:13 +02:00
Tomaka17 92f90220a4 Fix events handling in examples 2014-08-07 08:53:21 +02:00
Tomaka17 c0912c9ec4 Add example for multiple simultaneous examples 2014-08-03 17:23:08 +02:00