Commit graph

251 commits

Author SHA1 Message Date
Victor Berger 4e75c1e668 linux: Add missing Window2::id() impl 2017-03-04 10:48:44 +01:00
Victor Berger 624a422f20 linux: move api transition boilerplate to x11/wayland submodules 2017-03-04 09:09:09 +01:00
Victor Berger 4acf437221 Move api module into platform::linux 2017-03-04 09:09:09 +01:00
Erik Rigtorp 290040dbd8 Implement KeyboardEvent ModifiersState for macOS 2017-02-27 13:38:47 -06:00
Erik Rigtorp 5d41067a05 Implement KeyboardEvent ModifiersState for win32 2017-02-27 13:36:15 -06:00
Erik Rigtorp f3ccdb7aec Add keyboard modifiers to input event
Making applications track modifier keys results in unnecessary work for
consumers, it's error prone, and it turns out to have unavoidable bugs.
For example, alt-tabbing with x11 results in the alt modifier state
getting stuck.

To resolve these problems, this patch adds a Mods value to the keyboard
input event.

Based on this patch: d287fa96e3
2017-02-27 13:36:11 -06:00
mitchmindtree 24b44e3b8e Remove confusingly named event import alias 2017-02-05 20:41:26 +11:00
mitchmindtree ba71f6fb77 Add missing unsafe block to check for main thread macOS 2017-02-05 19:53:13 +11:00
mitchmindtree 926e03039f Panic if the user attempts to create window on non-main thread 2017-02-05 19:47:39 +11:00
mitchmindtree b62ecfd517 Fix comments on macOS backend UserCallback methods 2017-02-05 19:37:00 +11:00
mitchmindtree 30e00f0454 Fix comment on event conversion special case 2017-02-05 19:21:51 +11:00
mitchmindtree 06c1b5903b Fix bug where an NSEvent is produced when a user opens spotlight while
the NSApplication is in focus.

This NSEvent produces an undocumented NSEventType value `21` that has no
associated variant within the cocoa-rs crate's `NSEventType` enum, thus
causing a segfault when attemptingt to match on the value.

This commit adds a check for `21` to avoid the segfault.

This fixes #104.
2017-02-05 19:01:27 +11:00
mitchmindtree cbadc4bc31 Fix issue where window would not focus on startup.
Fix issue where key window would lose all mouse events once mouse left
that window.

Make sure that only window under mouse receives mouse scroll wheel
events.
2017-02-05 18:12:32 +11:00
mitchmindtree 3482c53c89 Rename old glutin ivar to winit 2017-02-05 13:28:56 +11:00
mitchmindtree 3ce7904e01 Wrap the temporarily stored user callback in a type to enforce
invariants

This also removes the need for "box"ing the callback in favour of
storing a raw `*mut` pointer. We can do this by ensuring that we never
store the pointer for longer than the lifetime of the user callback,
which is the duration of a call to `poll_events` or `run_forever`.

Also removes old commented out event code from the window module.
2017-02-05 12:51:09 +11:00
mitchmindtree c03311fa2d Add a method to simplify emitting an event from the macos poll_events and run_forever methods 2017-02-04 13:30:34 +11:00
mitchmindtree fd0ddee63c Panic if the user attempts to run an event loop on a non-main thread on macOS 2017-02-04 02:55:42 +11:00
mitchmindtree ea19409960 Make sure EventsLoop::interrupt awakens the waiting event loop 2017-02-04 02:54:40 +11:00
mitchmindtree 35dcf8dab9 Only return Awakened on NsApplicationActivated, rather than on every unknown event. 2017-02-04 00:51:38 +11:00
mitchmindtree be09639b69 Update the macOS backend to the new futures-compatible API.
This is a follow up to the new API introduced in #20.

