From 082b27986b4f0f6751c1482992fc0d9eae5a931e Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 27 May 1999 09:34:17 +0000 Subject: [PATCH] Small cursor improvements git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/window.h | 5 +++++ include/wx/gtk1/window.h | 5 +++++ src/gtk/frame.cpp | 4 ++++ src/gtk/window.cpp | 12 ++++++++---- src/gtk1/frame.cpp | 4 ++++ src/gtk1/window.cpp | 12 ++++++++---- 6 files changed, 34 insertions(+), 8 deletions(-) diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 167d3bc338..6730525a86 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -195,6 +195,11 @@ public: bool m_delayedForegroundColour:1; bool m_delayedBackgroundColour:1; bool m_delayedCursor:1; + + // the cursor is set in OnInternalIdle(). this fields holds + // a reference to the cursor currently set in theGdk window + // so that we don't have to set it more than once + wxCursor m_currentGdkCursor; // contains GTK's widgets internal information about non-default widget // font and colours. we create one for each widget that gets any diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 167d3bc338..6730525a86 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -195,6 +195,11 @@ public: bool m_delayedForegroundColour:1; bool m_delayedBackgroundColour:1; bool m_delayedCursor:1; + + // the cursor is set in OnInternalIdle(). this fields holds + // a reference to the cursor currently set in theGdk window + // so that we don't have to set it more than once + wxCursor m_currentGdkCursor; // contains GTK's widgets internal information about non-default widget // font and colours. we create one for each widget that gets any diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index b4195914f8..66dece16c5 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -749,6 +749,10 @@ void wxFrame::OnInternalIdle() GtkOnSize( m_x, m_y, m_width, m_height ); DoMenuUpdates(); + + if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); + if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); + if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle(); } void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 5a676c5c1b..fdce311eec 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2030,10 +2030,14 @@ void wxWindow::OnInternalIdle() GdkWindow *window = GetConnectWidget()->window; if (window) { - if (g_globalCursor.Ok()) - gdk_window_set_cursor( window, g_globalCursor.GetCursor() ); - else - gdk_window_set_cursor( window, m_cursor.GetCursor() ); + wxCursor cursor = m_cursor; + if (g_globalCursor.Ok()) cursor = g_globalCursor; + + if (m_currentGdkCursor != cursor) + { + gdk_window_set_cursor( window, cursor.GetCursor() ); + m_currentGdkCursor = cursor; + } } UpdateWindowUI(); diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index b4195914f8..66dece16c5 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -749,6 +749,10 @@ void wxFrame::OnInternalIdle() GtkOnSize( m_x, m_y, m_width, m_height ); DoMenuUpdates(); + + if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); + if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); + if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle(); } void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 5a676c5c1b..fdce311eec 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2030,10 +2030,14 @@ void wxWindow::OnInternalIdle() GdkWindow *window = GetConnectWidget()->window; if (window) { - if (g_globalCursor.Ok()) - gdk_window_set_cursor( window, g_globalCursor.GetCursor() ); - else - gdk_window_set_cursor( window, m_cursor.GetCursor() ); + wxCursor cursor = m_cursor; + if (g_globalCursor.Ok()) cursor = g_globalCursor; + + if (m_currentGdkCursor != cursor) + { + gdk_window_set_cursor( window, cursor.GetCursor() ); + m_currentGdkCursor = cursor; + } } UpdateWindowUI(); -- 2.45.2