pub fn process_events<'a>(
        &mut self,
        term: &'a FairMutex<Term>,
        window: &mut Window
    ) -> MutexGuard<'a, Term> {
        // Terminal is lazily initialized the first time an event is returned
        // from the blocking WaitEventsIterator. Otherwise, the pty reader would
        // be blocked the entire time we wait for input!
        let mut terminal;

        self.pending_events.clear();

        {
            // Ditto on lazy initialization for context and processor.
            let context;
            let mut processor: input::Processor<ActionContext<N>>;

            let print_events = self.print_events;

            let ref_test = self.ref_test;
            let resize_tx = &self.resize_tx;

            if self.wait_for_event {
                // A Vec is used here since wait_events can potentially yield
                // multiple events before the interrupt is handled. For example,
                // Resize and Moved events.
                let pending_events = &mut self.pending_events;
                window.wait_events(|e| {
                    pending_events.push(e);
                    glutin::ControlFlow::Break
                });
            }

            terminal = term.lock();

            context = ActionContext {
                terminal: &mut terminal,
                notifier: &mut self.notifier,
                selection: &mut self.selection,
                mouse: &mut self.mouse,
                size_info: &self.size_info,
                selection_modified: false,
                received_count: &mut self.received_count,
                suppress_chars: &mut self.suppress_chars,
                last_modifiers: &mut self.last_modifiers,
            };

            processor = input::Processor {
                ctx: context,
                mouse_config: &self.mouse_config,
                key_bindings: &self.key_bindings[..],
                mouse_bindings: &self.mouse_bindings[..],
            };

            let mut window_is_focused = window.is_focused;

            // Scope needed to that hide_cursor isn't borrowed after the scope
            // ends.
            {
                let hide_cursor = &mut self.hide_cursor;
                let mut process = |event| {
                    if print_events {
                        println!("glutin event: {:?}", event);
                    }
                    Processor::handle_event(
                        &mut processor,
                        event,
                        ref_test,
                        resize_tx,
                        hide_cursor,
                        &mut window_is_focused,
                    );
                };

                for event in self.pending_events.drain(..) {
                    process(event);
                }

                window.poll_events(process);
            }

            if self.hide_cursor_when_typing {
                window.set_cursor_visible(!self.hide_cursor);
            }

            window.is_focused = window_is_focused;

            if processor.ctx.selection_modified {
                processor.ctx.terminal.dirty = true;
            }
        }

        self.wait_for_event = !terminal.dirty;

        terminal
    }
/// Process events. When `wait_for_event` is set, this method is guaranteed
/// to process at least one event.
Process events. When `wait_for_event` is set, this method is guaranteed
to process at least one event.
Process events . When ` wait_for_event ` is set this method is guaranteed to process at least one event .
pub fn process_events<'a>(
        &mut self,
        term: &'a FairMutex<Term>,
        window: &mut Window
    ) -> MutexGuard<'a, Term> {
        // Terminal is lazily initialized the first time an event is returned
        // from the blocking WaitEventsIterator. Otherwise, the pty reader would
        // be blocked the entire time we wait for input!
        let mut terminal;
        self.pending_events.clear();
        {
            // Ditto on lazy initialization for context and processor.
            let context;
            let mut processor: input::Processor<ActionContext<N>>;
            let print_events = self.print_events;
            let ref_test = self.ref_test;
            let resize_tx = &self.resize_tx;
            if self.wait_for_event {
                // A Vec is used here since wait_events can potentially yield
                // multiple events before the interrupt is handled. For example,
                // Resize and Moved events.
                let pending_events = &mut self.pending_events;
                window.wait_events(|e| {
                    pending_events.push(e);
                    glutin::ControlFlow::Break
                });
            }
            terminal = term.lock();
            context = ActionContext {
                terminal: &mut terminal,
                notifier: &mut self.notifier,
                selection: &mut self.selection,
                mouse: &mut self.mouse,
                size_info: &self.size_info,
                selection_modified: false,
                received_count: &mut self.received_count,
                suppress_chars: &mut self.suppress_chars,
                last_modifiers: &mut self.last_modifiers,
            };
            processor = input::Processor {
                ctx: context,
                mouse_config: &self.mouse_config,
                key_bindings: &self.key_bindings[..],
                mouse_bindings: &self.mouse_bindings[..],
            };
            let mut window_is_focused = window.is_focused;
            // Scope needed to that hide_cursor isn't borrowed after the scope
            // ends.
            {
                let hide_cursor = &mut self.hide_cursor;
                let mut process = |event| {
                    if print_events {
                        println!("glutin event: {:?}", event);
                    }
                    Processor::handle_event(
                        &mut processor,
                        event,
                        ref_test,
                        resize_tx,
                        hide_cursor,
                        &mut window_is_focused,
                    );
                };
                for event in self.pending_events.drain(..) {
                    process(event);
                }
                window.poll_events(process);
            }
            if self.hide_cursor_when_typing {
                window.set_cursor_visible(!self.hide_cursor);
            }
            window.is_focused = window_is_focused;
            if processor.ctx.selection_modified {
                processor.ctx.terminal.dirty = true;
            }
        }
        self.wait_for_event = !terminal.dirty;
        terminal
    }
pub fn process_events < ' a > ( & mut self , term : & ' a FairMutex < Term > , window : & mut Window ) -> MutexGuard < ' a , Term > { // Terminal is lazily initialized the first time an event is returned // from the blocking WaitEventsIterator. Otherwise, the pty reader would // be blocked the entire time we wait for input! let mut terminal ; self . pending_events . clear ( ) ; { // Ditto on lazy initialization for context and processor. let context ; let mut processor : input :: Processor < ActionContext < N > > ; let print_events = self . print_events ; let ref_test = self . ref_test ; let resize_tx = & self . resize_tx ; if self . wait_for_event { // A Vec is used here since wait_events can potentially yield // multiple events before the interrupt is handled. For example, // Resize and Moved events. let pending_events = & mut self . pending_events ; window . wait_events ( | e | { pending_events . push ( e ) ; glutin :: ControlFlow :: Break } ) ; } terminal = term . lock ( ) ; context = ActionContext { terminal : & mut terminal , notifier : & mut self . notifier , selection : & mut self . selection , mouse : & mut self . mouse , size_info : & self . size_info , selection_modified : false , received_count : & mut self . received_count , suppress_chars : & mut self . suppress_chars , last_modifiers : & mut self . last_modifiers , } ; processor = input :: Processor { ctx : context , mouse_config : & self . mouse_config , key_bindings : & self . key_bindings [ .. ] , mouse_bindings : & self . mouse_bindings [ .. ] , } ; let mut window_is_focused = window . is_focused ; // Scope needed to that hide_cursor isn't borrowed after the scope // ends. { let hide_cursor = & mut self . hide_cursor ; let mut process = | event | { if print_events { println ! ( " " event ) ; } Processor :: handle_event ( & mut processor , event , ref_test , resize_tx , hide_cursor , & mut window_is_focused , ) ; } ; for event in self . pending_events . drain ( .. ) { process ( event ) ; } window . poll_events ( process ) ; } if self . hide_cursor_when_typing { window . set_cursor_visible ( ! self . hide_cursor ) ; } window . is_focused = window_is_focused ; if processor . ctx . selection_modified { processor . ctx . terminal . dirty = true ; } } self . wait_for_event = ! terminal . dirty ; terminal }
Process events.
Process events .
&mut self
term
&'a FairMutex<Term>
window
&mut Window
&mut self
term
&'a FairMutex<Term>
window
&mut Window