This also fixes the issue where window resize events would not be
emitted until the end of the resize. This PR fixese #39 by ensuring that
the user callback given to either `EventsLoop::poll_events` or
`EventsLoop::run_forever` can be called by each window delegate's resize
callback directly.
2017-02-03 23:05:57 +11:00
Pierre Krieger 885b927d23 Merge remote-tracking branch 'origin/master' into impl-20 2017-02-03 09:14:24 +01:00
tomaka ae53bb0f14 Merge pull request #102 from cjhowe/master
iOS Support
2017-02-03 09:09:02 +01:00
Pierre Krieger 422b332c1b Add a transition macro system 2017-01-28 15:00:17 +01:00
Pierre Krieger 8277b26862 No longer use an api_dispatch module for linux 2017-01-28 13:14:20 +01:00
Owen Jacobson 6f82ccfba9
De-duplicate resize events.
This tracks resizes separately, and synthesizes them for the event iterators as needed, so that OS X apps don't generate a whole set of resize events after each resize.
2017-01-24 13:46:46 -05:00
Owen Jacobson 7d6b4c3fe5
Naive implementation of resize events for OS X.
These events are batched, and delievered en masse at the end of the resize. This isn't a great developer experience (and it should probably be called out in the docs), but it makes it possible for winit client applications to detect and respond to resizes without special-casing Mac OS targets.

See #39. This is only a partial fix, and does not provide on-the-fly resize events.
2017-01-24 00:13:45 -05:00
mitchmindtree 9b15440b62 Fix non_upper_case_globals warnings on macos 2017-01-22 17:54:45 +11:00
tomaka 41ac24b107 Merge pull request #113 from samdphillips/mac-middle-mouse-button
Add middle mouse button events for MacOS.
2017-01-19 20:45:51 +01:00
Jeff Muizelaar 3b1fdc0f55 macos: Map our user generated event to Event::Awakened
This fixes propagation of Event::Awakend from wakeup_event_loop() when
using poll_event() on macOS.

Currently wait_event() translates all unknown events into
Event::Awakened so doesn't need the explicit translation.
2017-01-19 14:17:55 -05:00
Sam Phillips 55e52d6071 Add middle mouse events for MacOS. 2017-01-17 19:47:36 -08:00
rerion f5812018ca Add get_x11_xconnection function 2017-01-07 14:34:38 +01:00
rerion d4b8fd9f5a Add methods allowing creation of X11 window with specified visual and screen 2017-01-06 22:46:41 +01:00
Christian Howe ba94b8edf8 Fix Travis iOS build 2016-12-15 21:34:37 -06:00
Christian Howe 5146bce88e Fix iOS build and add to Travis CI 2016-12-13 07:29:17 -06:00
tomaka 3b93c7c664 Merge pull request #95 from frewsxcv/transparent
Implement window transparency on macOS.
2016-12-04 07:59:51 +01:00
Corey Farwell cb0811faf3 Implement window transparency on macOS.
Fixes https://github.com/tomaka/winit/issues/57.
2016-11-30 14:36:51 -05:00
k-brac 7f2ee9a09a remove useless pub 2016-11-29 14:02:19 +01:00
k-brac 3e2154a922 child window created using a winapi::HWND instead of a WindowProxy 2016-11-29 13:02:42 +01:00
k-brac 2b25bf1480 child window creation improvement 2016-11-28 13:50:07 +01:00
k-brac 5a09e8ba21 first try to allow child window on windows 2016-11-25 17:05:39 +01:00
Corey Farwell 57d1e162ee Update min/max window constraints to support MacOS 10.10. 2016-11-23 10:50:12 -05:00
Corey Farwell e3fce3d5ec Implement min/max window dimension constraints for MacOS.
Fixes https://github.com/tomaka/winit/issues/80.
2016-11-23 09:31:41 -05:00
Pierre Krieger 712b27086f Fix win32 panicking all the time and make events work 2016-11-05 13:44:23 +01:00
Victor Berger f371621dd9 linux: remove outdate comment 2016-11-03 22:48:58 +01:00
Andy Barron db45e58390 Add MouseEntered/MouseLeft for Windows, X11, Wayland, & Cocoa 2016-11-03 01:31:16 -07:00
Pierre Krieger cf7c691bd6 Remove emscripten implementation 2016-11-01 16:16:59 +01:00
tomaka 9e404f2fe6 Merge pull request #28 from tomaka/win32-cleanups
Cleanups in the win32 code
2016-11-01 16:10:14 +01:00
Pierre Krieger ef61a46182 Removed pub fields when not needed 2016-10-31 17:30:19 +01:00
Pierre Krieger 158543f336 Remove obsolete comment 2016-10-31 17:29:12 +01:00
Pierre Krieger aace1c0373 Remove dependency on libc when possible 2016-10-31 17:26:26 +01:00
Pierre Krieger 751b0a7ed7 Move the win32 implementation to platform/windows 2016-10-31 17:23:00 +01:00
Pierre Krieger 188ecae101 Move some implementations around 2016-10-31 17:13:11 +01:00
Victor Berger a505eddf29 wayland: bases of backend and output handling 2016-10-09 16:08:10 +02:00
Victor Berger c991172a28 wayland: remove old code for new backend 2016-10-09 16:08:10 +02:00
Andrey Lesnikov 7f6ae8910e Merge https://github.com/tomaka/glutin
Conflicts:
	.travis.yml
	Cargo.toml
	examples/fullscreen.rs
	src/api/android/mod.rs
	src/api/cocoa/headless.rs
	src/api/cocoa/helpers.rs
	src/api/cocoa/mod.rs
	src/api/glx/mod.rs
	src/api/osmesa/mod.rs
	src/api/win32/callback.rs
	src/headless.rs
	src/lib.rs
	src/platform/linux/mod.rs
	src/window.rs
