@@ -20,7 +20,6 @@ use std::{
20
20
mem, panic, ptr,
21
21
rc:: Rc ,
22
22
sync:: {
23
- atomic:: { AtomicBool , Ordering } ,
24
23
mpsc:: { self , Receiver , Sender } ,
25
24
Arc ,
26
25
} ,
@@ -92,7 +91,6 @@ pub struct EventLoop<T: 'static> {
92
91
93
92
pub struct EventLoopWindowTarget < T > {
94
93
thread_id : DWORD ,
95
- trigger_newevents_on_redraw : Arc < AtomicBool > ,
96
94
thread_msg_target : HWND ,
97
95
pub ( crate ) runner_shared : EventLoopRunnerShared < T > ,
98
96
}
@@ -119,7 +117,6 @@ impl<T: 'static> EventLoop<T> {
119
117
window_target : RootELW {
120
118
p : EventLoopWindowTarget {
121
119
thread_id,
122
- trigger_newevents_on_redraw : Arc :: new ( AtomicBool :: new ( true ) ) ,
123
120
thread_msg_target,
124
121
runner_shared,
125
122
} ,
@@ -218,7 +215,6 @@ impl<T> EventLoopWindowTarget<T> {
218
215
pub ( crate ) fn create_thread_executor ( & self ) -> EventLoopThreadExecutor {
219
216
EventLoopThreadExecutor {
220
217
thread_id : self . thread_id ,
221
- trigger_newevents_on_redraw : self . trigger_newevents_on_redraw . clone ( ) ,
222
218
target_window : self . thread_msg_target ,
223
219
}
224
220
}
@@ -289,7 +285,6 @@ impl<T> Drop for EventLoop<T> {
289
285
290
286
pub ( crate ) struct EventLoopThreadExecutor {
291
287
thread_id : DWORD ,
292
- trigger_newevents_on_redraw : Arc < AtomicBool > ,
293
288
target_window : HWND ,
294
289
}
295
290
@@ -303,10 +298,6 @@ impl EventLoopThreadExecutor {
303
298
self . thread_id == cur_thread_id
304
299
}
305
300
306
- pub ( super ) fn trigger_newevents_on_redraw ( & self ) -> bool {
307
- !self . in_event_loop_thread ( ) || self . trigger_newevents_on_redraw . load ( Ordering :: Relaxed )
308
- }
309
-
310
301
/// Executes a function in the event loop thread. If we're already in the event loop thread,
311
302
/// we just call the function directly.
312
303
///
@@ -398,12 +389,6 @@ lazy_static! {
398
389
winuser:: RegisterWindowMessageA ( "Winit::InitialDpiMsg\0 " . as_ptr( ) as LPCSTR )
399
390
}
400
391
} ;
401
- // Message sent by a `Window` if it's requesting a redraw without sending a NewEvents.
402
- pub static ref REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID : u32 = {
403
- unsafe {
404
- winuser:: RegisterWindowMessageA ( "Winit::RequestRedrawNoNewevents\0 " . as_ptr( ) as LPCSTR )
405
- }
406
- } ;
407
392
// WPARAM is a bool specifying the `WindowFlags::MARKER_RETAIN_STATE_ON_SIZE` flag. See the
408
393
// documentation in the `window_state` module for more information.
409
394
pub static ref SET_RETAIN_STATE_ON_SIZE_MSG_ID : u32 = unsafe {
@@ -581,41 +566,8 @@ unsafe extern "system" fn public_window_callback<T>(
581
566
0
582
567
}
583
568
584
- _ if msg == * REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID => {
585
- use crate :: event:: WindowEvent :: RedrawRequested ;
586
- subclass_input. window_state . lock ( ) . queued_out_of_band_redraw = false ;
587
-
588
- // This check makes sure that requesting a redraw during `EventsCleared`
589
- // handling dispatch `RedrawRequested` immediately after `EventsCleared`, without
590
- // spinning up a new event loop iteration. We do this because that's what the API
591
- // says to do.
592
- match subclass_input. event_loop_runner . handling_events ( ) {
593
- true => {
594
- winuser:: RedrawWindow (
595
- window,
596
- ptr:: null ( ) ,
597
- ptr:: null_mut ( ) ,
598
- winuser:: RDW_INTERNALPAINT ,
599
- ) ;
600
- }
601
- false => {
602
- subclass_input
603
- . event_loop_runner
604
- . call_event_handler ( Event :: WindowEvent {
605
- window_id : RootWindowId ( WindowId ( window) ) ,
606
- event : RedrawRequested ,
607
- } ) ;
608
- }
609
- }
610
-
611
- 0
612
- }
613
569
winuser:: WM_PAINT => {
614
- use crate :: event:: WindowEvent :: RedrawRequested ;
615
- subclass_input. send_event ( Event :: WindowEvent {
616
- window_id : RootWindowId ( WindowId ( window) ) ,
617
- event : RedrawRequested ,
618
- } ) ;
570
+ subclass_input. send_event ( Event :: RedrawRequested ( RootWindowId ( WindowId ( window) ) ) ) ;
619
571
commctrl:: DefSubclassProc ( window, msg, wparam, lparam)
620
572
}
621
573
0 commit comments