winit/src/platform_impl/windows
Philippe Renon 2f27f64cdb
On Windows, fix request_redraw() related panics (#1461)
* 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
2020-03-07 14:04:24 -05:00
..
event_loop On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00
dark_mode.rs Remove assertions from Windows dark mode code (#1459) 2020-03-07 13:56:33 -05:00
dpi.rs On Windows, make AdjustRect calls DPI-aware when possible (#1015) 2020-01-05 14:15:11 -05:00
drop_handler.rs WIP - Make EL2 DPI changes and implement on Windows (#895) 2020-01-05 14:15:11 -05:00
event.rs Implement ModifiersChanged on Windows, and fix bugs discovered in implementation process (#1344) 2019-12-30 14:11:11 -05:00
event_loop.rs On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00
icon.rs Format everything and add rustfmt to travis (#951) 2019-06-21 11:33:15 -04:00
mod.rs Add support for Windows Dark Mode (#1217) 2019-12-22 12:04:09 -07:00
monitor.rs Rename hidpi_factor to scale_factor (#1334) 2020-01-05 14:15:12 -05:00
raw_input.rs Improve handling of file paths in the windows DnD handler (#980) 2019-06-28 18:07:36 -04:00
util.rs On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00
window.rs On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00
window_state.rs On Windows, fix request_redraw() related panics (#1461) 2020-03-07 14:04:24 -05:00