Compare commits

...

4 Commits

Author SHA1 Message Date
Kirill Chibisov
e7037c6ad0 Release 0.27.4 version 2022-10-10 00:37:55 +03:00
Kirill Chibisov
51986bce26 On X11, fix IME crashing during reload
During reload we were picking old styles, but the styles could
change during reload leading to errors during IME building.

Fixes #2510.
2022-10-10 00:37:55 +03:00
Markus Siglreithmaier
429cc58f98 Windows, emit ReceivedCharacter on system keybinds
Currently needed for downstream users relaying on `ReceivedCharacter` for implementing
keybindings.
2022-10-10 00:37:55 +03:00
killian
81303d81a8 On Windows, fixed focus event emission on minimize. 2022-10-10 00:37:55 +03:00
5 changed files with 36 additions and 8 deletions

View File

@@ -8,6 +8,12 @@ And please only add new entries to the top of this list, right below the `# Unre
# Unreleased
# 0.27.4
- On Windows, emit `ReceivedCharacter` events on system keybindings.
- On Windows, fixed focus event emission on minimize.
- On X11, fixed IME crashing during reload.
# 0.27.3 (2022-9-10)
- On Windows, added `WindowExtWindows::set_undecorated_shadow` and `WindowBuilderExtWindows::with_undecorated_shadow` to draw the drop shadow behind a borderless window.

View File

@@ -1,6 +1,6 @@
[package]
name = "winit"
version = "0.27.3"
version = "0.27.4"
authors = ["The winit contributors", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Cross-platform window creation library."
edition = "2021"

View File

@@ -6,7 +6,7 @@
```toml
[dependencies]
winit = "0.27.3"
winit = "0.27.4"
```
## [Documentation](https://docs.rs/winit)

View File

@@ -108,10 +108,21 @@ unsafe fn replace_im(inner: *mut ImeInner) -> Result<(), ReplaceImError> {
let mut new_contexts = HashMap::new();
for (window, old_context) in (*inner).contexts.iter() {
let spot = old_context.as_ref().map(|old_context| old_context.ic_spot);
let style = old_context
// Check if the IME was allowed on that context.
let is_allowed = old_context
.as_ref()
.map(|old_context| old_context.style)
.map(|old_context| old_context.is_allowed())
.unwrap_or_default();
// We can't use the style from the old context here, since it may change on reload, so
// pick style from the new XIM based on the old state.
let style = if is_allowed {
new_im.preedit_style
} else {
new_im.none_style
};
let new_context = {
let result = ImeContext::new(
xconn,

View File

@@ -66,7 +66,7 @@ use windows_sys::Win32::{
WM_MOUSEWHEEL, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCCREATE, WM_NCDESTROY,
WM_NCLBUTTONDOWN, WM_PAINT, WM_POINTERDOWN, WM_POINTERUP, WM_POINTERUPDATE,
WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETFOCUS, WM_SETTINGCHANGE, WM_SIZE,
WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED,
WM_SYSCHAR, WM_SYSCOMMAND, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TOUCH, WM_WINDOWPOSCHANGED,
WM_WINDOWPOSCHANGING, WM_XBUTTONDOWN, WM_XBUTTONUP, WNDCLASSEXW, WS_EX_LAYERED,
WS_EX_NOACTIVATE, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_OVERLAPPED, WS_POPUP,
WS_VISIBLE,
@@ -1188,7 +1188,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
0
}
WM_CHAR => {
WM_CHAR | WM_SYSCHAR => {
use crate::event::WindowEvent::ReceivedCharacter;
use std::char;
let is_high_surrogate = (0xD800..=0xDBFF).contains(&wparam);
@@ -1219,7 +1219,18 @@ unsafe fn public_window_callback_inner<T: 'static>(
}
}
0
// todo(msiglreith):
// Ideally, `WM_SYSCHAR` shouldn't emit a `ReceivedChar` event
// indicating user text input. As we lack dedicated support
// accelerators/keybindings these events will be additionally
// emitted for downstream users.
// This means certain key combinations (ie Alt + Space) will
// trigger the default system behavior **and** emit a char event.
if msg == WM_SYSCHAR {
DefWindowProcW(window, msg, wparam, lparam)
} else {
0
}
}
WM_MENUCHAR => (MNC_CLOSE << 16) as isize,
@@ -1900,7 +1911,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
}
WM_NCACTIVATE => {
let is_active = wparam == 1;
let is_active = wparam != false.into();
let active_focus_changed = userdata.window_state.lock().set_active(is_active);
if active_focus_changed {
if is_active {