Mercurial > octave-nkf
comparison src/graphics.cc @ 13935:e48e8253ce58
Re-allow recursive graphics event processing.
* src/graphics.cc (gh_manager::do_process_events): Re-allow recursivity.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 25 Nov 2011 17:09:19 +0000 |
parents | 9cae456085c2 |
children | bf209050014f |
comparison
equal
deleted
inserted
replaced
13934:7a756a7e145b | 13935:e48e8253ce58 |
---|---|
7790 int | 7790 int |
7791 gh_manager::do_process_events (bool force) | 7791 gh_manager::do_process_events (bool force) |
7792 { | 7792 { |
7793 graphics_event e; | 7793 graphics_event e; |
7794 bool old_Vdrawnow_requested = Vdrawnow_requested; | 7794 bool old_Vdrawnow_requested = Vdrawnow_requested; |
7795 unwind_protect frame; | 7795 bool events_executed = false; |
7796 | 7796 |
7797 static int process_events_executing = 0; | 7797 do |
7798 | 7798 { |
7799 frame.protect_var (process_events_executing); | 7799 e = graphics_event (); |
7800 | 7800 |
7801 if (++process_events_executing <= 1) | 7801 gh_manager::lock (); |
7802 { | 7802 |
7803 do | 7803 if (! event_queue.empty ()) |
7804 { | 7804 { |
7805 e = graphics_event (); | 7805 if (callback_objects.empty () || force) |
7806 | 7806 { |
7807 gh_manager::lock (); | 7807 e = event_queue.front (); |
7808 | 7808 |
7809 if (! event_queue.empty ()) | 7809 event_queue.pop_front (); |
7810 { | 7810 } |
7811 if (callback_objects.empty () || force) | 7811 else |
7812 { | |
7813 const graphics_object& go = callback_objects.front (); | |
7814 | |
7815 if (go.get_properties ().is_interruptible ()) | |
7812 { | 7816 { |
7813 e = event_queue.front (); | 7817 e = event_queue.front (); |
7814 | 7818 |
7815 event_queue.pop_front (); | 7819 event_queue.pop_front (); |
7816 } | 7820 } |
7817 else | 7821 } |
7818 { | 7822 } |
7819 const graphics_object& go = callback_objects.front (); | |
7820 | |
7821 if (go.get_properties ().is_interruptible ()) | |
7822 { | |
7823 e = event_queue.front (); | |
7824 | |
7825 event_queue.pop_front (); | |
7826 } | |
7827 } | |
7828 } | |
7829 | |
7830 gh_manager::unlock (); | |
7831 | |
7832 if (e.ok ()) | |
7833 e.execute (); | |
7834 } | |
7835 while (e.ok ()); | |
7836 | |
7837 gh_manager::lock (); | |
7838 | |
7839 if (event_queue.empty () && event_processing == 0) | |
7840 command_editor::remove_event_hook (gh_manager::process_events); | |
7841 | 7823 |
7842 gh_manager::unlock (); | 7824 gh_manager::unlock (); |
7843 | 7825 |
7844 flush_octave_stdout (); | 7826 if (e.ok ()) |
7845 | 7827 { |
7846 if (Vdrawnow_requested && ! old_Vdrawnow_requested) | 7828 e.execute (); |
7847 { | 7829 events_executed = true; |
7848 feval ("drawnow"); | 7830 } |
7849 | 7831 } |
7850 Vdrawnow_requested = false; | 7832 while (e.ok ()); |
7851 } | 7833 |
7834 gh_manager::lock (); | |
7835 | |
7836 if (event_queue.empty () && event_processing == 0) | |
7837 command_editor::remove_event_hook (gh_manager::process_events); | |
7838 | |
7839 gh_manager::unlock (); | |
7840 | |
7841 if (events_executed) | |
7842 flush_octave_stdout (); | |
7843 | |
7844 if (Vdrawnow_requested && ! old_Vdrawnow_requested) | |
7845 { | |
7846 feval ("drawnow"); | |
7847 | |
7848 Vdrawnow_requested = false; | |
7852 } | 7849 } |
7853 | 7850 |
7854 return 0; | 7851 return 0; |
7855 } | 7852 } |
7856 | 7853 |