Commit graph

2305 commits

Author SHA1 Message Date
stuart nelson 0f14e63b34 Send mouse position after focused/cursorenter events (#349)
* Update mouse pos after cursor enter event

* Update mouse position on windows focus

* Send device_id

* Update other device id

* Fix windows import

* Remove deque for vec

* Just send event

* Use correct push_back method

* Push correct event
2017-11-26 21:43:13 +01:00
Jacob Kiesel fae10c6072 Emit delete character on Windows (#352) 2017-11-21 10:12:51 +01:00
Jacob Kiesel cfd087d9a5 Mouse events (#344)
* Explicit mouse-related DeviceEvents

This makes the API more intuitive for common use-cases and allows us
to better propagate platform knowledge of motion semantics.

* Improve event naming consistency

* Clarify axis event forwards-compatibility

* Rename WindowEvent::MouseMoved/Entered/Left to CursorMoved/...

This emphasizes the difference between motion of the host GUI cursor,
as used for clicking on things, and raw mouse(-like) input data, as
used for first-person controls.

* Add support for windows and OSX, fix merging

* Fix warnings and errors on Linux

* Remove unnecessary breaking changes

* Add MouseWheel events to windows and OSX

* Fix bad push call.

* Fix docs, naming, and x11 events

* Remove mutability warning

* Add changelog entry
2017-11-12 21:56:57 +01:00
Victor Berger c61f9b75f8
Wayland: implement touch events (#342)
* wayland: move pointer to its own file

* wayland: touch events support

* update changelog
2017-11-11 10:03:42 +01:00
Gabriel Majeri bbf13561b5 Fix docs rendering (#340) 2017-11-05 11:21:57 +01: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
Andriy Symonovych 37a10e6741 update macos deps (#335) 2017-10-31 11:03:18 +01:00
Victor Berger 62e45fa75d wayland: update dependencies (#334) 2017-10-30 07:27:43 +01:00
Ken Reed 01d1178d7b Made poll events loop over as many events as there may be instead of just one. (#333) 2017-10-29 07:02:57 +01:00
Alex Butler b3c5ee6219 Fix no primary monitor panic in XWayland (#318)
* Fix no primary monitor panic in XWayland

In this case try to use the first existing monitor instead of panicking.
Fixes #317

* Shift no monitor panic to x11::get_primary_monitor

* Update changelog with xll get_primary_monitor fallback
2017-10-28 15:24:37 +02:00
Bruno Ploumhans 36058ab8e6 Improve the documentation of DeviceEvent::Motion (#321) 2017-10-28 12:33:51 +02:00
Chris Tolliday 159364bec3 Impl Clone for EventsLoopProxy (#331) 2017-10-25 20:03:57 +02:00
Victor Berger 58181dbff9 wayland: Fix drop order for display (#326) 2017-10-25 18:28:24 +02:00
kryptan 760e588627 Use EnumDisplayMonitors to enumerate monitors on Windows (#327)
* Use EnumDisplayMonitors to enumerate monitors on Windows

* Add requested changes
2017-10-25 17:12:39 +02:00
Victor Berger d10312c6b1 Rewrite of wayland backend to new wayland-client API (#325)
* wayland: clean state for rewrite to new wayland-client API

* wayland: context init

* wayland: Monitors logic

* wayland: Basic event loop logic

* wayland: Keyboard handling

* wayland: pointer handling

* wayland: refactor to remove WaylandContext

* wayland: window logic

* wayland: event dispatching logic

* wayland: update changelog
2017-10-20 09:46:42 +02:00
kryptan 4e4db1749d Make MonitorId::get_position() return (i32, i32) instead of (u32, u32) because it can be negative on Windows (#324) 2017-10-19 19:08:05 +02:00
Victor Berger 229029f2da Formalize thread-safety guarantees (#322) 2017-10-18 20:40:21 +02:00
kryptan 48902297b7 Implement public API for high-DPI (#319)
* Implement public API for high-DPI #105

* Recover get_inner_size_points and get_inner_size_pixels and change their implementation assuming get_inner_size() returns size in pixels

* Update changelog for high-DPI changes
2017-10-17 13:56:38 +02:00
Chet Gurevitch eff3440482 Mirror x11 ISO_LEFT_TAB detection on wayland and release version 0.8.3 (#314)
* wayland: mirror x11 ISO_LEFT_TAB detection

* Release 0.8.3
2017-10-12 09:39:41 +02:00
Pedro Côrte-Real 80d9a6371d Use travis matrix for the ios/linux variants (#313) 2017-10-08 15:51:55 +02:00
Victor Berger 3d8c94bae5 wayland: commit the empty surface at init (#309)
This should trigger the compositor's mechanism for sending a
configure event, which should most of the time be processed
before any winit user actually tries to draw.
2017-10-08 15:51:48 +02:00
Matteo Signer 3f33cd1929 Make ISO_Left_Tab generate VirtualKeyCode::Tab (#308)
* Make ISO_Left_Tab generate VirtualKeyCode::Tab

* Add changes to changelog
2017-10-08 13:59:45 +02:00
Pedro Côrte-Real 1db92063d9 Fix X11 on 32bit architectures (#311)
* Add an i386 target to travis

* Fix X11 on 32bit architectures

One would hope 32bit X11 was dead by now but apparently not :). Fix
the window hint setting code to not assume window IDs are 64bit as
apparently they are not in 32bit arches.
2017-10-07 21:20:37 +02:00
Chris Tolliday 5af88d97e8 On Windows, use SWP_ASYNCWINDOWPOS to prevent thread from blocking when calling (#302)
set_inner_size
2017-10-04 09:42:35 +02:00
Victor Berger b337d8f99b Version 0.8.2 (#301) 2017-09-28 19:04:26 +02:00
Victor Berger 515595153d Wayland: rework the event loop & expose readiness signal (#298)
* wayland: don't create a second event_queue

As each EventsLoop has its own context, this is no longer necessary.

* wayland: buffer events rather than direct dispatch

Changes the behavior of the event loop to first internally
buffer the events generated by the wayland handlers, and then
dispatch them to the client's closure.

- It simplifies the event loop logic
- It makes it possible for the user to call window methods such as
  `set_title()` or `set_inner_size()` without causing a deadlock

* wayland: add is_ready() & fix protocol errors

Adds a `is_ready()` method to the windows to advertize
when it is legal to start drawing, and fix a few wayland
protocol mishandling in the process.
2017-09-27 16:31:46 +02:00
David Harvey-Macaulay df7e349c70 Complete documentation for top-level items (#299) 2017-09-25 15:58:59 +02:00
Victor Berger 9c116a1bae x11: uniformize keyboard scancodes with linux (#297) 2017-09-25 07:25:36 +02:00
tomaka 15fbc0dff4 Publish 0.8.1 with fixes necessary for glutin (#296) 2017-09-23 09:36:30 +02:00
tomaka 6a2a7036d4 Fix mistake in 0.8 changelog (#294) 2017-09-23 09:36:21 +02:00
tomaka 3edc8e0cd9 Publish 0.8.0 (#290) 2017-09-22 08:00:19 +02:00
Matteo Signer 52a78d61bf Fix #273 (#274) 2017-09-21 16:09:07 +02:00
tomaka f81a0741f5 Fixes to the documentation of EventsLoop (#288) 2017-09-17 19:59:36 +02:00
Kelvin Ly 192bd798e3 Implement virtual key translation for emscripten (#289)
* Implement virtual key translation

* Remove unused std::mem import from the right file

* Install git on CircleCI instances

* Fix CircleCI config script

* Fix type error in emscripten keyboard events
2017-09-16 15:46:53 +02:00
tomaka 52a7b07c79 Move the Suspended event outside of WindowEvent (#284)
* Move Suspended event outside of WindowEvent

* Adjust the iOS code
2017-09-15 16:24:09 +02:00
tomaka 1d0b5bcfbd Remove the use platform_not_supported hack (#285) 2017-09-15 15:45:45 +02:00
tomaka 769d4fe897 Emscripten rework (#286)
* partial implementation for emscripten

this pull request contain a partial but working implementation of emscripten backend

some implementations may be controversial.

here some implementation detail:

* cursor state:
  * on grab: emscripten request pointer lock deferred and also set a callback when pointer lock change
             the callback request pointer lock deferred.
  * on hide: `emscripten_hide_mouse` exist but not `emscripten_show_mouse`
             a pull request has been open on october 2016 but never been merged
             so I copied the javascript function and put it in emscripten_asm_const function

* fullscreen: if fullscreen is requested then it request fullscreen deferred and set a callback on fullscreen change
              the callback request fullscreen deferred

* run forever: this method use emscripten main loop to run an infinite loop

* keyboard callback doesn't consume the event. I think it is more apopriate as in desktop environment it is the same, is it ?

* emscripten dir is added in example and contains html pages

Some things that are not implemented:

* lots of events

* min and max dimension can be implemented with a callback that listen to size change and resize if dimension out of bound

* title may be implemented using javascript to change document.title

* Use std::os::raw in the emscripten bindings

* Fix emscripten code

* Update code

* Add CI

* Remove the emscripten-specific examples

* Add some information to the README
2017-09-14 16:31:34 +02:00
tomaka ae7802c8c2 Fix warnings for win32 (#283) 2017-09-13 11:15:16 +02:00
pravic c82fcd203f Update docs of windows-specific methods (#281) 2017-09-13 09:19:54 +02:00
Pedro Côrte-Real 59c33d2c6a Move fullscreen modes to not touch physical resolutions (#270)
* Fix X11 screen resolution change using XrandR

The previous XF86 resolution switching was broken and everything
seems to have moved on to xrandr. Use that instead while cleaning
up the code a bit as well.

* Use XRandR for actual multiscreen support in X11

* Use actual monitor names in X11

* Get rid of ptr::read usage in X11

* Use a bog standard Vec instead of VecDeque

* Get rid of the XRandR mode switching stuff

Wayland has made the decision that apps shouldn't change screen
resolutions and just take the screens as they've been setup. In the
modern world where GPU scaling is cheap and LCD panels are scaling
anyway it makes no sense to make "physical" resolution changes when
software should be taking care of it. This massively simplifies the
code and makes it easier to extend to more niche setups like MST and
videowalls.

* Rename fullscreen options to match new semantics

* Implement XRandR 1.5 support

* Get rid of the FullScreen enum

Moving to just having two states None and Some(MonitorId) and then
being able to set full screen in the current monitor with something
like:

window.set_fullscreen(Some(window.current_monitor()));

* Implement Window::get_current_monitor()

Do it by iterating over the available monitors and finding which
has the biggest overlap with the window. For this MonitorId needs
a new get_position() that needs to be implemented for all platforms.

* Add unimplemented get_position() to all MonitorId

* Make get_current_monitor() platform specific

* Add unimplemented get_current_monitor() to all

* Implement proper primary monitor selection in X11

* Shut up some warnings

* Remove libxxf86vm package from travis

Since we're no longer using XF86 there's no need to keep the package
around for CI.

* Don't use new struct syntax

* Fix indentation

* Adjust Android/iOS fullscreen/maximized

On Android and iOS we can assume single screen apps that are already
fullscreen and maximized so there are a few methods that are implemented
by just returning a fixed value or not doing anything.

* Mark OSX/Win fullscreen/maximized unimplemented()!

These would be safe as no-ops but we should make it explicit so
there is more of an incentive to actually implement them.
2017-09-07 10:33:46 +02:00
tomaka 342d5d8587 Remove api_transition macro (#279)
* Remove api_transition macro

* Rename Window2 to Window

* Try fix X11 code
2017-09-06 17:32:24 +02:00
Pedro Côrte-Real 0ada6c15ea Fix travis OSX rust stable build (#280) 2017-09-05 08:26:05 +02:00
tomaka 2a4b381384 Update iOS for EventsLoop design (#275)
* Inline gen_api_transition! in the ios module

* Event loop proxy work

* Monitors

* Use freestanding functions

* Finish conversion
2017-09-04 12:41:10 +02:00
tomaka fe1deb83ae Update Android code with EventsLoop (#272)
* Update Android code with EventsLoop

* Fix run_forever
2017-09-04 12:41:02 +02:00
Pedro Côrte-Real 5b57b73fe8 Remove dead code causing warnings (#278) 2017-09-04 08:45:56 +02:00
tomaka 3d1c18ded9 Events loop backend (#269)
* Don't use UNIX_BACKEND in Window2::new

* Move get_available_monitors and get_primary_monitor to EventsLoop

* Remove UNIX_BACKEND

* Restore choosing the Linux backend

* Return a XNotSupported for new_x11()

* Fix fullscreen example
2017-09-01 11:04:57 +02:00
tomaka e65cacbc86 Use a sync::Barrier on win32 to sync threads instead of a channel (#271) 2017-08-31 19:45:17 +02:00
Victor Berger 1b22e39fb2 wayland: internal event buffer & wait for xdg configure (#255) 2017-08-31 19:43:24 +02:00
tomaka 7dc6fcdedc Rework MonitorId::get_native_identifier (#267)
* Rework MonitorId::get_native_identifier

* Try fix compilation

* Returns the monitor ID on wayland as well

* Try fix compilation

* Fix iOS compilation
2017-08-30 08:49:18 +02:00
tomaka f7a8bcddb8 Merge pull request #130 from pedrocr/maximization
Maximization and Windowed Fullscreen
2017-08-29 11:53:22 +02:00