From 9146082cdfc4b53c1f805828a5ac4b50477513ca Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 11 Jul 1999 20:49:54 +0000 Subject: [PATCH] New global cursor behaviour. Test for tear-off menus in controls sample. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/controls.cpp | 2 +- src/gtk/window.cpp | 37 ++++++++++++++++++++++++----------- src/gtk1/window.cpp | 37 ++++++++++++++++++++++++----------- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index ebd18e12cc..b771b00a5e 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -164,7 +164,7 @@ bool MyApp::OnInit() frame->SetIcon( wxICON(mondrian) ); - wxMenu *file_menu = new wxMenu; + wxMenu *file_menu = new wxMenu( wxMENU_TEAROFF ); file_menu->Append(MINIMAL_ABOUT, "&About\tF1"); file_menu->Append(MINIMAL_QUIT, "E&xit\tAlt-X", "Quit controls sample"); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ee398f439a..75208ec494 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2191,19 +2191,34 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxWindow::OnInternalIdle() { - GdkWindow *window = GetConnectWidget()->window; - if (window) - { - wxCursor cursor = m_cursor; - if (g_globalCursor.Ok()) cursor = g_globalCursor; + wxCursor cursor = m_cursor; + if (g_globalCursor.Ok()) cursor = g_globalCursor; - if (cursor.Ok() && m_currentGdkCursor != cursor) - { + if (cursor.Ok() && m_currentGdkCursor != cursor) + { + if (m_wxwindow) + { + GdkWindow *window = m_wxwindow->window; + if (window) gdk_window_set_cursor( window, cursor.GetCursor() ); - m_currentGdkCursor = cursor; - } - } - + + if (!g_globalCursor.Ok()) + cursor = *wxSTANDARD_CURSOR; + + window = m_widget->window; + if (window) + gdk_window_set_cursor( window, cursor.GetCursor() ); + } + else + { + GdkWindow *window = m_widget->window; + if (window) + gdk_window_set_cursor( window, cursor.GetCursor() ); + } + + m_currentGdkCursor = cursor; + } + UpdateWindowUI(); } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index ee398f439a..75208ec494 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2191,19 +2191,34 @@ void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags ) void wxWindow::OnInternalIdle() { - GdkWindow *window = GetConnectWidget()->window; - if (window) - { - wxCursor cursor = m_cursor; - if (g_globalCursor.Ok()) cursor = g_globalCursor; + wxCursor cursor = m_cursor; + if (g_globalCursor.Ok()) cursor = g_globalCursor; - if (cursor.Ok() && m_currentGdkCursor != cursor) - { + if (cursor.Ok() && m_currentGdkCursor != cursor) + { + if (m_wxwindow) + { + GdkWindow *window = m_wxwindow->window; + if (window) gdk_window_set_cursor( window, cursor.GetCursor() ); - m_currentGdkCursor = cursor; - } - } - + + if (!g_globalCursor.Ok()) + cursor = *wxSTANDARD_CURSOR; + + window = m_widget->window; + if (window) + gdk_window_set_cursor( window, cursor.GetCursor() ); + } + else + { + GdkWindow *window = m_widget->window; + if (window) + gdk_window_set_cursor( window, cursor.GetCursor() ); + } + + m_currentGdkCursor = cursor; + } + UpdateWindowUI(); } -- 2.45.2