From 0b30bb0bda00908650d46b326ba04237f0d4121f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 7 Jul 2003 16:21:44 +0000 Subject: [PATCH] Added wxFrameBase::OnMenuOpen, and wxUSE_IDLEMENUUPDATES in platform.h Experimental wxUpdateUIEvent::SetUpdateInterval() function to limit UI update frequency git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/event.h | 18 +++++++++++++ include/wx/frame.h | 1 + include/wx/platform.h | 12 +++++++++ src/cocoa/app.mm | 2 ++ src/common/event.cpp | 54 +++++++++++++++++++++++++++++++++++++++ src/common/framecmn.cpp | 17 ++++++++++-- src/common/tbarbase.cpp | 3 ++- src/gtk/app.cpp | 2 ++ src/gtk/checkbox.cpp | 3 ++- src/gtk/listbox.cpp | 3 ++- src/gtk/radiobut.cpp | 3 ++- src/gtk/tbargtk.cpp | 3 ++- src/gtk/textctrl.cpp | 3 ++- src/gtk/tglbtn.cpp | 3 ++- src/gtk/window.cpp | 3 ++- src/gtk1/app.cpp | 2 ++ src/gtk1/checkbox.cpp | 3 ++- src/gtk1/listbox.cpp | 3 ++- src/gtk1/radiobut.cpp | 3 ++- src/gtk1/tbargtk.cpp | 3 ++- src/gtk1/textctrl.cpp | 3 ++- src/gtk1/tglbtn.cpp | 3 ++- src/gtk1/window.cpp | 3 ++- src/mac/app.cpp | 2 ++ src/mac/carbon/app.cpp | 2 ++ src/mac/carbon/window.cpp | 3 ++- src/mac/window.cpp | 3 ++- src/mgl/app.cpp | 2 ++ src/mgl/evtloop.cpp | 6 ++++- src/mgl/window.cpp | 3 ++- src/motif/app.cpp | 6 ++++- src/motif/window.cpp | 3 ++- src/msw/app.cpp | 2 ++ src/msw/evtloop.cpp | 6 ++++- src/msw/window.cpp | 3 ++- src/os2/app.cpp | 1 + src/os2/evtloop.cpp | 6 ++++- src/os2/window.cpp | 3 ++- src/x11/app.cpp | 2 ++ src/x11/evtloop.cpp | 6 ++++- src/x11/window.cpp | 3 ++- 41 files changed, 186 insertions(+), 29 deletions(-) diff --git a/include/wx/event.h b/include/wx/event.h index da5a1fcc17..7287f675fc 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -1529,6 +1529,20 @@ public: void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; } void SetText(const wxString& text) { m_text = text; m_setText = TRUE; } + // Sets the interval between updates in milliseconds. + // Set to -1 to disable updates, or to 0 to update as frequently as possible. + static void SetUpdateInterval(long updateInterval) { m_updateInterval = updateInterval; } + + // Returns the current interval between updates in milliseconds + static long GetUpdateInterval() { return m_updateInterval ; } + + // Can we update? + static bool CanUpdate() ; + + // Reset the update time to provide a delay until the next + // time we should update + static void ResetUpdateTime() ; + virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); } protected: @@ -1538,6 +1552,10 @@ protected: bool m_setText; bool m_setChecked; wxString m_text; +#if wxUSE_LONGLONG + static wxLongLong m_lastUpdate; +#endif + static long m_updateInterval; private: DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent) diff --git a/include/wx/frame.h b/include/wx/frame.h index c7fc61217a..02f03cc71d 100644 --- a/include/wx/frame.h +++ b/include/wx/frame.h @@ -142,6 +142,7 @@ public: // event handlers void OnIdle(wxIdleEvent& event); + void OnMenuOpen(wxMenuEvent& event); void OnMenuHighlight(wxMenuEvent& event); #if wxUSE_MENUS diff --git a/include/wx/platform.h b/include/wx/platform.h index edec9b976b..2a268134d0 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -327,5 +327,17 @@ #endif #endif +/* Choose which method we will use for updating menus + * - in OnIdle, or when we receive a wxEVT_MENU_OPEN event. + * Presently, only Windows and GTK+ support wxEVT_MENU_OPEN. + */ +#ifndef wxUSE_IDLEMENUUPDATES + #if defined(__WXMSW__) || defined(__WXGTK__) + #define wxUSE_IDLEMENUUPDATES 0 + #else + #define wxUSE_IDLEMENUUPDATES 1 + #endif +#endif + #endif /* _WX_PLATFORM_H_ */ diff --git a/src/cocoa/app.mm b/src/cocoa/app.mm index 4be00d75ab..c9614997a7 100644 --- a/src/cocoa/app.mm +++ b/src/cocoa/app.mm @@ -256,6 +256,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/common/event.cpp b/src/common/event.cpp index 0c9cac8de1..99d1100aa9 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -44,6 +44,9 @@ #if wxUSE_GUI #include "wx/validate.h" +#if wxUSE_STOPWATCH + #include "wx/stopwatch.h" +#endif #endif // wxUSE_GUI // ---------------------------------------------------------------------------- @@ -362,6 +365,57 @@ wxCommandEvent::wxCommandEvent(wxEventType commandType, int theId) m_isCommandEvent = TRUE; } +/* + * UI update events + */ + +#if wxUSE_LONGLONG +wxLongLong wxUpdateUIEvent::m_lastUpdate = 0; +#endif + +long wxUpdateUIEvent::m_updateInterval = 0; + +// Can we update? +bool wxUpdateUIEvent::CanUpdate() +{ + if (m_updateInterval == -1) + return FALSE; + else if (m_updateInterval == 0) + return TRUE; + else + { +#if wxUSE_STOPWATCH && wxUSE_LONGLONG + wxLongLong now = wxGetLocalTimeMillis(); + if (now > (m_lastUpdate + m_updateInterval)) + { + return TRUE; + } +#else + // If we don't have wxStopWatch or wxLongLong, we + // should err on the safe side and update now anyway. + return TRUE; +#endif + } + return FALSE; +} + +// Reset the update time to provide a delay until the next +// time we should update +void wxUpdateUIEvent::ResetUpdateTime() +{ +#if wxUSE_STOPWATCH && wxUSE_LONGLONG + if (m_updateInterval > 0) + { + wxLongLong now = wxGetLocalTimeMillis(); + if (now > (m_lastUpdate + m_updateInterval)) + { + m_lastUpdate = now; + } + } +#endif +} + + /* * Scroll events */ diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index a057189897..7e64059805 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -46,7 +46,12 @@ // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxFrameBase, wxTopLevelWindow) +#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES EVT_IDLE(wxFrameBase::OnIdle) +#endif +#if wxUSE_MENUS && !wxUSE_IDLEMENUUPDATES + EVT_MENU_OPEN(wxFrameBase::OnMenuOpen) +#endif EVT_MENU_HIGHLIGHT_ALL(wxFrameBase::OnMenuHighlight) END_EVENT_TABLE() @@ -219,9 +224,17 @@ void wxFrameBase::OnMenuHighlight(wxMenuEvent& event) void wxFrameBase::OnIdle(wxIdleEvent& WXUNUSED(event) ) { -#if wxUSE_MENUS +#if wxUSE_MENUS && wxUSE_IDLEMENUUPDATES + if (wxUpdateUIEvent::CanUpdate()) + DoMenuUpdates(); +#endif +} + +void wxFrameBase::OnMenuOpen(wxMenuEvent& WXUNUSED(event)) +{ +#if wxUSE_MENUS && !wxUSE_IDLEMENUUPDATES DoMenuUpdates(); -#endif // wxUSE_MENUS +#endif } // ---------------------------------------------------------------------------- diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index caef94d252..e53657dea2 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -583,7 +583,8 @@ void wxToolBarBase::OnMouseEnter(int id) void wxToolBarBase::OnIdle(wxIdleEvent& event) { - DoToolbarUpdates(); + if (wxUpdateUIEvent::CanUpdate()) + DoToolbarUpdates(); event.Skip(); } diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 8ded6a5944..b598da0307 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -550,6 +550,8 @@ bool wxApp::ProcessIdle() event.SetEventObject( this ); ProcessEvent( event ); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index c49c46ccff..4099d8406f 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -220,7 +220,8 @@ void wxCheckBox::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxCheckBox::DoGetBestSize() const diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 0cecdfddb1..88f951a037 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -1037,7 +1037,8 @@ void wxListBox::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxListBox::DoGetBestSize() const diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index d22bf804c2..a3b09060d5 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -239,7 +239,8 @@ void wxRadioButton::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxRadioButton::DoGetBestSize() const diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 2ce4bc754c..326ff64c76 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -673,7 +673,8 @@ void wxToolBar::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } #endif // wxUSE_TOOLBAR_NATIVE diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index d612b6a9c2..b87712e0c1 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -1591,7 +1591,8 @@ void wxTextCtrl::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxTextCtrl::DoGetBestSize() const diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 2a913203a7..9ad3fceec1 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -166,7 +166,8 @@ void wxToggleButton::OnInternalIdle() gdk_window_set_cursor(win, cursor.GetCursor()); } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // wxSize DoGetBestSize() const diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 0bc4aafc66..358c139fa6 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3022,7 +3022,8 @@ void wxWindowGTK::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } void wxWindowGTK::DoGetSize( int *width, int *height ) const diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 8ded6a5944..b598da0307 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -550,6 +550,8 @@ bool wxApp::ProcessIdle() event.SetEventObject( this ); ProcessEvent( event ); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index c49c46ccff..4099d8406f 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -220,7 +220,8 @@ void wxCheckBox::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxCheckBox::DoGetBestSize() const diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 0cecdfddb1..88f951a037 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -1037,7 +1037,8 @@ void wxListBox::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxListBox::DoGetBestSize() const diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index d22bf804c2..a3b09060d5 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -239,7 +239,8 @@ void wxRadioButton::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxRadioButton::DoGetBestSize() const diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 2ce4bc754c..326ff64c76 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -673,7 +673,8 @@ void wxToolBar::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } #endif // wxUSE_TOOLBAR_NATIVE diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index d612b6a9c2..b87712e0c1 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -1591,7 +1591,8 @@ void wxTextCtrl::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } wxSize wxTextCtrl::DoGetBestSize() const diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index 2a913203a7..9ad3fceec1 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -166,7 +166,8 @@ void wxToggleButton::OnInternalIdle() gdk_window_set_cursor(win, cursor.GetCursor()); } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // wxSize DoGetBestSize() const diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 0bc4aafc66..358c139fa6 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -3022,7 +3022,8 @@ void wxWindowGTK::OnInternalIdle() } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } void wxWindowGTK::DoGetSize( int *width, int *height ) const diff --git a/src/mac/app.cpp b/src/mac/app.cpp index b09fd3b848..e1e9dba922 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -978,6 +978,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index b09fd3b848..e1e9dba922 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -978,6 +978,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index aa3e705ea1..a75c421466 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1371,7 +1371,8 @@ void wxWindowMac::OnIdle(wxIdleEvent& event) { // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // Raise the window to the top of the Z order diff --git a/src/mac/window.cpp b/src/mac/window.cpp index aa3e705ea1..a75c421466 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -1371,7 +1371,8 @@ void wxWindowMac::OnIdle(wxIdleEvent& event) { // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // Raise the window to the top of the Z order diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index 2e85732f90..fba01c5b4b 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -278,6 +278,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/mgl/evtloop.cpp b/src/mgl/evtloop.cpp index fe0b328eae..34c9c24422 100644 --- a/src/mgl/evtloop.cpp +++ b/src/mgl/evtloop.cpp @@ -99,7 +99,11 @@ bool wxEventLoopImpl::SendIdleEvent() { wxIdleEvent event; - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + bool processed = wxTheApp->ProcessEvent(event); + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); } // ============================================================================ diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 35040259e3..bd8fa401a7 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -1278,5 +1278,6 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) void wxWindowMGL::OnIdle(wxIdleEvent& WXUNUSED(event)) { - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } diff --git a/src/motif/app.cpp b/src/motif/app.cpp index 0185173142..64758e0572 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -176,7 +176,11 @@ bool wxApp::ProcessIdle() { wxIdleEvent event; - return ProcessEvent(event) && event.MoreRequested(); + bool processed = ProcessEvent(event); + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); } void wxApp::ExitMainLoop() diff --git a/src/motif/window.cpp b/src/motif/window.cpp index abf0b434a0..2684299552 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1687,7 +1687,8 @@ void wxWindow::OnIdle(wxIdleEvent& WXUNUSED(event)) { // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // ---------------------------------------------------------------------------- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index dd14f9b063..08579d8319 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -691,6 +691,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index bf33c7d9e8..f61cc55e7f 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -139,7 +139,11 @@ bool wxEventLoopImpl::SendIdleMessage() { wxIdleEvent event; - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + bool processed = wxTheApp->ProcessEvent(event) ; + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); } // ============================================================================ diff --git a/src/msw/window.cpp b/src/msw/window.cpp index eab831591d..e552ef0e44 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1184,7 +1184,8 @@ void wxWindowMSW::OnIdle(wxIdleEvent& WXUNUSED(event)) } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // Set this window to be the child of 'parent'. diff --git a/src/os2/app.cpp b/src/os2/app.cpp index fc5d965009..d7539983f9 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -668,6 +668,7 @@ bool wxApp::ProcessIdle() vEvent.SetEventObject(this); ProcessEvent(vEvent); + wxUpdateUIEvent::ResetUpdateTime(); return vEvent.MoreRequested(); } // end of wxApp::ProcessIdle diff --git a/src/os2/evtloop.cpp b/src/os2/evtloop.cpp index 9274a96ca3..e177f38ee0 100644 --- a/src/os2/evtloop.cpp +++ b/src/os2/evtloop.cpp @@ -140,7 +140,11 @@ bool wxEventLoopImpl::SendIdleMessage() { wxIdleEvent event; - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + bool processed = wxTheApp->ProcessEvent(event) ; + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); } // ============================================================================ diff --git a/src/os2/window.cpp b/src/os2/window.cpp index e99ecaa4d2..7903c10e6c 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1364,7 +1364,8 @@ void wxWindowOS2::OnIdle( (void)GetEventHandler()->ProcessEvent(rEvent); } } - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); } // end of wxWindowOS2::OnIdle // diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 9bb8b70b8f..87fcdb4ea1 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -681,6 +681,8 @@ bool wxApp::ProcessIdle() event.SetEventObject(this); ProcessEvent(event); + wxUpdateUIEvent::ResetUpdateTime(); + return event.MoreRequested(); } diff --git a/src/x11/evtloop.cpp b/src/x11/evtloop.cpp index 910275db18..d236f1afc8 100644 --- a/src/x11/evtloop.cpp +++ b/src/x11/evtloop.cpp @@ -338,7 +338,11 @@ bool wxEventLoopImpl::SendIdleEvent() wxIdleEvent event; event.SetEventObject(wxTheApp); - return wxTheApp->ProcessEvent(event) && event.MoreRequested(); + bool processed = wxTheApp->ProcessEvent(event) ; + + wxUpdateUIEvent::ResetUpdateTime(); + + return processed && event.MoreRequested(); } // ============================================================================ diff --git a/src/x11/window.cpp b/src/x11/window.cpp index 5901a58e80..d787a4eaef 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1287,7 +1287,8 @@ void wxWindowX11::OnInternalIdle() // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - UpdateWindowUI(); + if (wxUpdateUIEvent::CanUpdate()) + UpdateWindowUI(); // Set the input focus if couldn't do it before if (m_needsInputFocus) -- 2.45.2