@@ -21,7 +21,6 @@ use std::{
21
21
mem, panic, ptr,
22
22
rc:: Rc ,
23
23
sync:: {
24
- atomic:: { AtomicBool , Ordering } ,
25
24
mpsc:: { self , Receiver , Sender } ,
26
25
Arc ,
27
26
} ,
@@ -109,7 +108,6 @@ pub struct EventLoop<T: 'static> {
109
108
110
109
pub struct EventLoopWindowTarget < T > {
111
110
thread_id : DWORD ,
112
- trigger_newevents_on_redraw : Arc < AtomicBool > ,
113
111
thread_msg_target : HWND ,
114
112
pub ( crate ) runner_shared : EventLoopRunnerShared < T > ,
115
113
}
@@ -136,7 +134,6 @@ impl<T: 'static> EventLoop<T> {
136
134
window_target : RootELW {
137
135
p : EventLoopWindowTarget {
138
136
thread_id,
139
- trigger_newevents_on_redraw : Arc :: new ( AtomicBool :: new ( true ) ) ,
140
137
thread_msg_target,
141
138
runner_shared,
142
139
} ,
@@ -235,7 +232,6 @@ impl<T> EventLoopWindowTarget<T> {
235
232
pub ( crate ) fn create_thread_executor ( & self ) -> EventLoopThreadExecutor {
236
233
EventLoopThreadExecutor {
237
234
thread_id : self . thread_id ,
238
- trigger_newevents_on_redraw : self . trigger_newevents_on_redraw . clone ( ) ,
239
235
target_window : self . thread_msg_target ,
240
236
}
241
237
}
@@ -306,7 +302,6 @@ impl<T> Drop for EventLoop<T> {
306
302
307
303
pub ( crate ) struct EventLoopThreadExecutor {
308
304
thread_id : DWORD ,
309
- trigger_newevents_on_redraw : Arc < AtomicBool > ,
310
305
target_window : HWND ,
311
306
}
312
307
@@ -320,10 +315,6 @@ impl EventLoopThreadExecutor {
320
315
self . thread_id == cur_thread_id
321
316
}
322
317
323
- pub ( super ) fn trigger_newevents_on_redraw ( & self ) -> bool {
324
- !self . in_event_loop_thread ( ) || self . trigger_newevents_on_redraw . load ( Ordering :: Relaxed )
325
- }
326
-
327
318
/// Executes a function in the event loop thread. If we're already in the event loop thread,
328
319
/// we just call the function directly.
329
320
///
@@ -415,12 +406,6 @@ lazy_static! {
415
406
winuser:: RegisterWindowMessageA ( "Winit::InitialDpiMsg\0 " . as_ptr( ) as LPCSTR )
416
407
}
417
408
} ;
418
- // Message sent by a `Window` if it's requesting a redraw without sending a NewEvents.
419
- pub static ref REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID : u32 = {
420
- unsafe {
421
- winuser:: RegisterWindowMessageA ( "Winit::RequestRedrawNoNewevents\0 " . as_ptr( ) as LPCSTR )
422
- }
423
- } ;
424
409
// WPARAM is a bool specifying the `WindowFlags::MARKER_RETAIN_STATE_ON_SIZE` flag. See the
425
410
// documentation in the `window_state` module for more information.
426
411
pub static ref SET_RETAIN_STATE_ON_SIZE_MSG_ID : u32 = unsafe {
@@ -598,41 +583,8 @@ unsafe extern "system" fn public_window_callback<T>(
598
583
0
599
584
}
600
585
601
- _ if msg == * REQUEST_REDRAW_NO_NEWEVENTS_MSG_ID => {
602
- use crate :: event:: WindowEvent :: RedrawRequested ;
603
- subclass_input. window_state . lock ( ) . queued_out_of_band_redraw = false ;
604
-
605
- // This check makes sure that requesting a redraw during `EventsCleared`
606
- // handling dispatch `RedrawRequested` immediately after `EventsCleared`, without
607
- // spinning up a new event loop iteration. We do this because that's what the API
608
- // says to do.
609
- match subclass_input. event_loop_runner . handling_events ( ) {
610
- true => {
611
- winuser:: RedrawWindow (
612
- window,
613
- ptr:: null ( ) ,
614
- ptr:: null_mut ( ) ,
615
- winuser:: RDW_INTERNALPAINT ,
616
- ) ;
617
- }
618
- false => {
619
- subclass_input
620
- . event_loop_runner
621
- . call_event_handler ( Event :: WindowEvent {
622
- window_id : RootWindowId ( WindowId ( window) ) ,
623
- event : RedrawRequested ,
624
- } ) ;
625
- }
626
- }
627
-
628
- 0
629
- }
630
586
winuser:: WM_PAINT => {
631
- use crate :: event:: WindowEvent :: RedrawRequested ;
632
- subclass_input. send_event ( Event :: WindowEvent {
633
- window_id : RootWindowId ( WindowId ( window) ) ,
634
- event : RedrawRequested ,
635
- } ) ;
587
+ subclass_input. send_event ( Event :: RedrawRequested ( RootWindowId ( WindowId ( window) ) ) ) ;
636
588
commctrl:: DefSubclassProc ( window, msg, wparam, lparam)
637
589
}
638
590
0 commit comments