2016-09-19 19:53:28 +03:00
Jan Segre e0f36b80c9 Make WindowBuilder and HeadlessRendererBuilder derive Clone. 2016-05-23 03:17:31 -03:00
Osspial b2cf70b342 Fixed some warnings when building on Windows 2016-05-07 21:05:45 -04:00
Pierre Krieger d216d6b052 Merge remote-tracking branch 'glutin/master' into merge-glutin
Conflicts:
	Cargo.toml
	build.rs
	src/api/caca/mod.rs
	src/api/cocoa/mod.rs
	src/api/egl/ffi.rs
	src/api/egl/mod.rs
	src/api/glx/mod.rs
	src/api/osmesa/mod.rs
2016-03-26 17:55:03 +01:00
Kirill Zdornyy 74a28adba2 Fix this_platform_is_not_supported on OpenBSD.
I followed the steps of @mneumann.
2016-03-01 18:06:13 -08:00
Pierre Krieger 16f76b2407 Make it compile on Linux 2016-02-27 13:59:11 +01:00
Pierre Krieger 10bb03c5f0 Remove most OpenGL stuff and make it compile on win32 2016-02-23 12:56:23 +01:00
Pierre Krieger ec76d991ad Unlocks platform-specific attributes 2016-02-10 17:39:35 +01:00
Pierre Krieger 982279bc39 Update the emscripten port of glutin 2016-02-09 14:25:21 +01:00
Mátyás Mustoha 11bbca7ca7 Replace i8 with libc::c_char 2016-01-26 12:44:34 +01:00
Pierre Krieger 82f5cd8272 Add better X error handling 2015-12-30 14:58:07 +01:00
Victor Berger 83e2924ac2 api/wayland: activate the backend 2015-12-22 14:36:42 +01:00
Emilio Cobos Álvarez a69ded9c8a x11: Improve xlib error reporting 2015-12-15 13:56:35 +01:00
Pierre Krieger 37262fb228 Remove public exports of gl_common and libc 2015-11-09 08:46:52 +01:00
Pierre Krieger 7a625ef3d8 Remove the window feature entirely 2015-10-03 10:33:37 +02:00
Pierre Krieger 86fa1b58e5 Rename MonitorID -> MonitorId 2015-09-24 09:11:59 +02:00
Pierre Krieger aa9cb99929 Add #[inline] attributes 2015-09-23 13:11:47 +02:00
Tim Neumann 9f6806ba2e make glutin compile on all iOS targets 2015-09-21 18:57:35 +02:00
Pierre Krieger 62bafe2130 Remove BuilderAttribs 2015-09-21 14:03:05 +02:00
Pierre Krieger 5182023fd6 Switch X11 and wayland to the new design 2015-09-21 12:04:33 +02:00
Pierre Krieger 8f3ec7998d Finish converting windows to the new design 2015-09-21 12:03:58 +02:00
Pierre Krieger 3054e2ee02 Switch EGL to use only pf_reqs and opengl 2015-09-21 12:03:57 +02:00
Pierre Krieger 48fe9b2644 Extract WindowAttributes from the BuilderAttribs 2015-09-21 12:03:55 +02:00
Pierre Krieger b9a4f5fbe9 Err when a X connection cannot be created instead of panicking 2015-09-20 08:42:32 +02:00
Michael Neumann b707959c2c Make it work on DragonFly/FreeBSD
Tested on DragonFly BSD. Should work similarily on FreeBSD.
2015-08-30 13:52:09 +02:00
Pierre Krieger 587dedaa9e Correctly handle eglGetDisplay 2015-08-07 16:22:31 +02:00
tomaka 829d7a6afc Merge pull request #551 from tomaka/android-headless
Implement headless contexts on android
2015-07-28 19:59:49 +02:00
Pierre Krieger 1f6c4d65a6 Implement headless contexts on android 2015-07-27 10:18:45 +02:00
Pierre Krieger f7cc80fbb1 Headless contexts now create an EGL pbuffer on win32 2015-07-27 10:13:00 +02:00
Pierre Krieger c9b1b91b8c Load the EGL library in platform/windows 2015-07-27 09:52:51 +02:00
Pierre Krieger baf9b92d3f Correct window creation on X11 2015-07-19 13:53:40 +02:00
tomaka 836e53e55a Merge pull request #477 from rozaliev/feature/ios
[WIP] ios support
2015-06-29 09:29:46 +02:00
tomaka 7773996d7b Merge pull request #488 from tomaka/rem-is-closed
Remove the is_closed function
2015-06-17 07:36:16 +02:00
Pierre Krieger 39128dd7e1 Remove the is_closed function 2015-06-16 14:03:58 +02:00
Pierre Krieger f6c26ec593 Handle errors from MakeCurrent and SwapBuffers 2015-06-16 10:44:44 +02:00
Evgeny Rozaliev 84703027d6 [add] ios support 2015-06-05 16:38:35 +03:00
Pierre Krieger 3376332a85 Rework the X implementation to use only one X connection 2015-05-17 19:33:07 +02:00
Victor Berger 1dc2cb27cf Do the linux backend choice only once at startup. 2015-05-13 17:31:34 +02:00
Victor Berger 9a144a6869 Disable Wayland backend.
It is not ready for production yet.
2015-05-12 22:49:29 +02:00
Victor Berger 310b44f35b Make platform::linux generic over X11 and Wayland. 2015-05-12 22:49:03 +02:00
Pierre Krieger ace4808fac Remove the "headless" feature 2015-05-04 07:48:42 +02:00
Tomaka17 de7b1aa2eb Basic implementation of emscripten 2015-05-03 10:24:42 +02:00
Pierre Krieger 0eaa8fd9eb Use the EGL API with Android 2015-05-01 09:44:35 +02:00
Pierre Krieger aa58f4149a Add a GlContext trait 2015-04-30 16:57:07 +02:00
Pierre Krieger d4dcff582e Extract headless context from api/win32 to platform/windows 2015-04-29 10:19:59 +02:00
Pierre Krieger a72e06cf1b Reorganize the Linux implementation and split OSMesa and X11 2015-04-24 15:40:17 +02:00
Pierre Krieger 3ad7f9a584 Create reorganization 2015-04-24 09:51:23 +02:00