Mutter can reposition window on resize, if it is behind mutter's "bounding box".
So, when you start winit window in maximized mode with CSD, mutter places its CSD
behind the GNOME's status bar initially, and then sends configure with the
exact same size as your current window. If winit decides to optimize calling
frame.resize(..) in this case, we won't call set_geometry(we're calling
it through resize) and GNOME won't reposition your window to be inside the
"bounding box", which is not a desired behavior for the end user.
* Add ModifiersChanged event for macOS
This implements the macOS portion of #1124.
* Fix ModifiersChanged event import
* Fix event passing window instead of device id
* X11: Report `CursorMoved` when touch event occurs
* Only trigger CursorMoved events for the first touch ID
* Fix testing for current touch events
* Fix first touch logic
* X11: Sync key press/release with window focus
* When a window loses focus, key release events are issued for all pressed keys
* When a window gains focus, key press events are issued for all pressed keys
* Adds `is_synthetic` field to `WindowEvent` variant `KeyboardInput`
to indicate that these events are synthetic.
* Adds `is_synthetic: false` to `WindowEvent::KeyboardInput` events issued
on all other platforms
* Clarify code with comments
* X11: Fix incorrect modifiers when events are missed
* Syncs modifier state with state data in X key/button/motion events.
* Fixes modifier state in XWayland, as xinput2 raw input events will
not be received when a window does not have focus.
* Removes `impl From<_> for ModifiersState` on X11/Wayland API types,
replacing them with `pub(crate)` methods.
* Cleanup modifier state update using a macro
* Remove keys from modifier state when updating
* X11: Fix window creation hangs when another application is fullscreen
Previously, the X11 backend would block until a `VisibilityNotify` event
is received when creating a Window that is visible or when calling
`set_visible(true)` on a Window that is not currently visible. This
could cause winit to hang in situations where the WM does not quickly
send this event to the application, such as another window being
fullscreen at the time.
This behavior existed to prevent an X protocol error caused by setting
fullscreen state on an invisible window. This fix instead stores desired
fullscreen state when `set_fullscreen` is called (iff the window is not
visible or not yet visible) and issues X commands to set fullscreen
state when a `VisibilityNotify` event is received through the normal
processing of events in the event loop.
* Add window_debug example to facilitate testing
* Add a CHANGELOG entry
* Call `XUnmapWindow` if `VisibilityNotify` is received on an invisible window
* Prevent EventLoop from getting initialized outside the main thread
This only applies to the cross-platform functions. We expose functions
to do this in a platform-specific manner, when available.
* Add CHANGELOG entry
* Formatting has changed since the latest stable update...
* Fix error spacing
* Unix: Prevent initializing EventLoop outside main thread
* Updates libc dependency to 0.2.64, as required by BSD platforms
* Update CHANGELOG.md for Linux implementation
* Finish sentence
* Consolidate documentation
* Fix so the compiler can infer msg_send! return type
Currently, due to a quirk in Rust's type inference interacting with the
structure of the msg_send! macro, a () return type will be inferred when
the compiler cannot otherwise determine the return type. This behavior
is expected to change, and in the future could resolve to a ! return
type, which results in undefined behavior.
Linting has previously been added for this in rust-lang/rust#39216, but
it did not catch these cases due to SSheldon/rust-objc#62. An upcoming
version of objc will be fixed to stop hiding these errors, at which
point they will become compile errors.
This change fixes these errors and allows winit to compile with the
fixed version of objc.
* Bump cocoa to 0.19.1
Adds fullscreen using native web APIs to the stdweb and web-sys backends.
Due to limitations of browser APIs, requests for fullscreen can only be fulfilled during a short-lived user-triggered event. This commit does automatically handle that under the hood, but it does introduce unavoidable latency in full-screening the canvas.
* Expose HINSTANCE now using a getter function
* Missing changes
* remove unused import
* Required changes for the PR
* Rust fmt
* Use GetWindowLong
* Use GetWindowLong
* Fixed relative_pointer not being set up when the "zwp_relative_pointer_manager_v1" callback comes after the "wl_seat" callback
* Ran cargo fmt
* Updated changelog
* Added wayland support for set_grab_cursor and set_cursor_visible
* Updated changelog
* Ran cargo fmt
* Fixed set_cursor_visible and set_cursor_grab so they can be called from any thread.
* Ran cargo_fmt
* Improved CHANGELOG
* Added workaround so that when cursor is hidden it takes effect before the cursor enters the surface. Making the cursor visible again still only happens once the cursor re-enters the surface
* Switched to using Rc<RefCell> instead of Arc<Mutex> since all accesses to the relative_pointer_manager_proxy will happen on the same thread.
* Forgot to run cargo fmt
* Switched to using Rc and RefCell instead of Arc and Mutex where applicable.
* Improved comments and documentation relating to changing a hidden cursor back to visible on wayland.
* Wayland: Fixed cursor not appearing immendiately when setting the cursor to visible.
* Forgot to run cargo fmt
* Switched to only storing the pointers in CursorManager as AutoPointer.
* Fixed typo and removed println
* Update CHANGELOG.md
Co-Authored-By: Kirill Chibisov <wchibisovkirill@gmail.com>
* Fixed relative_pointer not being set up when the "zwp_relative_pointer_manager_v1" callback comes after the "wl_seat" callback
* Ran cargo fmt
* Updated changelog
* Improved CHANGELOG
* Switched to using Rc<RefCell> instead of Arc<Mutex> since all accesses to the relative_pointer_manager_proxy will happen on the same thread.
* Forgot to run cargo fmt
* X11: Fix panic when no monitors are available
* Set dummy monitor's dimensions to `(1, 1)`
* X11: Avoid panicking when there are no monitors in Window::new
* Allow using multiple `XWindowType`s on X11 (#1140)
* Update documentation to make combining window types clearer
* Update build flags because X11 runs on more than just Linux
* Revert "Update build flags because X11 runs on more than just Linux"
This reverts commit 882b9100462a5ee0cf89dcd42891ebd0f709964f.
* Revert "Update documentation to make combining window types clearer"
This reverts commit da00ad391a8ce42cea08b577b216316b013f9e36.
* Revert "Allow using multiple `XWindowType`s on X11 (#1140)"
This reverts commit a23033345697463400286c4d297f5c1552369fc2.
* Allow using multiple `XWindowType`s on X11 (slice variant) (#1140)
* Multiple `XWindowType`s, with non-static lifetime.
* Multiple `XWindowType`s (#1140) (`Vec` variant)
* Append change to changelog.
* Fix formatting.
* Keep track of what windows have requested redraw
Instead of using request_animation_frame and sending redraw request
events, just keep track of all windows that have asked for a redraw.
This doesn't handle dispatching the events
* Issue redraw events to windows that request it
* Cargo fmt
* Use actual numeric IDs to differentiate Windows
This is generally important to identifying which window should
recieve which event, but is also specifically crucial for fixing
RedrawRequested on web.
* Cargo fmt
* Flush high surrogate if not followed by low surrogate
* Remove transmute from WM_CHAR handler
* Fix window_state being locked while dispatching ReceivedCharacter for surrogate codepoints.
* Format
Just before starting to poll/wait on calloop(mio), check if there
are already events pending in the internal buffer of our wayland
event queue. If so, dispatch them and force an instant wakeup from
the polling, in order to behave as if we were instantly woken up by
incoming wayland events.
When using OpenGL, mesa shares our wayland socket, and also reads
from it, especially if vsync is enabled as it'll do blocking reads.
When doing so, it may enqueue events in the internal buffer of our
event queue.
As the socket has been read, mio will thus not notify it to calloop
as read, and thus calloop will not know it needs to dispatch. In some
cases this can lead to some events being delivered much later than
they should. Combined with key repetition this can actually cause some
flooding of the event queue making this effect event worse.
Fixes#1148
* Add touch pressure information for touch events on Windows
* Modified CHANGELOG.md and FEATURES.md to reflect changes
* Updated documentation of struct Touch to reflect changes
* Replaced mem::uninitalized() with mem::MaybeUninit
Fixed warnings in platform_impl/windows/dpi.rs
* fix#1087. the CFRunLoopTimer was never started if the user never changed the controlflow.
* RedrawRequested ordering matches the new redraw api
consistent asserts
lots of appstate refactoring to rely less on unsafe, and hopefully make it easier to maintain
* ios: dpi bugfix. inputs to setContentScaleFactor are not to be trusted as iOS uses 0.0 as a sentinel value for "default device dpi".
the fix is to always go through the getter.
* move touch handling onto uiview
* update changelog
* rustfmt weirdness
* fix use option around nullable function pointers in ffi
* Document why gl and metal views don't use setNeedsDisplay
* change main events cleared observer priority to 0 instead of magic number
log when processing non-redraw events when we expect to only be processing redraw events
* X11: Fix performance issue with rapidly resetting cursor icon
* When setting cursor icon, if the new icon value is the same as the
current value, no messages are sent the X server.
* X11: Cache cursor objects in XConnection
* Add changelog entry
* iOS os version checking
* iOS, fix some incorrect msg_send return types
* address nits, and fix OS version check for unsupported os versions
* source for 60fps guarantee
* macOS/iOS: Fix auto trait impls of `EventLoopProxy`
`EventLoopProxy<T>` allows sending `T` from an arbitrary thread that
owns the proxy object. Thus, if `T` is `!Send`, `EventLoopProxy<T>` must
not be allowed to leave the main thread.
`EventLoopProxy<T>` uses `std::sync::mpsc::Sender` under the hood,
meaning the `!Sync` restriction of it also applies to
`EventLoopProxy<T>`. That is, even if `T` is thread-safe, a single
`EventLoopProxy` object cannot be shared between threads.
* Update `CHANGELOG.md`
* Stop appending canvas to document in web platform
* Remove `tabindex` TODO in web backend
* Return `OsError` instead of panicking on web canvas creation
* Add exclusive fullscreen mode
* Add `WindowExtMacOS::set_fullscreen_presentation_options`
* Capture display for exclusive fullscreen on macOS
* Fix applying video mode on macOS after a fullscreen cycle
* Fix compilation on iOS
* Set monitor appropriately for fullscreen on macOS
* Fix exclusive to borderless fullscreen transitions on macOS
* Fix borderless to exclusive fullscreen transition on macOS
* Sort video modes on Windows
* Fix fullscreen issues on Windows
* Fix video mode changes during exclusive fullscreen on Windows
* Add video mode sorting for macOS and iOS
* Fix monitor `ns_screen` returning `None` after video mode change
* Fix "multithreaded" example on macOS
* Restore video mode upon closing an exclusive fullscreen window
* Fix "multithreaded" example closing multiple windows at once
* Fix compilation on Linux
* Update FEATURES.md
* Don't care about logical monitor groups on X11
* Add exclusive fullscreen for X11
* Update FEATURES.md
* Fix transitions between exclusive and borderless fullscreen on X11
* Update CHANGELOG.md
* Document that Wayland doesn't support exclusive fullscreen
* Replace core-graphics display mode bindings on macOS
* Use `panic!()` instead of `unreachable!()` in "fullscreen" example
* Fix fullscreen "always on top" flag on Windows
* Track current monitor for fullscreen in "multithreaded" example
* Fix exclusive fullscreen sometimes not positioning window properly
* Format
* More formatting and fix CI issues
* Fix formatting
* Fix changelog formatting
* Process WM_SYSCOMMAND to forbid screen savers in fullscreen mode
Fixes#1047
* Update CHANGELOG.md and documentation to reflect changes from issue #1065
* Updated documentation of window.Window.set_fullscreen to match the documentation of window.WindowBuilder.with_fullscreen.
* Touch events emit screen coordinates instead of client coordinates on Windows
Fixes#1002
* Don't lose precision of WM_TOUCH events when converting from screen space to client space
* Updated CHANGELOG.md to reflect changes from issue: #1042