From 58d1c1ae86a096d5ef81c692427c238c1eb0e46d Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 6 May 1999 14:30:49 +0000 Subject: [PATCH] minor fixes cursor fix for splitter window git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2352 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/notebook.h | 3 +++ include/wx/gtk1/notebook.h | 3 +++ src/common/event.cpp | 9 +-------- src/generic/splitter.cpp | 20 +++++++++++++++++--- src/gtk/notebook.cpp | 6 ++++++ src/gtk/win_gtk.c | 6 ++++-- src/gtk/window.cpp | 10 +++++----- src/gtk1/notebook.cpp | 6 ++++++ src/gtk1/win_gtk.c | 6 ++++-- src/gtk1/window.cpp | 10 +++++----- 10 files changed, 54 insertions(+), 25 deletions(-) diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index 34e2906a9c..c23be2fe21 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -164,6 +164,9 @@ public: bool DoPhase(int phase); void ApplyWidgetStyle(); + // report if window belongs to notebook + bool IsOwnGtkWindow( GdkWindow *window ); + // common part of all ctors void Init(); diff --git a/include/wx/gtk1/notebook.h b/include/wx/gtk1/notebook.h index 34e2906a9c..c23be2fe21 100644 --- a/include/wx/gtk1/notebook.h +++ b/include/wx/gtk1/notebook.h @@ -164,6 +164,9 @@ public: bool DoPhase(int phase); void ApplyWidgetStyle(); + // report if window belongs to notebook + bool IsOwnGtkWindow( GdkWindow *window ); + // common part of all ctors void Init(); diff --git a/src/common/event.cpp b/src/common/event.cpp index 2f4f8be170..b0de8f2df3 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -67,14 +67,7 @@ { (const wxEventTable *)NULL, &wxEvtHandler::sm_eventTableEntries[0] }; const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = - { { 0, 0, 0, - #ifdef __SGI_CC__ - // stupid SGI compiler --- offer aug 98 - 0L } - #else // !SGI CC - NULL } - #endif // SGI/!SGI - }; + { { 0, 0, 0, (wxObjectEventFunction) NULL, (wxObject*) NULL } }; #endif // !USE_SHARED_LIBRARY diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index c52c7e7586..526ca5533e 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -153,6 +153,16 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) SetCursor(wxCursor()); #endif + // under wxGTK the method above causes the mouse + // to flicker so we set the standard cursor only + // when leaving the window and when moving over + // non-sash parts of the window. this should work + // on the other platforms as well, but who knows. +#ifdef __WXGTK__ + if (event.Leaving()) + SetCursor(* wxSTANDARD_CURSOR); +#endif + if (event.LeftDown()) { if ( SashHitTest(x, y) ) @@ -173,9 +183,6 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) m_dragMode = wxSPLIT_DRAG_NONE; ReleaseMouse(); -#ifdef __WXGTK__ - SetCursor(* wxSTANDARD_CURSOR); -#endif // Erase old tracker DrawSashTracker(m_oldX, m_oldY); @@ -253,6 +260,13 @@ void wxSplitterWindow::OnMouseEvent(wxMouseEvent& event) SetCursor(*m_sashCursorNS); } } +#ifdef __WXGTK__ + else + { + // where else do we unset the cursor? + SetCursor(* wxSTANDARD_CURSOR); + } +#endif } else if (event.Dragging() && (m_dragMode == wxSPLIT_DRAG_DRAGGING)) { diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 2eb7a24f51..05082ea6df 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -707,6 +707,12 @@ void wxNotebook::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +bool wxNotebook::IsOwnGtkWindow( GdkWindow *window ) +{ + return ((m_widget->window == window) || + (GTK_NOTEBOOK(m_widget)->panel == window)); +} + //----------------------------------------------------------------------------- // wxNotebookEvent //----------------------------------------------------------------------------- diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index cd9ed0177e..d7f721c56b 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -464,8 +464,10 @@ gtk_myfixed_size_request (GtkWidget *widget, myfixed = GTK_MYFIXED (widget); - requisition->width = widget->requisition.width; - requisition->height = widget->requisition.height; + /* request very little, I'm not sure if requesting nothing + will always have positive effects on stability... */ + requisition->width = 2; + requisition->height = 2; children = myfixed->children; while (children) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9200b4e12b..f03c85f08a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1092,7 +1092,7 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - if (widget->window != gdk_event->window) return FALSE; + if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if ((widget->window) && (win->m_cursor.Ok())) gdk_window_set_cursor( widget->window, win->m_cursor.GetCursor() ); @@ -1144,16 +1144,16 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - if (widget->window != gdk_event->window) return FALSE; + if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); /* - printf( "OnLeave from " ); + wxPrintf( _T("OnLeave from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); */ wxMouseEvent event( wxEVT_LEAVE_WINDOW ); diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index 2eb7a24f51..05082ea6df 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -707,6 +707,12 @@ void wxNotebook::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); } +bool wxNotebook::IsOwnGtkWindow( GdkWindow *window ) +{ + return ((m_widget->window == window) || + (GTK_NOTEBOOK(m_widget)->panel == window)); +} + //----------------------------------------------------------------------------- // wxNotebookEvent //----------------------------------------------------------------------------- diff --git a/src/gtk1/win_gtk.c b/src/gtk1/win_gtk.c index cd9ed0177e..d7f721c56b 100644 --- a/src/gtk1/win_gtk.c +++ b/src/gtk1/win_gtk.c @@ -464,8 +464,10 @@ gtk_myfixed_size_request (GtkWidget *widget, myfixed = GTK_MYFIXED (widget); - requisition->width = widget->requisition.width; - requisition->height = widget->requisition.height; + /* request very little, I'm not sure if requesting nothing + will always have positive effects on stability... */ + requisition->width = 2; + requisition->height = 2; children = myfixed->children; while (children) diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 9200b4e12b..f03c85f08a 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1092,7 +1092,7 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - if (widget->window != gdk_event->window) return FALSE; + if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if ((widget->window) && (win->m_cursor.Ok())) gdk_window_set_cursor( widget->window, win->m_cursor.GetCursor() ); @@ -1144,16 +1144,16 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return FALSE; if (g_blockEventsOnDrag) return FALSE; - if (widget->window != gdk_event->window) return FALSE; + if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); /* - printf( "OnLeave from " ); + wxPrintf( _T("OnLeave from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) - printf( win->GetClassInfo()->GetClassName() ); - printf( ".\n" ); + wxPrintf( win->GetClassInfo()->GetClassName() ); + wxPrintf( _T(".\n") ); */ wxMouseEvent event( wxEVT_LEAVE_WINDOW ); -- 2.45.2