* Fix WindowEvent::ReceivedCharacter on web
The event was never sent to the application because of the unconditional
preventDefault() call on keydown.
Fixes#1741
* Don't scroll when pressing space on a focused canvas
After reaching keypress, we should prevent further propagation.
Relates to #1741
Aborting compilation by using 'compile_error!' macro in build.rs was resulting in failing cross
compilation, thus this commit removes build.rs. The compilation will now be aborted on existing 'compile_error!' macros in corresponding platform sources.
Building window with 'set_min_inner_size' was setting 'max_inner_size'
under the hood, thus completely disabling window resize, since
the window isn't resizeable on Wayland when its minimum size
is equal to its maximum size.
This patch removes an unneeded workaround for transparent windows on the
Windows platform. In addition, it simplifies a couple of related API calls:
* Remove the `CreateRectRgn` call, since we want the entire window's region to
have blur behind it, and `DwnEnableBlurBehindWindow` does that by default.
* Remove the `color_key` for `SetLayeredWindowAttributes`, since it's not used
(we're not passing `winuser::LWA_COLORKEY` to the flags).
* Update SCTK to 0.11.0
Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:
- Disabled repeat rate not being handled.
- Decoration buttons not working after tty switch.
- Scaling not being applied on output reenable.
- Crash when `XCURSOR_SIZE` is `0`.
- Pointer getting created in some cases without pointer capability.
- On kwin, fix space between window and decorations on startup.
- Incorrect size event when entering fullscreen when using
client side decorations.
- Client side decorations not being hided properly in fullscreen.
- Size tracking between fullscreen/tiled state changes.
- Repeat rate triggering multiple times from slow callback handler.
- Resizable attribute not being applied properly on startup.
- Not working IME
Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.
It also adds new methods to a `Theme` trait, such as:
- `title_font(&self) -> Option<(String, f32)>` - The font for a title.
- `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
the text in the title.
Fixes#1680.
Fixes#1678.
Fixes#1676.
Fixes#1646.
Fixes#1614.
Fixes#1601.
Fixes#1533.
Fixes#1509.
Fixes#952.
Fixes#947.
This changes 'Fullscreen::Borderless' enum variant from
'Fullscreen::Borderless(MonitorHandle)' to
'Fullscreen::Borderless(Option<MonitorHandle>)'. Providing
'None' to it will result in picking the current monitor.
* web: Allow event to be queued from inside the EventLoop handler
The Runner is behind a RefCell, which is mutably borrowed when the event
handler is being called. To queue events, `send_events` needs to check
`is_closed()` and the `is_busy` flag, but it cannot be done since the
RefCell is already locked. This commit changes the conditions to work
without needing a successful borrow.
* web: Emit WindowEvent::Resized on Window::set_inner_size
* Update changelog
* web-sys: Impl. event listeners removal for canvas
* web-sys: Impl. media query listeners cleanup
* web: Emit WindowEvent::Destroyed after Window is dropped
* web-sys: Fix unload event closure being dropped early
* web: Impl. cleanup on ControlFlow::Exit
- Drops the Runner, which causes the event handler closure to be
dropped.
- (web-sys only:) Remove event listeners from DOM.
* web: Do not remove canvas from DOM when dropping Window
The canvas was inserted by the user, so it should be up to the user
whether the canvas should be removed.
* Update changelog
This commit is a follow up to a2db4c0a32
to make it clear which virtual key codes are located on numeric pad.
It also adds Asterisk and Plus virtual key codes.
Certain platforms like Wayland don't have a concept of
primary Monitor in particular. To indicate that
'primary_monitor' will return 'None' as well as in cases
where the primary monitor can't be detected.
Fixes#1683.
On certain platforms window couldn't be on any monitor
resulting in failures of 'current_monitor' function.
Such issue was happening on Wayland, since the window
isn't on any monitor, unless the user has drawn something into it.
Returning 'Option<MonitorHandle>' will give an ability to
handle such situations gracefully by properly indicating that
there's no current monitor.
Fixes#793.
In winit the swipe from left to right on touchpad should
generate positive horizontal delta change, however on
macOS it was the other way around without
natural scrolling.
This commit inverses the horizontal scrolling delta
in 'MouseScrollDelta' events to match other platforms.
Fixes#1695.
* Change web backend `event_handler` to without 'static lifetime
* Refactor web runner and fix ControlFlow::Exit not being sticky
* Impl. scaling change event for web-sys backend
* Improve `dpi` docs regarding the web backend
* Add changes to changelog
* Update features.md
On all platforms other than Linux/X11, the Subtract key was uniformly
used only for the Numpad. To make this cross-platform compatible, the
`-` key will now map to `Minus` on X11 instead of `Subtract`.
Since people have been confused about the difference between `Minus` and
`Subtract` in the past, the `Subtract` key has also been renamed to
`NumpadSubtract`. This is a breaking change that might be annoying to
downstream since there's no direct improvement, but it should help new
users in the future. Alternatively this could just be documented, rather
than explicitly mentioning the Numpad in the name.
* Impl. mouse capturing for web-sys with PointerEvent
* Impl. mouse capturing for web-sys with MouseEvent by manual tracking
* Reorganize web-sys backend mouse and pointer handling code
* Impl. mouse capturing for stdweb with PointerEvent
* Add mouse capturing for web target to changelog
The `_lwp_self` function cannot be used to reliably determine the main
thread, see
https://github.com/alacritty/alacritty/issues/2631#issuecomment-676723289.
It might always be equal to the PID, but it's certainly not always 1
when the thread is the main thread.
However, Rust's built in `Thread::id` and `Thread::name` function will
always return `ThreadId(1)` and `Some("main")`. Since converting the
thread's ID to a number is not supported on stable Rust, checking that
the thread is labeled `Some("main")` seems like the most reliable
option. It should also be a good fallback in general.
PhysicalSize is recorded as canvas.size, whereas LogicalSize is stored
as canvas.style.size.
The previous cursor behavior on stdweb clobbered all style - thus losing
the LogicalSize.
This resolves various problems with the documentation about platform
support on the Window struct.
It also completely removes pointless runtime errors in favor of
consistent no-ops on all platforms that do not support a certain
features.
* Fix for fullscreen with run_return on mac
* Cleanup
* Removed a comment
* fmt
* This doesn't break exiting run_return anymore
* Now you can also transition from code
* Fmt & cleanup
* Now using a atomic instead of a static bool
* reinserted a line
* Fmt
* Added support for dialogs and child windows
* Cargo fmt
* Dialogs are now being shutdown properly
* Cargo fmt
* Update CHANGELOG.md
* Report mouse motion before click
This fixes an issue on macOS where a mouse click would be generated,
without ever getting a mouse motion to the position before the click.
This leads to the application thinking the mouse click occurred at a
position other than the actual mouse location.
This happens due to mouse motion above the window not automatically
giving focus to the window, unless it is actually clicked, making it
possible to move the window without motion events.
Fixes#942.
* Add additional mouse motion events
Co-authored-by: Ryan Goldstein <ryan@ryanisaacg.com>
* Use requestAnimationFrame for polling wasm
* Implement `requestAnimationFrame` for stdweb
Co-authored-by: Ryan G <ryanisaacg@users.noreply.github.com>
There are two PRs I'm aware of that should be relatively trivial to get
merged, which would fix some issues. Other than those, I don't think it
makes sense to wait on anything.
- Fix Windows crash: https://github.com/rust-windowing/winit/pull/1459
- Fix macOS mouse reports: https://github.com/rust-windowing/winit/pull/1490
While #1459 seems pretty essential to actually make winit run, #1490 is
much less important and can probably be ignored if there aren't any
resources to merge it.
This reverts commit 9daa0738a9.
This commit introduced other bug #1453 with likely much more common bindings,
so reverting it for now.
Fixes#1453.
Co-authored-by: Osspial <osspial@gmail.com>
* On Windows, fix request_redraw() related panics
These panics were introduced by 6a330a2894
Fixes https://github.com/rust-windowing/winit/issues/1391
Fixes https://github.com/rust-windowing/winit/issues/1400
Fixes https://github.com/rust-windowing/winit/issues/1466
Probably fixes other related issues
See https://github.com/rust-windowing/winit/issues/1429
* On Windows, replace all calls to UpdateWindow by calls to InvalidateRgn
This avoids directly sending a WM_PAINT message,
which might cause buffering of RedrawRequested events.
We don't want to buffer RedrawRequested events because:
- we wan't to handle RedrawRequested during processing of WM_PAINT messages
- state transitionning is broken when handling buffered RedrawRequested events
Fixes https://github.com/rust-windowing/winit/issues/1469
* On Windows, panic if we are trying to buffer a RedrawRequested event
* On Windows, move modal loop jumpstart to set_modal_loop() method
This fixes a panic.
Note that the WM_PAINT event is now sent to the modal_redraw_method
which is more correct and avoids an unecessary redraw of the window.
Relates to but does does not fix https://github.com/rust-windowing/winit/issues/1484
* On Window, filter by paint messages when draining paint messages
This seems to prevent PeekMessage from dispatching unrelated sent messages
* Change recently added panic/assert calls with warn calls
This makes the code less panicky...
And actually, winit's Windoww callbacks should not panic
because the panic will unwind into Windows code.
It is currently undefined behavior to unwind from Rust code into foreign code.
See https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
* add comments to clarify WM_PAINT handling in non modal loop
* made redraw_events_cleared more explicit and more comments
* Remove assertions from Windows dark mode code
In general, winit should never assert on anything unless it means that
it is impossible to continue the execution of the program. There are
several assertions in the Windows dark mode code where this is not the
case.
Based on surface level inspection, all existing assertions could be
easily replaced with just simple conditional checks, allowing the
execution of the program to proceed with sane default values.
Fixes#1458.
* Add changelog entry
* Format code
* Pass dark mode by mutable reference
* Format code
* Return bool instead of mutable reference
* Fix dark mode success reply
Co-Authored-By: daxpedda <daxpedda@gmail.com>
* Fix dark mode success reply
* Replace magic integers with constants
Co-authored-by: daxpedda <daxpedda@gmail.com>
* Move `ModifiersChanged` variant to `WindowEvent`
* macos: Fix flags_changed for ModifiersChanged variant move
I haven't look too deep at what this does internally, but at least
cargo-check is fully happy now. :)
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* macos: Fire a ModifiersChanged event on window_did_resign_key
From debugging, I determined that macOS' emission of a flagsChanged
around window switching is inconsistent. It is fair to assume, I think,
that when the user switches windows, they do not expect their former
modifiers state to remain effective; so I think it's best to clear that
state by sending a ModifiersChanged(ModifiersState::empty()).
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* windows: Fix build
I don't know enough about the code to implement the fix as it is done on
this branch, but this commit at least fixes the build.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* windows: Send ModifiersChanged(ModifiersState::empty) on KILLFOCUS
Very similar to the changes made in [1], as focus is lost, send an event
to the window indicating that the modifiers have been released.
It's unclear to me (without a Windows device to test this on) whether
this is necessary, but it certainly ensures that unfocused windows will
have at least received this event, which is an improvement.
[1]: f79f21641a31da3e4039d41be89047cdcc6028f7
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* macos: Add a hook to update stale modifiers
Sometimes, `ViewState` and `event` might have different values for their
stored `modifiers` flags. These are internally stored as a bitmask in
the latter and an enum in the former.
We can check to see if they differ, and if they do, automatically
dispatch an event to update consumers of modifier state as well as the
stored `state.modifiers`. That's what the hook does.
This hook is then called in the key_down, mouse_entered, mouse_exited,
mouse_click, scroll_wheel, and pressure_change_with_event callbacks,
which each will contain updated modifiers.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* Only call event_mods once when determining whether to update state
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* flags_changed: Memoize window_id collection
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* window_did_resign_key: Remove synthetic ModifiersChanged event
We no longer need to emit this event, since we are checking the state of
our modifiers before emitting most other events.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* mouse_motion: Add a call to update_potentially_stale_modifiers
Now, cover all events (that I can think of, at least) where stale
modifiers might affect how user programs behave. Effectively, every
human-interface event (keypress, mouse click, keydown, etc.) will cause
a ModifiersChanged event to be fired if something has changed.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* key_up: Add a call to update_potentially_stale_modifiers
We also want to make sure modifiers state is synchronized here, too.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* mouse_motion: Remove update_potentially_stale_modifiers invocation
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* Retry CI
* ViewState: Promote visibility of modifiers to the macos impl
This is so that we can interact with the ViewState directly from the
WindowDelegate.
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* window_delegate: Synthetically set modifiers state to empty on resignKey
This logic is implemented similarly on other platforms, so we wish to
regain parity here. Originally this behavior was implemented to always
fire an event with ModifiersState::empty(), but that was not the best as
it was not necessarily correct and could be a duplicate event.
This solution is perhaps the most elegant possible to implement the
desired behavior of sending a synthetic empty modifiers event when a
window loses focus, trading some safety for interoperation between the
NSWindowDelegate and the NSView (as the objc runtime must now be
consulted in order to acquire access to the ViewState which is "owned"
by the NSView).
Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
* Check for modifiers change in window events
* Fix modifier changed on macOS
Since the `mouse_entered` function was generating a mouse motion, which
updates the modifier state, a modifiers changed event was incorrectly
generated.
The updating of the modifier state has also been changed to make sure it
consistently happens before events that have a modifier state attached
to it, without happening on any other event.
This of course means that no `CursorMoved` event is generated anymore
when the user enters the window without it being focused, however I'd
say that is consistent with how winit should behave.
* Fix unused variable warning
* Move changelog entry into `Unreleased` section
Co-authored-by: Freya Gentz <zegentzy@protonmail.com>
Co-authored-by: Kristofer Rye <kristofer.rye@gmail.com>
Co-authored-by: Christian Duerr <contact@christianduerr.com>
This restores default portable 'C' locale when target locale is unsupported
by X11 backend (Xlib).
When target locale is unsupported by X11, some locale-dependent Xlib
functions like `XSetLocaleModifiers` fail or have no effect triggering
later failures and panics.
When target locale is not valid, `setLocale` should normally leave the
locale unchanged (`setLocale` returns 'C'). However, in some situations,
locale is accepted by `setLocale` (`setLocale` returns the new locale)
but the accepted locale is unsupported by Xlib (`XSupportsLocale` returns
`false`).
Fix#636
* On Wayland, fix coordinates in touch events when scale factor isn't 1
* Explicitly state that Wayland is using LogicalPosition internally
* Fix CHANGELOG
* Remove Wayland theme intermediates
This removes the intermediate struct for passing a Wayland theme to
allow the user direct implementation of the trait.
By passing the trait directly, it is possible for downstream users to
have more freedom with customization without relying on winit to offer
these options as fields.
It should also make maintenance easier, since winit already doesn't
implement all the functions which are offered by the smithay client
toolkit.
* Reimplement SCTK's Theme and ButtonState
* Fix style issues
* Remove public signature
* Format code
* Add change log entry
Co-authored-by: Murarth <murarth@gmail.com>
* Don't discard high-precision cursor position data
Most platforms (X11, wayland, macos, stdweb, ...) provide physical
positions in f64 units, which can contain meaningful fractional
data. For example, this can be empirically observed on modern X11
using a typical laptop touchpad. This is useful for e.g. content
creation tools, where cursor motion might map to brush strokes on a
canvas with higher-than-screen resolution, or positioning of an object
in a vector space.
* Update CHANGELOG.md
Co-Authored-By: Murarth <murarth@gmail.com>
Co-authored-by: Murarth <murarth@gmail.com>
* Fix bug causing RedrawRequested events to only get emitted every other iteration of the event loop.
* Initialize simple_logger in examples.
This PR's primary bug was discovered because a friend of mine reported
that winit was emitting concerning log messages, which I'd never seen
since none of the examples print out the log messages. This addresses
that, to hopefully reduce the chance of bugs going unnoticed in the
future.
* Add changelog entry
* Format
* Rename hidpi_factor to scale_factor
* Deprecate WINIT_HIDPI_FACTOR environment variable in favor of WINIT_X11_SCALE_FACTOR
* Rename HiDpiFactorChanged to DpiChanged and update docs
I'm renaming it to DpiChanged instead of ScaleFactorChanged, since I'd
like Winit to expose the raw DPI value at some point in the near future,
and DpiChanged is a more apt name for that purpose.
* Format
* Fix macos and ios again
* Fix bad macos rebase
* On X11, make `WINIT_HIDPI_FACTOR` dominate `Xft.dpi` in some cases
This commit makes `WINIT_HIDPI_FACTOR` dominate `Xft.dpi` in general and
adds a special value `0` for `WINIT_HIDPI_FACTOR` to use winit computed
DPI factor with randr over Xft.dpi.
* Use `randr` instead of `0` for auto dpi scaling
* Update CHANGELOG
* blow up on wrong env var
* Allow empty string for env var
* Move DeviceEvent handling to the message target window.
Previously, device events seem to have only been sent to one particular
window, and when that window was closed Winit would stop receiving
device events. This also allows users to create windowless event loops
that process device events - an intriguing idea, to say the least.
* Emit LWin and RWin VirtualKeyCodes on Windows
* Implement ModifiersChanged on Windows
* Make ModifiersChanged a tuple variant instead of a struct variant
* Add changelog entries
* Format
* Update changelog entry
* Fix AltGr handling
* Reformat
* Publicly expose ModifiersChanged and deprecate misc. modifiers fields
* Change ModifiersState to a bitflags struct
* Make examples work
* Add modifier state methods
* all things considered, only erroring out in one file throughout all of these changes is kinda impressive
* Make expansion plans more clear
* Move changelog entry
* Try to fix macos build
* Revert modifiers println in cursor_grab
* Make serde serialization less bug-prone
* 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
* Implement windows focus key press/release on Windows
* Docs
Co-authored-by: Murarth <murarth@gmail.com>
* Register windowWillExitFullScreen
* On macOS: Do not toggle fullscreen during fullscreen transition
* Add CHANGELOG
Co-authored-by: Freya Gentz <zegentzy@protonmail.com>
* Add support for Windows Dark Mode
* Add is_dark_mode() getter to WindowExtWindows
* Add WindowEvent::DarkModeChanged
* Add support for dark mode in Windows 10 builds > 18362
* Change strategy for querying windows 10 build version
* Drop window state before sending event
Co-Authored-By: daxpedda <daxpedda@gmail.com>
* Change implementation of windows dark mode support
* Expand supported range of windows 10 versions with dark mode
* Use get_function! macro where possible
* Minor style fixes
* Improve documentation for ThemeChanged
* Use `as` conversion for `BOOL`
* Correct CHANGELOG entry for dark mode
Co-authored-by: daxpedda <daxpedda@gmail.com>
Co-authored-by: Osspial <osspial@gmail.com>
* Implement changes to `RedrawRequested` event
Implements the changes described in #1041 for the X11 platform and for
platform-independent public-facing code.
* Fix `request_redraw` example
* Fix examples in lib docs
* Only issue `RedrawRequested` on final `Expose` event
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.
* 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 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
* Expose HINSTANCE now using a getter function
* Missing changes
* remove unused import
* Required changes for the PR
* Rust fmt
* Use GetWindowLong
* Use GetWindowLong
* [#1111] Use consistent return types for available_monitors()
Always use `impl Iterator<Item = MonitorHandle>` instead of
`AvailableMonitorsIter`. Fix an example that used the Debug
implementation of `AvailableMonitorsIter`.
* [#1111] Update changelog
* [#1111] Remove AvailableMonitorsIter type completely
* [#1111] Remove doc references to AvailableMonitorsIter
* 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.
* 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`
* 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
* Fix issues with redraw_requested when called during EventsCleared
* Format
* Fix event dispatch after RedrawRequested but before EventsCleared
This could happen if the event queue was cleared, we processed WM_PAINT,
but the event queue got re-filled before we checked to see it was empty.
* Fix paint ordering issues when resizing window
* Format
* Make FileDropHandler::iterate_filenames more robust
by replacing the call to mem::uninitialized with mem::zeroed and change
file name retrieval to use buffers of exact length as reported
by DragQueryFileW instead of relying on MAX_PATH.
* Change remaining calls of uninitialized to zeroed
* Run rustfmt
* Add CHANGELOG entry and comment
* README: Use shields.io instead of Herokuapp (#859)
* README: Link to FEATURES.md and missing features wiki page (#860)
Closes#854
* Update URLs (#863)
* CHANGELOG.md: Add line from #861 (legacy) that is missing from equivalent #964 (EL 2)
This decorelates the window management from the actual user content,
meaning:
- the created window no longer needs the user to draw something to
start existing
- it reduces our need to do roundtrips during initialization to
avoid protocol errors
* Support listing available video modes for a monitor
* Use derivative for Windows `MonitorHandle`
* Update FEATURES.md
* Fix multiline if statement
* Add documentation for `VideoMode` type
* First name consistency pass. More to come!
* Remove multitouch variable (hopefully this compiles!)
* Remove CreationError::NotSupported
* Add new error handling types
* Remove `get_` prefix from getters.
This is as per the Rust naming conventions recommended in
https://rust-lang-nursery.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter
* Make changes to Window position and size function signatures
* Remove CreationError in favor of OsError
* Begin updating iOS backend
* Change MonitorHandle::outer_position to just position
* Fix build on Windows and Linux
* Add Display and Error implementations to Error types
* Attempt to fix iOS build.
I can't actually check that this works since I can't cross-compile to
iOS on a Windows machine (thanks apple :/) but this should be one of
several commits to get it working.
* Attempt to fix iOS errors, and muck up Travis to make debugging easier
* More iOS fixins
* Add Debug and Display impls to OsError
* Fix Display impl
* Fix unused code warnings and travis
* Rename set_ime_spot to set_ime_position
* Add CHANGELOG entry
* Rename set_cursor to set_cursor_icon and MouseCursor to CursorIcon
* Organize Window functions into multiple, categorized impls
* Improve clarity of function ordering and docs in EventLoop
* Add additional numpad key mappings
Since some platforms have already used the existing `Add`, `Subtract`
and `Divide` codes to map numpad keys, the X11 and Wayland platform has
been updated to achieve parity between platforms. On macOS only the
`Subtract` numpad key had to be added.
Since the numpad key is different from the normal keys, an alternative
option would be to add new `NumpadAdd`, `NumpadSubtract` and
`NumpadDivide` actions, however I think in this case it should be fine
to map them to the same virtual key code.
* Add Numpad PageUp/Down, Home and End on Wayland
* Use `XRRGetScreenResourcesCurrent` when avail.
Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
* Changelog
Signed-off-by: Hal Gentz <zegentzy@protonmail.com>
XNextEvent will block for input while holding the global Xlib mutex.
This will cause a deadlock in even the most trivial multi-threaded
application because OpenGL functions will need to hold the Xlib mutex
too.
Add EventsLoop::poll_one_event and EventsLoop::wait_for_input to provide
thread-safe functions to poll and wait events from the X11 event queue
using unix select(2) and XCheckIfEvent.
This is a somewhat ugly workaround to an ugly problem.
Fixes#779
* Fix incorrect keycodes when using a non-US keyboard layout.
This commit fixes the issue described in #752, and uses the advised
method to fix it.
* Style fixes
Co-Authored-By: Toqozz <toqoz@hotmail.com>
* Refactoring of macOS `virtualkeycode` fix (#752)
* Applies requested changes as per pull request discussion (#755).
* 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
* Add support for generating dummy DeviceIDs and WindowIDs
* Fix linux
* Improve docs and move dummy to unsafe
* Strengthen guarantees a bit
* Add backticks to CHANGELOG.md
Co-Authored-By: Xaeroxe <xaeroxe@amethyst-engine.org>
* feat: add macos simple fullscreen
* move impl to WindowExt
* feedback: remove warning, unused file and rename param
* feedback: combine fullscreen examples into one example
* fix: ensure decorations and maximize do not toggle while in fullscreen
* fix: prevent warning on non-macos platforms
* feedback: make changelog more explicit
* fix: prevent unconditional construction of NSRect
* fix: don't try to set_simple_fullscreen if already using native fullscreen
* fix: ensure set_simple_fullscreen plays nicely with set_fullscreen
* fix: do not enter native fullscreen if simple fullscreen is active
This commit restricts an Xfwm4-specific DPI-preserving hack to Xfwm4
only. The hack saves and restores the DPI-adjusted size until the actual
size matches. On tiling WMs like i3 this fails, since the size is
constrained by the layout. This in turn causes a never-ending
XResizeWindow vs. XConfigureWindow fight between the WM and the client,
making the WM, winit client, and Xorg consume all CPU cycles available.
* Fix resize border appearing in some cases after leaving fullscreen.
* On fullscreen, save client rect instead of window rect
* Add CHANGELOG entry
* Revert test changes to fullscreen example
* Update panic message when unable to get client area
* Move the event managent to the closure
In preparation of more events not relating to the SeatManager being
captured.
* Handle wl_output remove events
In some cases, wl_outputs can be removed without the compositor
notifying the surfaces using leave/enter events. This breaks the DPI and
resize stuff since the windows' list of monitors were not updated.
Now, wl_output removals are handled and windows are updated accordingly.
* Add changelog entry for disappearing wl_outputs
* Clearer changelog message for wl_output removal changes
* Fix panic when dragging text onto a window on Windws (#697)
* Changed `panic` to `debug` (log) when unknow error occurs in `GetData` while processing a drag-drop / hover event. Plus added appropriate cursor effect if hovered item can not be processed.
* Improved code clarity.
* Add documentation to clarify behaviour of `DroppedFile`, `HoveredFile`, and `HoveredFileCancelled`
* Add period at the end of sentences in documentation.