From: Robert Roebling Date: Wed, 9 Sep 1998 09:57:24 +0000 (+0000) Subject: Tried to find a non-existing bug in the cursor-code X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d8c838755a67d716ce5069847db1d5c74f145d72 Tried to find a non-existing bug in the cursor-code Removed Karsten's third Makefile.in attempt git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/Makefile.in b/src/Makefile.in index acf8182d8e..ac4c031a08 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -48,11 +48,13 @@ install:: @echo " " @echo " Creating directories.." @$(WXBASEDIR)/mkinstalldirs \ - @prefix@/include/wx \ - @prefix@/include/wx/gtk \ - @prefix@/include/wx/common \ - @prefix@/include/wx/generic \ - @prefix@/include/wx/protocol \ + $(includedir)/wx \ + $(includedir)/wx/gtk \ + $(includedir)/wx/common \ + $(includedir)/wx/generic \ + $(includedir)/wx/protocol \ + $(libdir) \ + $(bindir) @echo " Copying headers from /include/wx" @cd $(WXBASEDIR)/include/wx ; \ $(INSTALL) -d $(includedir)/wx ; \ @@ -66,9 +68,7 @@ install:: for f in *.h ; do \ rm -f $(includedir)/wx/gtk/$$f ; \ $(INSTALL_DATA) $$f $(includedir)/wx/gtk/$$f ; \ - done ; \ - $(INSTALL) -d $(includedir)/wx/@host@/wx/gtk ;\ - mv $(includedir)/wx/gtk/setup.h $(includedir)/wx/@host@/wx/gtk/setup.h ;\ + done ; @echo " Copying headers from /include/wx/generic" @cd $(WXBASEDIR)/include/wx/generic ; \ $(INSTALL) -d $(includedir)/wx/generic ; \ @@ -88,21 +88,21 @@ install:: rm -f $(bindir)/wx-config ; \ $(INSTALL_PROGRAM) wx-config $(bindir)/wx-config @echo " Copying static library" - $(INSTALL) -d $(libdir) ;\ @cd $(WXBASEDIR)/lib/$(OS) ; \ rm -f $(libdir)/$(STATIC_LIBRARY) ; \ $(INSTALL_DATA) $(STATIC_LIBRARY) $(libdir)/$(STATIC_LIBRARY) - @echo " Copying shared library" - @cd $(WXBASEDIR)/lib/$(OS) ; \ - rm -f $(libdir)/$(SHARED_LIBRARY) ; \ - $(INSTALL_PROGRAM) $(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \ - $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so.$(LIB_MAJOR) ; \ - $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so + @if test -d $(SHARED_LIBRARY); then \ + echo " Copying shared library" \ + cd $(WXBASEDIR)/lib/$(OS) ; \ + rm -f $(libdir)/$(SHARED_LIBRARY) ; \ + $(INSTALL_PROGRAM) $(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \ + $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so.$(LIB_MAJOR) ; \ + $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \ + fi @echo " " @echo "Installation complete. You may have to run ldconfig!" @echo " " - clean:: $(RM) -rf gtk $(RM) -rf qt diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 6b9fd7f642..7195cfa0c6 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -133,7 +133,7 @@ bool wxCursor::operator != ( const wxCursor& cursor ) bool wxCursor::Ok(void) const { - return TRUE; + return (m_refData != NULL); } GdkCursor *wxCursor::GetCursor(void) const diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index eec08efb5b..0c574153af 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -134,6 +134,13 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp if (gdk_event->count > 0) return; +/* + printf( "OnExpose from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + wxPaintEvent event( win->GetId() ); event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); @@ -616,7 +623,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return TRUE; - if (widget->window) +/* + printf( "OnEnter from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + + if ((widget->window) && (win->m_cursor)) gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); wxMouseEvent event( wxEVT_ENTER_WINDOW ); @@ -640,7 +654,14 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return TRUE; - if (widget->window) +/* + printf( "OnLeave from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + + if ((widget->window) && (win->m_cursor)) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); wxMouseEvent event( wxEVT_LEAVE_WINDOW ); @@ -831,7 +852,7 @@ wxWindow::wxWindow() m_eventHandler = this; m_windowValidator = (wxValidator *) NULL; m_windowId = -1; - m_cursor = new wxCursor( wxCURSOR_ARROW ); + m_cursor = (wxCursor *) NULL; m_font = *wxSWISS_FONT; m_windowStyle = 0; m_windowName = "noname"; @@ -1063,7 +1084,7 @@ void wxWindow::PostCreation(void) gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); } - SetCursor( wxSTANDARD_CURSOR ); + SetCursor( *wxSTANDARD_CURSOR ); m_hasVMT = TRUE; } @@ -1704,15 +1725,26 @@ wxWindowID wxWindow::GetId(void) void wxWindow::SetCursor( const wxCursor &cursor ) { - wxASSERT(m_cursor != NULL); + if (m_cursor == NULL) + { + wxFAIL_MSG( "wxWindow::SetCursor m_cursor == NULL" ); + m_cursor = new wxCursor( wxCURSOR_ARROW ); + } + + if (cursor.Ok()) + { + if (*((wxCursor*)&cursor) == m_cursor) return; + *m_cursor = cursor; + } + else + { + *m_cursor = *wxSTANDARD_CURSOR; + } - if (m_cursor != NULL) - if (*m_cursor == cursor) - return; - (*m_cursor) = cursor; - if (m_widget->window) + if ((m_widget) && (m_widget->window)) gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); - if (m_wxwindow && m_wxwindow->window) + + if ((m_wxwindow) && (m_wxwindow->window)) gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() ); } diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index 6b9fd7f642..7195cfa0c6 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -133,7 +133,7 @@ bool wxCursor::operator != ( const wxCursor& cursor ) bool wxCursor::Ok(void) const { - return TRUE; + return (m_refData != NULL); } GdkCursor *wxCursor::GetCursor(void) const diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index eec08efb5b..0c574153af 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -134,6 +134,13 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp if (gdk_event->count > 0) return; +/* + printf( "OnExpose from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + wxPaintEvent event( win->GetId() ); event.SetEventObject( win ); win->GetEventHandler()->ProcessEvent( event ); @@ -616,7 +623,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return TRUE; - if (widget->window) +/* + printf( "OnEnter from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + + if ((widget->window) && (win->m_cursor)) gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); wxMouseEvent event( wxEVT_ENTER_WINDOW ); @@ -640,7 +654,14 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_ if (!win->HasVMT()) return TRUE; - if (widget->window) +/* + printf( "OnLeave from " ); + if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) + printf( win->GetClassInfo()->GetClassName() ); + printf( ".\n" ); +*/ + + if ((widget->window) && (win->m_cursor)) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); wxMouseEvent event( wxEVT_LEAVE_WINDOW ); @@ -831,7 +852,7 @@ wxWindow::wxWindow() m_eventHandler = this; m_windowValidator = (wxValidator *) NULL; m_windowId = -1; - m_cursor = new wxCursor( wxCURSOR_ARROW ); + m_cursor = (wxCursor *) NULL; m_font = *wxSWISS_FONT; m_windowStyle = 0; m_windowName = "noname"; @@ -1063,7 +1084,7 @@ void wxWindow::PostCreation(void) gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); } - SetCursor( wxSTANDARD_CURSOR ); + SetCursor( *wxSTANDARD_CURSOR ); m_hasVMT = TRUE; } @@ -1704,15 +1725,26 @@ wxWindowID wxWindow::GetId(void) void wxWindow::SetCursor( const wxCursor &cursor ) { - wxASSERT(m_cursor != NULL); + if (m_cursor == NULL) + { + wxFAIL_MSG( "wxWindow::SetCursor m_cursor == NULL" ); + m_cursor = new wxCursor( wxCURSOR_ARROW ); + } + + if (cursor.Ok()) + { + if (*((wxCursor*)&cursor) == m_cursor) return; + *m_cursor = cursor; + } + else + { + *m_cursor = *wxSTANDARD_CURSOR; + } - if (m_cursor != NULL) - if (*m_cursor == cursor) - return; - (*m_cursor) = cursor; - if (m_widget->window) + if ((m_widget) && (m_widget->window)) gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); - if (m_wxwindow && m_wxwindow->window) + + if ((m_wxwindow) && (m_wxwindow->window)) gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() ); }